diff options
| author | schererleander <leander@schererleander.de> | 2025-07-30 23:53:36 +0200 |
|---|---|---|
| committer | schererleander <leander@schererleander.de> | 2025-07-30 23:53:36 +0200 |
| commit | 9d18586e046fb395efe3fa55cff6a5079aeb7117 (patch) | |
| tree | 315f1ad13c1e0823a0416ea98412deca1cc8a7f1 | |
| parent | d9a3e99839075f98d6ae41fc30f9d5f34b45ac6f (diff) | |
feat: pass username to modules
| -rw-r--r-- | hosts/desktop/configuration.nix | 8 | ||||
| -rw-r--r-- | hosts/macbook/configuration.nix | 6 | ||||
| -rw-r--r-- | hosts/macbook/home.nix | 6 | ||||
| -rw-r--r-- | hosts/vps/configuration.nix | 4 | ||||
| -rw-r--r-- | lib/default.nix | 9 |
5 files changed, 15 insertions, 18 deletions
diff --git a/hosts/desktop/configuration.nix b/hosts/desktop/configuration.nix index 0165a04..de83b42 100644 --- a/hosts/desktop/configuration.nix +++ b/hosts/desktop/configuration.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ pkgs, username, ... }: { @@ -43,7 +43,7 @@ console.keyMap = "de"; # User - users.users.leander = { + users.users.${username} = { isNormalUser = true; extraGroups = [ "networkmanager" @@ -62,8 +62,8 @@ programs.dconf.enable = true; - users.users.leander.shell = pkgs.zsh; - users.users.leander.ignoreShellProgramCheck = true; + users.users.${username}.shell = pkgs.zsh; + users.users.${username}.ignoreShellProgramCheck = true; nix.settings.experimental-features = [ "nix-command" diff --git a/hosts/macbook/configuration.nix b/hosts/macbook/configuration.nix index 867ca40..b7ee965 100644 --- a/hosts/macbook/configuration.nix +++ b/hosts/macbook/configuration.nix @@ -1,9 +1,9 @@ -{ ... }: +{ username, ... }: { - users.users.schererleander.home = "/Users/schererleander"; + users.users.${username}.home = "/Users/${username}"; - system.primaryUser = "schererleander"; + system.primaryUser = username; system.defaults = { dock = { autohide = true; diff --git a/hosts/macbook/home.nix b/hosts/macbook/home.nix index 297811e..bde968e 100644 --- a/hosts/macbook/home.nix +++ b/hosts/macbook/home.nix @@ -1,12 +1,12 @@ -{ pkgs, ... }: +{ pkgs, username, ... }: { imports = [ ../../modules/home-manager ]; - home.username = "schererleander"; - home.homeDirectory = "/Users/schererleander"; + home.username = username; + home.homeDirectory = "/Users/${username}"; home.packages = with pkgs; [ htop diff --git a/hosts/vps/configuration.nix b/hosts/vps/configuration.nix index 7a928a9..3811615 100644 --- a/hosts/vps/configuration.nix +++ b/hosts/vps/configuration.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ pkgs, username, ... }: { imports = [ @@ -17,7 +17,7 @@ users.users.root.hashedPassword = "!"; users.mutableUsers = false; - users.users.administrator = { + users.users.${username} = { isNormalUser = true; hashedPassword = "$6$KBblJguEyfEmuWnU$Xf0QqPVacA2qvnzZRpnSE2cmh0kNnMgtVhCrMEDI76buNzuzkuDY6EnO7jPjQlEnoczx6ZPAl2pK.SxezbVa.."; extraGroups = [ "wheel" ]; diff --git a/lib/default.nix b/lib/default.nix index c36bf15..6f1f9f0 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -13,7 +13,7 @@ in overlays ? [ ], sharedModules ? [ ], extraModules ? [ ], - extraArguments ? { }, + extraSpecialArgs ? { }, }: let darwinHost = isDarwin system; @@ -51,7 +51,7 @@ in home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.backupFileExtension = "backup"; - home-manager.extraSpecialArgs = { inherit inputs pkgs; }; + home-manager.extraSpecialArgs = { inherit inputs pkgs system username; } // extraSpecialArgs; home-manager.users.${username} = import hostHome; home-manager.sharedModules = sharedModules; } @@ -60,10 +60,7 @@ in in builder { system = system; - specialArgs = { - inherit inputs pkgs; - } - // extraArguments; + specialArgs = ({ inherit inputs pkgs system username; } // extraSpecialArgs); modules = modules; }; } |
