Remove unnecessary options from Win users

This commit is contained in:
Manuel Thalmann 2024-08-08 15:32:05 +02:00
parent dd1bc94d75
commit 4d31b476cb
2 changed files with 29 additions and 18 deletions

View file

@ -8,6 +8,22 @@
cfg = config.valhalla; cfg = config.valhalla;
capitalize = (import ../text.nix { inherit lib; }).capitalize; capitalize = (import ../text.nix { inherit lib; }).capitalize;
linuxOptions = {
defaultShell = mkOption {
type = types.nullOr types.str;
description = "The default shell of the user.";
default = null;
};
rclone = {
configurations = mkOption {
type = types.attrsOf syncType;
description = "The configurations of the rclone mounts.";
default = {};
};
};
};
syncType = types.submodule ( syncType = types.submodule (
{ ... }: { { ... }: {
options = { options = {
@ -46,25 +62,13 @@
default = []; default = [];
}; };
defaultShell = mkOption {
type = types.nullOr types.str;
description = "The default shell of the user.";
default = null;
};
rclone = {
configurations = mkOption {
type = types.attrsOf syncType;
description = "The configurations of the rclone mounts.";
default = {};
};
};
git = (import ./git/options.nix) { inherit lib; }; git = (import ./git/options.nix) { inherit lib; };
} // options; } // options;
})); }));
userType = mkUserType { options = {}; }; userType = mkUserType {
options = linuxOptions;
};
winUserType = mkUserType { winUserType = mkUserType {
options = { options = {
@ -88,9 +92,12 @@
type = types.attrsOf winUserType; type = types.attrsOf winUserType;
description = "The users to create on the Windows machine."; description = "The users to create on the Windows machine.";
default = lib.attrsets.concatMapAttrs ( default = lib.attrsets.concatMapAttrs (
name: options: { name: options:
${capitalize name} = options; if builtins.elem name (builtins.attrNames linuxOptions)
}) cfg.users; then {}
else {
${capitalize name} = options;
}) cfg.users;
}; };
}; };
}; };

View file

@ -10,6 +10,10 @@
enable = true; enable = true;
linuxPercentage = 70; # better safe than sorry linuxPercentage = 70; # better safe than sorry
}; };
users.Manuel = {
microsoftAccount = true;
};
}; };
partition.os.partitions = { partition.os.partitions = {