diff --git a/flake.nix b/flake.nix index d39535fb..55565461 100644 --- a/flake.nix +++ b/flake.nix @@ -160,8 +160,16 @@ }; # The default config for our home-manager configurations. - userDefaultConfig = { + userDefaultConfig = let system = "x86_64-linux"; + in { + inherit system; + + specialArgs = { + inherit system self; + lib = nixpkgs.lib.extend (final: prev: + import ./lib { lib = prev; }); + }; extraModules = [{ # To be able to use the most of our config as possible, we want both to diff --git a/lib/flake-utils.nix b/lib/flake-utils.nix index f1c32870..a6c61daa 100644 --- a/lib/flake-utils.nix +++ b/lib/flake-utils.nix @@ -69,20 +69,17 @@ in rec { */ mkUser = file: attrs@{ username ? (builtins.baseNameOf file), system ? sys - , extraModules ? [ ], ... }: + , extraModules ? [ ], extraSpecialArgs ? { inherit lib system; }, ... }: let hmConfigFunctionArgs = builtins.attrNames (builtins.functionArgs inputs.home-manager.lib.homeManagerConfiguration); hmModules = lib.map (path: import path) (lib.modulesToList (lib.filesToAttrRec ../modules/home-manager)); in inputs.home-manager.lib.homeManagerConfiguration { - inherit system username; + inherit system username extraSpecialArgs; configuration = import file; homeDirectory = "/home/${username}"; extraModules = hmModules ++ extraModules ++ [ (lib.filterAttrs (n: _: !lib.elem n hmConfigFunctionArgs) attrs) ]; - - # Additional attributes to be referred to the modules. - extraSpecialArgs = { inherit lib system; }; }; }