mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-31 04:58:01 +00:00
lib/flake-utils: update mkHost
The NixOS system is now made overridable as a workaround for nixos-generators. See https://github.com/nix-community/nixos-generators/issues/110 for more details.
This commit is contained in:
parent
d5c914f127
commit
73c98916a5
14
flake.nix
14
flake.nix
@ -66,7 +66,7 @@
|
|||||||
(system: f system);
|
(system: f system);
|
||||||
|
|
||||||
libExtended = nixpkgs.lib.extend (final: prev:
|
libExtended = nixpkgs.lib.extend (final: prev:
|
||||||
(import ./lib { lib = final; }) // {
|
(import ./lib { lib = prev; }) // {
|
||||||
flakeUtils = (import ./lib/flake-utils.nix {
|
flakeUtils = (import ./lib/flake-utils.nix {
|
||||||
inherit inputs;
|
inherit inputs;
|
||||||
lib = final;
|
lib = final;
|
||||||
@ -74,9 +74,17 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
# The default configuration for our NixOS systems.
|
# The default configuration for our NixOS systems.
|
||||||
hostDefaultConfig = {
|
hostDefaultConfig = let
|
||||||
# Default architecture.
|
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
|
in {
|
||||||
|
inherit system;
|
||||||
|
specialArgs = {
|
||||||
|
inherit system inputs self;
|
||||||
|
lib = nixpkgs.lib.extend (final: prev:
|
||||||
|
import ./lib { lib = prev; });
|
||||||
|
};
|
||||||
|
|
||||||
|
# The default configuration for a NixOS system STARTS HERE.
|
||||||
|
|
||||||
# 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
|
||||||
|
@ -26,13 +26,10 @@ in rec {
|
|||||||
=> { ... } # NixOS configuration attrset
|
=> { ... } # NixOS configuration attrset
|
||||||
*/
|
*/
|
||||||
mkHost = file:
|
mkHost = file:
|
||||||
attrs@{ system ? sys, ... }:
|
attrs@{ system ? sys, specialArgs ? { inherit lib system inputs; }, ... }:
|
||||||
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 specialArgs;
|
||||||
|
|
||||||
# Additional attributes to be referred to our modules.
|
|
||||||
specialArgs = { inherit lib system inputs; };
|
|
||||||
|
|
||||||
# We also set the following in order for priority.
|
# We also set the following in order for priority.
|
||||||
# Later modules will override previously imported modules.
|
# Later modules will override previously imported modules.
|
||||||
@ -43,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" ]) attrs)
|
(lib.filterAttrs (n: v: !lib.elem n [ "system" "specialArgs" ]) attrs)
|
||||||
|
|
||||||
# The entry point of the module.
|
# The entry point of the module.
|
||||||
file
|
file
|
||||||
|
Loading…
Reference in New Issue
Block a user