lib/flake-utils: refactor mkHost

Now that `system` top-level attribute in `configuration.nix` is
documented and comes with additional options now, we'll have to move the
system configuration into a new namespace. This is just the easy way
out.
This commit is contained in:
Gabriel Arazas 2022-04-17 00:15:02 +08:00
parent 7ae53c1563
commit 99050bc806
2 changed files with 56 additions and 56 deletions

View File

@ -100,8 +100,7 @@
lib = nixpkgs.lib.extend (final: prev: import ./lib { lib = prev; }); lib = nixpkgs.lib.extend (final: prev: import ./lib { lib = prev; });
}; };
# The default configuration for a NixOS system STARTS HERE. config = {
# I want to capture the usual flakes to its exact version so we're # I want to capture the usual flakes to its exact version so we're
# making them available to our system. This will also prevent the # making them available to our system. This will also prevent the
# annoying downloads since it always get the latest revision. # annoying downloads since it always get the latest revision.
@ -158,6 +157,7 @@
experimental-features = nix-command flakes experimental-features = nix-command flakes
''; '';
}; };
};
# The default config for our home-manager configurations. # The default config for our home-manager configurations.
userDefaultConfig = let system = "x86_64-linux"; userDefaultConfig = let system = "x86_64-linux";

View File

@ -26,7 +26,7 @@ in rec {
=> { ... } # NixOS configuration attrset => { ... } # NixOS configuration attrset
*/ */
mkHost = file: mkHost = file:
attrs@{ system ? sys, specialArgs ? { inherit lib system inputs; }, ... }: { system ? sys, specialArgs ? { inherit lib system inputs; }, config ? { } }:
(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 specialArgs; inherit system specialArgs;
@ -40,7 +40,7 @@ in rec {
} }
# Put the given attribute set (except for the system). # Put the given attribute set (except for the system).
(lib.filterAttrs (n: v: !lib.elem n [ "system" "specialArgs" ]) attrs) config
# The entry point of the module. # The entry point of the module.
file file