diff --git a/emmathorpe/home/git.nix b/emmathorpe/home/git.nix index ded5a12..8aca636 100644 --- a/emmathorpe/home/git.nix +++ b/emmathorpe/home/git.nix @@ -1,6 +1,6 @@ # Version control: git + delta pager + commitizen. The work host layers # commit signing and an email override on top (see work/default.nix). -{ pkgs, ... }: +{ pkgs, fullName, ... }: { home.packages = [ pkgs.commitizen @@ -10,7 +10,7 @@ enable = true; package = pkgs.gitFull; settings = { - user.name = "Emma Thorpe"; + user.name = fullName; push = { autoSetupRemote = true; }; diff --git a/emmathorpe/user.nix b/emmathorpe/user.nix index 7cf249e..b8a677e 100644 --- a/emmathorpe/user.nix +++ b/emmathorpe/user.nix @@ -3,15 +3,17 @@ pkgs, inputs, lib, + username, + fullName, ... }: { programs.zsh.enable = true; - users.users.emmathorpe = { + users.users.${username} = { isNormalUser = true; - home = "/home/emmathorpe"; - description = "Emma Thorpe"; + home = "/home/${username}"; + description = fullName; extraGroups = [ "wheel" "docker" diff --git a/flake.nix b/flake.nix index 4196d87..d38585f 100644 --- a/flake.nix +++ b/flake.nix @@ -69,67 +69,81 @@ { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = { inherit inputs; }; } ]; - # mkHost :: { system, modules } -> nixosSystem + # mkHost :: { system, username, fullName, modules, homeModules } -> nixosSystem # Builds one machine by appending its host-specific modules to the shared - # baseModules. `inputs` is threaded into specialArgs so any module can - # reach the flake inputs (e.g. the work module uses inputs for claude-code). + # baseModules. The user identity (username/fullName) is threaded through + # specialArgs so user.nix and the home modules stay host-agnostic, and the + # home-manager profile is keyed by the host's username. mkHost = - { system, modules }: + { + system, + username, + fullName, + modules, + homeModules, + }: nixpkgs.lib.nixosSystem { inherit system; - specialArgs = { inherit inputs; }; - modules = baseModules ++ modules; + specialArgs = { inherit inputs username fullName; }; + modules = + baseModules + ++ modules + ++ [ + { + home-manager.extraSpecialArgs = { inherit inputs username fullName; }; + home-manager.users.${username}.imports = homeModules; + } + ]; }; # Host table — declarative registry of every machine. To add a host: - # give it a name, its `system`, and the list of machine-specific modules. + # give it a name, its `system`, the owning user, and the module lists. # mapAttrs below turns each entry into a nixosConfiguration of the same name. hosts = { emmathorpe-mbp = { system = "aarch64-linux"; + username = "lyrathorpe"; + fullName = "Lyra Thorpe"; modules = [ ./system/machine/MBP-Asahi/configuration.nix nixos-apple-silicon.nixosModules.default ./emmathorpe/swaywm.nix - { - home-manager.users.emmathorpe.imports = [ - ./emmathorpe/home - ./emmathorpe/home/desktop.nix - ]; - } + ]; + homeModules = [ + ./emmathorpe/home + ./emmathorpe/home/desktop.nix ]; }; emmathorpe-x1c = { system = "x86_64-linux"; + username = "lyrathorpe"; + fullName = "Lyra Thorpe"; modules = [ ./system/machine/X1/configuration.nix ./emmathorpe/swaywm.nix - { - home-manager.users.emmathorpe.imports = [ - ./emmathorpe/home - ./emmathorpe/home/desktop.nix - ]; - } + ]; + homeModules = [ + ./emmathorpe/home + ./emmathorpe/home/desktop.nix ]; }; emmathorpe-edaas = { system = "x86_64-linux"; + username = "emmathorpe"; + fullName = "Emma Thorpe"; modules = [ ./system/machine/EDaaS/configuration.nix nixos-wsl.nixosModules.default ./emmathorpe/swaywm.nix - { - home-manager.users.emmathorpe.imports = [ - ./emmathorpe/home - ./system/modules/work/default.nix - ]; - } + ]; + homeModules = [ + ./emmathorpe/home + ./system/modules/work/default.nix ]; }; };