diff --git a/flake.nix b/flake.nix index cb6a4023..889d1764 100644 --- a/flake.nix +++ b/flake.nix @@ -66,7 +66,7 @@ (system: f system); libExtended = nixpkgs.lib.extend (final: prev: - (import ./lib { lib = final; }) // { + (import ./lib { lib = prev; }) // { flakeUtils = (import ./lib/flake-utils.nix { inherit inputs; lib = final; @@ -74,9 +74,17 @@ }); # The default configuration for our NixOS systems. - hostDefaultConfig = { - # Default architecture. + hostDefaultConfig = let 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 # making them available to our system. This will also prevent the diff --git a/lib/flake-utils.nix b/lib/flake-utils.nix index 0d114e19..f1c32870 100644 --- a/lib/flake-utils.nix +++ b/lib/flake-utils.nix @@ -26,13 +26,10 @@ in rec { => { ... } # NixOS configuration attrset */ mkHost = file: - attrs@{ system ? sys, ... }: - inputs.nixpkgs.lib.nixosSystem { + attrs@{ system ? sys, specialArgs ? { inherit lib system inputs; }, ... }: + (lib.makeOverridable inputs.nixpkgs.lib.nixosSystem) { # The system of the NixOS system. - inherit system; - - # Additional attributes to be referred to our modules. - specialArgs = { inherit lib system inputs; }; + inherit system specialArgs; # We also set the following in order for priority. # Later modules will override previously imported modules. @@ -43,7 +40,7 @@ in rec { } # 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. file