From 4d31b476cb6fe2ea19cfda2c2cff9333b9831f67 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Thu, 8 Aug 2024 15:32:05 +0200 Subject: [PATCH] Remove unnecessary options from Win users --- lib/modules/users.nix | 43 +++++++++++++++++++++--------------- profiles/DerGeret/config.nix | 4 ++++ 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/lib/modules/users.nix b/lib/modules/users.nix index 337dff7c..b3f9f2f2 100644 --- a/lib/modules/users.nix +++ b/lib/modules/users.nix @@ -8,6 +8,22 @@ cfg = config.valhalla; 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 ( { ... }: { options = { @@ -46,25 +62,13 @@ 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; }; } // options; })); - userType = mkUserType { options = {}; }; + userType = mkUserType { + options = linuxOptions; + }; winUserType = mkUserType { options = { @@ -88,9 +92,12 @@ type = types.attrsOf winUserType; description = "The users to create on the Windows machine."; default = lib.attrsets.concatMapAttrs ( - name: options: { - ${capitalize name} = options; - }) cfg.users; + name: options: + if builtins.elem name (builtins.attrNames linuxOptions) + then {} + else { + ${capitalize name} = options; + }) cfg.users; }; }; }; diff --git a/profiles/DerGeret/config.nix b/profiles/DerGeret/config.nix index 913083a1..176592f8 100644 --- a/profiles/DerGeret/config.nix +++ b/profiles/DerGeret/config.nix @@ -10,6 +10,10 @@ enable = true; linuxPercentage = 70; # better safe than sorry }; + + users.Manuel = { + microsoftAccount = true; + }; }; partition.os.partitions = {