feat(git): move custom config out of git module
This commit is contained in:
parent
134d6a3556
commit
522d18fea0
|
@ -36,7 +36,7 @@ with pkgs;
|
|||
|
||||
programs.gpg.enable = true;
|
||||
|
||||
programs.git.custom = {
|
||||
programs.git = {
|
||||
defaultProfile = "work";
|
||||
};
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
programs.gpg.enable = true;
|
||||
|
||||
programs.git.custom = {
|
||||
programs.git = {
|
||||
defaultProfile = "private";
|
||||
};
|
||||
|
||||
|
|
26
home/git.nix
26
home/git.nix
|
@ -7,7 +7,8 @@ in
|
|||
./modules/git.nix
|
||||
];
|
||||
|
||||
programs.git.custom = {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
profiles = {
|
||||
private = {
|
||||
name = "Felix Tenley";
|
||||
|
@ -23,5 +24,28 @@ in
|
|||
};
|
||||
};
|
||||
defaultProfile = "private";
|
||||
|
||||
ignores = [".direnv"];
|
||||
signing = {
|
||||
signByDefault = true;
|
||||
};
|
||||
extraConfig = {
|
||||
init = {
|
||||
defaultBranch = "main";
|
||||
};
|
||||
pull = {
|
||||
rebase = true;
|
||||
};
|
||||
rebase = {
|
||||
autoStash = true;
|
||||
autoSquash = true;
|
||||
abbreviateCommands = true;
|
||||
missingCommitsCheck = "warn";
|
||||
};
|
||||
};
|
||||
aliases = {
|
||||
mr = "!sh -c 'git fetch $1 merge-requests/$2/head:mr-$1-$2 && git checkout mr-$1-$2' -";
|
||||
pr = "!sh -c 'git fetch $1 refs/pull/$2/head:pr/$1 && git checkout pr/$2'";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.programs.git.custom;
|
||||
cfg = config.programs.git;
|
||||
in
|
||||
{
|
||||
options.programs.git.custom = {
|
||||
options.programs.git = {
|
||||
profiles = mkOption {
|
||||
type = types.attrsOf (types.submodule ({ name, config, ... }: {
|
||||
options = {
|
||||
|
@ -33,31 +33,10 @@ in
|
|||
profiles = cfg.profiles;
|
||||
in {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = profiles."${cfg.defaultProfile}".name;
|
||||
userEmail = profiles."${cfg.defaultProfile}".email;
|
||||
ignores = [".direnv"];
|
||||
signing = {
|
||||
key = profiles."${cfg.defaultProfile}".signingKey;
|
||||
signByDefault = true;
|
||||
};
|
||||
extraConfig = {
|
||||
init = {
|
||||
defaultBranch = "main";
|
||||
};
|
||||
pull = {
|
||||
rebase = true;
|
||||
};
|
||||
rebase = {
|
||||
autoStash = true;
|
||||
autoSquash = true;
|
||||
abbreviateCommands = true;
|
||||
missingCommitsCheck = "warn";
|
||||
};
|
||||
};
|
||||
aliases = {
|
||||
mr = "!sh -c 'git fetch $1 merge-requests/$2/head:mr-$1-$2 && git checkout mr-$1-$2' -";
|
||||
pr = "!sh -c 'git fetch $1 refs/pull/$2/head:pr/$1 && git checkout pr/$2'";
|
||||
};
|
||||
includes = flatten (mapAttrsToList (name: profile: map (dir: {
|
||||
condition = "gitdir:${dir}";
|
||||
|
|
Loading…
Reference in a new issue