Move git options to separate module

This commit is contained in:
Manuel Thalmann 2024-08-23 18:40:24 +02:00
parent 2af3a6de6f
commit de8021cbb8
3 changed files with 58 additions and 41 deletions

View file

@ -1,7 +1,59 @@
{ lib, ... }: { { lib, ... }:
let
inherit (lib)
mkOption
types
;
gitType = types.submodule (
{ ... }: {
options = {
defaultBranch = mkOption {
type = types.nullOr types.str;
description = "The name of the default branch in newly created repositories.";
default = null;
};
flow = {
mainBranch = mkOption {
type = types.nullOr types.str;
description = "The name of the stable branch in git flow.";
default = null;
};
devBranch = mkOption {
type = types.nullOr types.str;
description = "The name of the development branch in git flow.";
default = null;
};
};
aliases = mkOption {
type = types.attrsOf types.str;
description = "The git command aliases to install.";
default = {};
};
};
});
gitOption = mkOption {
type = gitType;
description = "The git related options.";
default = {};
};
in {
options = { options = {
valhalla = { valhalla = {
git = (import ./git/options.nix) { inherit lib; }; git = gitOption;
users = mkOption {
type = types.attrsOf (types.submodule (
{ ... }: {
options = {
git = gitOption;
};
}));
};
}; };
}; };
} }

View file

@ -1,33 +0,0 @@
{ lib, ... }:
let
inherit (lib)
mkOption
types
;
in {
defaultBranch = mkOption {
type = types.nullOr types.str;
description = "The name of the default branch in git.";
default = null;
};
flow = {
mainBranch = mkOption {
type = types.nullOr types.str;
description = "The name of the stable branch in git flow.";
default = null;
};
devBranch = mkOption {
type = types.nullOr types.str;
description = "The name of the development branch in git flow.";
default = null;
};
};
aliases = mkOption {
type = types.attrsOf types.str;
description = "Git command aliases to install.";
default = {};
};
}

View file

@ -47,8 +47,6 @@
description = "The additional groups of the user."; description = "The additional groups of the user.";
default = []; default = [];
}; };
git = (import ./git/options.nix) { inherit lib; };
}; };
})); }));
description = "The users to create on the machine."; description = "The users to create on the machine.";