flake.nix: refactor extraArgs placement

This commit is contained in:
Gabriel Arazas 2022-08-17 18:43:48 +08:00
parent 96ab200946
commit acc36dc851

View File

@ -108,12 +108,14 @@
import ./lib { lib = prev; } import ./lib { lib = prev; }
// import ./lib/private.nix { lib = final; }); // import ./lib/private.nix { lib = final; });
withExtraArgs = system: { inherit inputs self system; };
mkHost = { system ? defaultSystem, extraModules ? [ ] }: mkHost = { system ? defaultSystem, extraModules ? [ ] }:
(lib'.makeOverridable inputs.nixpkgs.lib.nixosSystem) { (lib'.makeOverridable inputs.nixpkgs.lib.nixosSystem) {
# The system of the NixOS system. # The system of the NixOS system.
inherit system; inherit system;
lib = lib'; lib = lib';
specialArgs = { inherit system inputs self; }; specialArgs = withExtraArgs system;
modules = modules =
# Append with our custom NixOS modules from the modules folder. # Append with our custom NixOS modules from the modules folder.
(lib'.modulesToList (lib'.filesToAttr ./modules/nixos)) (lib'.modulesToList (lib'.filesToAttr ./modules/nixos))
@ -210,7 +212,7 @@
home-manager.sharedModules = home-manager.sharedModules =
lib'.modulesToList (lib'.filesToAttr ./modules/home-manager) lib'.modulesToList (lib'.filesToAttr ./modules/home-manager)
++ [ userDefaultConfig ]; ++ [ userDefaultConfig ];
home-manager.extraSpecialArgs = { inherit inputs system self; }; home-manager.extraSpecialArgs = withExtraArgs system;
# Enabling some things for sops. # Enabling some things for sops.
programs.gnupg.agent = { programs.gnupg.agent = {
@ -223,7 +225,7 @@
mkUser = { system ? defaultSystem, extraModules ? [ ] }: mkUser = { system ? defaultSystem, extraModules ? [ ] }:
inputs.home-manager.lib.homeManagerConfiguration { inputs.home-manager.lib.homeManagerConfiguration {
extraSpecialArgs = { inherit system self inputs; }; extraSpecialArgs = withExtraArgs system;
lib = lib'; lib = lib';
pkgs = nixpkgs.legacyPackages.${builtins.currentSystem}; pkgs = nixpkgs.legacyPackages.${builtins.currentSystem};
modules = modules =