mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-31 04:58:01 +00:00
lib: make extraSpecialArgs
in mkUser
There are now other user configs that make use of different attributes from the flake itself. It is better to make `extraSpecialArgs` configurable at this point.
This commit is contained in:
parent
3c2d1a1cdf
commit
0dbea86e46
10
flake.nix
10
flake.nix
@ -160,8 +160,16 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
# The default config for our home-manager configurations.
|
# The default config for our home-manager configurations.
|
||||||
userDefaultConfig = {
|
userDefaultConfig = let
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
|
in {
|
||||||
|
inherit system;
|
||||||
|
|
||||||
|
specialArgs = {
|
||||||
|
inherit system self;
|
||||||
|
lib = nixpkgs.lib.extend (final: prev:
|
||||||
|
import ./lib { lib = prev; });
|
||||||
|
};
|
||||||
|
|
||||||
extraModules = [{
|
extraModules = [{
|
||||||
# To be able to use the most of our config as possible, we want both to
|
# To be able to use the most of our config as possible, we want both to
|
||||||
|
@ -69,20 +69,17 @@ in rec {
|
|||||||
*/
|
*/
|
||||||
mkUser = file:
|
mkUser = file:
|
||||||
attrs@{ username ? (builtins.baseNameOf file), system ? sys
|
attrs@{ username ? (builtins.baseNameOf file), system ? sys
|
||||||
, extraModules ? [ ], ... }:
|
, extraModules ? [ ], extraSpecialArgs ? { inherit lib system; }, ... }:
|
||||||
let
|
let
|
||||||
hmConfigFunctionArgs = builtins.attrNames (builtins.functionArgs
|
hmConfigFunctionArgs = builtins.attrNames (builtins.functionArgs
|
||||||
inputs.home-manager.lib.homeManagerConfiguration);
|
inputs.home-manager.lib.homeManagerConfiguration);
|
||||||
hmModules = lib.map (path: import path)
|
hmModules = lib.map (path: import path)
|
||||||
(lib.modulesToList (lib.filesToAttrRec ../modules/home-manager));
|
(lib.modulesToList (lib.filesToAttrRec ../modules/home-manager));
|
||||||
in inputs.home-manager.lib.homeManagerConfiguration {
|
in inputs.home-manager.lib.homeManagerConfiguration {
|
||||||
inherit system username;
|
inherit system username extraSpecialArgs;
|
||||||
configuration = import file;
|
configuration = import file;
|
||||||
homeDirectory = "/home/${username}";
|
homeDirectory = "/home/${username}";
|
||||||
extraModules = hmModules ++ extraModules
|
extraModules = hmModules ++ extraModules
|
||||||
++ [ (lib.filterAttrs (n: _: !lib.elem n hmConfigFunctionArgs) attrs) ];
|
++ [ (lib.filterAttrs (n: _: !lib.elem n hmConfigFunctionArgs) attrs) ];
|
||||||
|
|
||||||
# Additional attributes to be referred to the modules.
|
|
||||||
extraSpecialArgs = { inherit lib system; };
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user