mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-30 22:57:55 +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.
|
||||
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
|
||||
|
@ -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; };
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user