Skip to content

Instantly share code, notes, and snippets.

@evanrichter
Created March 27, 2024 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evanrichter/aa2e27fc9225b55ac080baf61bda8633 to your computer and use it in GitHub Desktop.
Save evanrichter/aa2e27fc9225b55ac080baf61bda8633 to your computer and use it in GitHub Desktop.
flakes be real sometimes tho
diff --git a/flake.nix b/flake.nix
index 710d2bb..11b4e5f 100644
--- a/flake.nix
+++ b/flake.nix
@@ -15,6 +15,17 @@
config.allowUnfree = true;
overlays = builtins.attrValues self.outputs.overlays;
});
+
+ depInject = { pkgs, lib, ... }: {
+ options.dep-inject = lib.mkOption {
+ type = with lib.types; attrsOf unspecified;
+ default = { };
+ };
+ config.dep-inject = {
+ # inputs comes from the outer environment of flake.nix
+ nixos-hardware = inputs.nixos-hardware;
+ };
+ };
in
{
darwinModules = import ./modules/darwin;
@@ -44,8 +55,8 @@
nixosConfigurations = {
coffee = lib.nixosSystem {
- modules = [ ./hosts/coffee ];
- specialArgs = { inherit inputs outputs; };
+ modules = [ ./hosts/coffee depInject ];
+ specialArgs = { inherit outputs; };
};
wax = lib.nixosSystem {
modules = [ ./hosts/wax ];
diff --git a/hosts/coffee/default.nix b/hosts/coffee/default.nix
index 56652cf..58227d7 100644
--- a/hosts/coffee/default.nix
+++ b/hosts/coffee/default.nix
@@ -1,5 +1,4 @@
-{ inputs
-, outputs
+{ outputs
, config
, lib
, pkgs
@@ -7,7 +6,7 @@
}:
{
imports = [
- inputs.nixos-hardware.nixosModules.common-gpu-intel
+ config.dep-inject.nixos-hardware.nixosModules.common-gpu-intel
../common/core
./hardware.nix
warning: Git tree '/home/evan/nix-config' is dirty
error:
… while calling the 'seq' builtin
at /nix/store/y0c95bwyvs80pm69hdd4b11pyq2ghiwh-source/lib/modules.nix:320:18:
319| options = checked options;
320| config = checked (removeAttrs config [ "_module" ]);
| ^
321| _module = checked (config._module);
… while evaluating a branch condition
at /nix/store/y0c95bwyvs80pm69hdd4b11pyq2ghiwh-source/lib/modules.nix:261:9:
260| checkUnmatched =
261| if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [] then
| ^
262| let
(stack trace truncated; use '--show-trace' to show the full trace)
error: infinite recursion encountered
at /nix/store/y0c95bwyvs80pm69hdd4b11pyq2ghiwh-source/lib/modules.nix:233:21:
232| (regularModules ++ [ internalModule ])
233| ({ inherit lib options config specialArgs; } // specialArgs);
| ^
234| in mergeModules prefix (reverseList collected);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment