config: replace specialArgs with _modules.args in NixOS config

This commit is contained in:
Gabriel Arazas 2023-12-13 10:00:43 +08:00
parent 231200546d
commit b04a284489
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
2 changed files with 11 additions and 10 deletions

View File

@ -175,6 +175,9 @@
inputs.nixos-wsl.nixosModules.default
];
# Set some extra, yeah?
_module.args = extraArgs;
# Find Nix files with these! Even if nix-index is already enabled, it
# is better to make it explicit.
programs.command-not-found.enable = false;
@ -215,7 +218,6 @@
home-manager.useUserPackages = lib.mkDefault true;
home-manager.useGlobalPkgs = lib.mkDefault true;
home-manager.sharedModules = [ userSharedConfig ];
home-manager.extraSpecialArgs = extraArgs;
# Enabling some things for sops.
programs.gnupg.agent = lib.mkDefault {
@ -246,6 +248,9 @@
inputs.nix-index-database.hmModules.nix-index
];
# Set some extra, yeah?
_module.args = extraArgs;
# Hardcoding this is not really great especially if you consider using
# other locales but its default values are already hardcoded so what
# the hell. For other users, they would have to do set these manually.
@ -371,7 +376,6 @@
lib'.mapAttrs
(host: metadata:
mkHost {
inherit extraArgs;
extraModules = [(hostSpecificModule host metadata)];
system = metadata._system;
nixpkgs-channel = metadata.nixpkgs-channel or "nixpkgs";
@ -411,7 +415,7 @@
];
in
mkHome {
inherit pkgs extraModules extraArgs;
inherit pkgs extraModules;
home-manager-channel = metadata.home-manager-channel or "home-manager";
})
users;
@ -449,7 +453,7 @@
format = metadata.format or "iso";
in
lib'.nameValuePair name (mkImage {
inherit format system pkgs extraArgs;
inherit format system pkgs;
extraModules = [(hostSpecificModule host metadata)];
}))
images');

View File

@ -4,27 +4,24 @@
{
# A wrapper around the NixOS configuration function.
mkHost = { system, extraModules ? [ ], extraArgs ? { }, nixpkgs-channel ? "nixpkgs" }:
mkHost = { system, extraModules ? [ ], nixpkgs-channel ? "nixpkgs" }:
(lib.makeOverridable inputs."${nixpkgs-channel}".lib.nixosSystem) {
# The system of the NixOS system.
inherit lib;
specialArgs = extraArgs;
modules = extraModules ++ [{ nixpkgs.hostPlatform = system; }];
};
# A wrapper around the home-manager configuration function.
mkHome = { pkgs, extraModules ? [ ], extraArgs ? { }, home-manager-channel ? "home-manager" }:
mkHome = { pkgs, extraModules ? [ ], home-manager-channel ? "home-manager" }:
inputs."${home-manager-channel}".lib.homeManagerConfiguration {
inherit lib pkgs;
extraSpecialArgs = extraArgs;
modules = extraModules;
};
# A wrapper around the nixos-generators `nixosGenerate` function.
mkImage = { system, pkgs ? null, extraModules ? [ ], extraArgs ? { }, format ? "iso" }:
mkImage = { system, pkgs ? null, extraModules ? [ ], format ? "iso" }:
inputs.nixos-generators.nixosGenerate {
inherit pkgs system format lib;
specialArgs = extraArgs;
modules = extraModules;
};