Basic configuration for new servers and start modularizing config

This commit is contained in:
Charlotte Van Petegem 2020-12-01 19:23:28 +01:00
parent 82bb5b401c
commit ca93d09059
No known key found for this signature in database
GPG key ID: 019E764B7184435A
38 changed files with 622 additions and 316 deletions

57
modules/git.nix Normal file
View file

@ -0,0 +1,57 @@
{ config, lib, pkgs, ... }:
{
options.chvp.git = {
enable = lib.mkOption {
default = true;
example = false;
};
email = lib.mkOption {
type = lib.types.str;
default = "charlotte@vanpetegem.me";
example = "charlotte@vanpetegem.me";
description = ''
Default email set in global git config.
'';
};
};
config =
let
base = {
home.packages = with pkgs; [
gitAndTools.gitflow
git-crypt
];
programs.git = {
enable = true;
extraConfig = {
branch = {
autosetuprebase = "always";
};
pull = {
rebase = true;
};
};
ignores = [
".direnv"
".envrc"
"shell.nix"
# Ruby dependencies in source tree
"/vendor/bundle"
"**/*.patch"
];
signing = {
key = "charlotte@vanpetegem.me";
signByDefault = config.chvp.graphical;
};
userEmail = config.chvp.git.email;
userName = "Charlotte Van Petegem";
};
};
in
lib.mkIf config.chvp.git.enable {
home-manager.users.charlotte = { ... }: base;
home-manager.users.root = { ... }: base;
};
}