a flake module to ease creating and managing multiple hosts in your nix flake.

feat: allow for either inputs.darwin or inputs.nix-darwin

Changed files
+12 -4
+12 -4
lib.nix
··· 63 63 withSystem system ( 64 64 { self', inputs', ... }: 65 65 let 66 + darwinInput = 67 + if (inputs ? darwin) then 68 + inputs.darwin 69 + else if (inputs ? nix-darwin) then 70 + inputs.nix-darwin 71 + else 72 + throw "cannot find nix-darwin input"; 73 + 66 74 eval = evalModules { 67 75 # we use recursiveUpdate such that users can "override" the specialArgs 68 76 # ··· 71 79 specialArgs = recursiveUpdate { 72 80 # create the modulesPath based on the system, we need 73 81 modulesPath = 74 - if class == "darwin" then "${inputs.darwin}/modules" else "${inputs.nixpkgs}/nixos/modules"; 82 + if class == "darwin" then "${darwinInput}/modules" else "${inputs.nixpkgs}/nixos/modules"; 75 83 76 84 # laying it out this way is completely arbitrary, however it looks nice i guess 77 85 inherit lib; ··· 107 115 # or the darwin modules list provided by nix darwin 108 116 (import ( 109 117 if class == "darwin" then 110 - "${inputs.darwin}/modules/module-list.nix" 118 + "${darwinInput}/modules/module-list.nix" 111 119 else 112 120 "${inputs.nixpkgs}/nixos/modules/module-list.nix" 113 121 )) ··· 146 154 147 155 # we use these values to keep track of what upstream revision we are on, this also 148 156 # prevents us from recreating docs for the same configuration build if nothing has changed 149 - darwinVersionSuffix = ".${inputs.darwin.shortRev or inputs.darwin.dirtyShortRev or "dirty"}"; 150 - darwinRevision = inputs.darwin.rev or inputs.darwin.dirtyRev or "dirty"; 157 + darwinVersionSuffix = ".${darwinInput.shortRev or darwinInput.dirtyShortRev or "dirty"}"; 158 + darwinRevision = darwinInput.rev or darwinInput.dirtyRev or "dirty"; 151 159 }; 152 160 })) 153 161