Add configurations for specifying users
This commit is contained in:
parent
5fa9f49b58
commit
e15a64816b
5 changed files with 101 additions and 40 deletions
|
@ -1,41 +1,7 @@
|
|||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib)
|
||||
mkOption
|
||||
types
|
||||
;
|
||||
|
||||
gitOptions = {
|
||||
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 = {};
|
||||
};
|
||||
{ lib, ... }: {
|
||||
options = {
|
||||
valhalla = {
|
||||
git = (import ./git/options.nix) { inherit lib; };
|
||||
};
|
||||
in {
|
||||
options = {
|
||||
valhalla = {
|
||||
git = gitOptions;
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
33
lib/modules/git/options.nix
Normal file
33
lib/modules/git/options.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{ 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 = {};
|
||||
};
|
||||
}
|
48
lib/modules/users.nix
Normal file
48
lib/modules/users.nix
Normal file
|
@ -0,0 +1,48 @@
|
|||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib)
|
||||
mkOption
|
||||
types
|
||||
;
|
||||
|
||||
userType = types.submodule (
|
||||
{ ... }: {
|
||||
options = {
|
||||
displayName = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = "The human-readable name of the user.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
mailAddress = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = "The mail address of the user.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
groups = mkOption {
|
||||
type = types.listOf types.str;
|
||||
description = "The additional groups of the user.";
|
||||
default = [];
|
||||
};
|
||||
|
||||
defaultShell = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = "The default shell of the user.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
git = (import ./git/options.nix) { inherit lib; };
|
||||
};
|
||||
});
|
||||
in {
|
||||
options = {
|
||||
valhalla = {
|
||||
users = mkOption {
|
||||
type = types.attrsOf userType;
|
||||
description = "The users to create on the machine.";
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -10,6 +10,7 @@
|
|||
./i18n.nix
|
||||
./partition.nix
|
||||
./software.nix
|
||||
./users.nix
|
||||
];
|
||||
|
||||
options = {
|
||||
|
|
|
@ -35,6 +35,19 @@
|
|||
};
|
||||
};
|
||||
|
||||
users = {
|
||||
manuel = {
|
||||
displayName = "Manuel Thalmann";
|
||||
mailAddress = "m@nuth.ch";
|
||||
groups = [
|
||||
"wheel"
|
||||
"nix-users"
|
||||
];
|
||||
|
||||
defaultShell = "fish";
|
||||
};
|
||||
};
|
||||
|
||||
timeZone = "Europe/Zurich";
|
||||
keyMap = "de_CH-latin1";
|
||||
keyboardLayout = "ch";
|
||||
|
|
Loading…
Reference in a new issue