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.gpg.enable = true;
|
||||||
|
|
||||||
programs.git.custom = {
|
programs.git = {
|
||||||
defaultProfile = "work";
|
defaultProfile = "work";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
programs.gpg.enable = true;
|
programs.gpg.enable = true;
|
||||||
|
|
||||||
programs.git.custom = {
|
programs.git = {
|
||||||
defaultProfile = "private";
|
defaultProfile = "private";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
26
home/git.nix
26
home/git.nix
|
@ -7,7 +7,8 @@ in
|
||||||
./modules/git.nix
|
./modules/git.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
programs.git.custom = {
|
programs.git = {
|
||||||
|
enable = true;
|
||||||
profiles = {
|
profiles = {
|
||||||
private = {
|
private = {
|
||||||
name = "Felix Tenley";
|
name = "Felix Tenley";
|
||||||
|
@ -23,5 +24,28 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
defaultProfile = "private";
|
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;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.programs.git.custom;
|
cfg = config.programs.git;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.programs.git.custom = {
|
options.programs.git = {
|
||||||
profiles = mkOption {
|
profiles = mkOption {
|
||||||
type = types.attrsOf (types.submodule ({ name, config, ... }: {
|
type = types.attrsOf (types.submodule ({ name, config, ... }: {
|
||||||
options = {
|
options = {
|
||||||
|
@ -33,31 +33,10 @@ in
|
||||||
profiles = cfg.profiles;
|
profiles = cfg.profiles;
|
||||||
in {
|
in {
|
||||||
programs.git = {
|
programs.git = {
|
||||||
enable = true;
|
|
||||||
userName = profiles."${cfg.defaultProfile}".name;
|
userName = profiles."${cfg.defaultProfile}".name;
|
||||||
userEmail = profiles."${cfg.defaultProfile}".email;
|
userEmail = profiles."${cfg.defaultProfile}".email;
|
||||||
ignores = [".direnv"];
|
|
||||||
signing = {
|
signing = {
|
||||||
key = profiles."${cfg.defaultProfile}".signingKey;
|
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: {
|
includes = flatten (mapAttrsToList (name: profile: map (dir: {
|
||||||
condition = "gitdir:${dir}";
|
condition = "gitdir:${dir}";
|
||||||
|
|
Loading…
Reference in a new issue