Add configurations for specifying users

This commit is contained in:
Manuel Thalmann 2024-07-20 00:45:20 +02:00
parent 5fa9f49b58
commit e15a64816b
5 changed files with 101 additions and 40 deletions

View file

@ -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;
};
};
}
};
}

View 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
View 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 = {};
};
};
};
}

View file

@ -10,6 +10,7 @@
./i18n.nix
./partition.nix
./software.nix
./users.nix
];
options = {

View file

@ -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";