From 6fff95981bfef5527518fbebac879c71877810ff Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Thu, 12 Jun 2025 12:46:14 -0700 Subject: pass `self` to the home-manager modules This is to avoid using relative paths, which is always annoying to get right. --- nix/lib/mkSystem.nix | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'nix/lib') diff --git a/nix/lib/mkSystem.nix b/nix/lib/mkSystem.nix index 7c438b6..3241dd9 100644 --- a/nix/lib/mkSystem.nix +++ b/nix/lib/mkSystem.nix @@ -1,12 +1,13 @@ # This function creates a NixOS system based on our VM setup for a # particular architecture. { + self, nixpkgs, inputs, overlays, }: -name: +systemName: { system, user, @@ -15,11 +16,11 @@ name: let # The config files for this system. - machineConfig = ../machines/${name}; + machineConfig = ../machines/${systemName}; userOSConfig = ../users/${user}/${if darwin then "darwin" else "nixos"}.nix; userHMConfig = ../users/${user}/home-manager.nix; - # NixOS vs nix-darwin functionst + # NixOS vs nix-darwin functions systemFunc = if darwin then inputs.darwin.lib.darwinSystem else nixpkgs.lib.nixosSystem; home-manager = if darwin then inputs.home-manager.darwinModules else inputs.home-manager.nixosModules; @@ -44,9 +45,15 @@ systemFunc rec { inputs.agenix.homeManagerModules.default ]; home-manager.users.${user} = import userHMConfig { - inputs = inputs; - darwin = darwin; - systemName = name; + inherit + self + inputs + darwin + systemName + ; + }; + home-manager.extraSpecialArgs = { + inherit self inputs; }; } @@ -55,7 +62,7 @@ systemFunc rec { { config._module.args = { currentSystem = system; - currentSystemName = name; + currentSystemName = systemName; currentSystemUser = user; inputs = inputs; }; -- cgit v1.2.3