···2222 mapAttrs
2323 filterAttrs
2424 mkDefault
2525- evalModules
2625 mergeAttrs
2726 assertMsg
2827 ;
···9190 ...
9291 }:
9392 let
9494- # create the modulesPath based on the system, we need
9595- modulesPath = if class == "darwin" then "${nix-darwin}/modules" else "${nixpkgs}/nixos/modules";
9696-9797- # we need to import the module list for our system
9898- # this is either the nixos modules list provided by nixpkgs
9999- # or the darwin modules list provided by nix darwin
100100- baseModules = import "${modulesPath}/module-list.nix";
9393+ evalHost = if class == "darwin" then nix-darwin.lib.darwinSystem else nixpkgs.lib.nixosSystem;
10194102102- eval = evalModules {
9595+ eval = evalHost {
10396 # we use recursiveUpdate such that users can "override" the specialArgs
10497 #
10598 # This should only be used for special arguments that need to be evaluated
···113106 # even though self is just the same as `inputs.self`
114107 # we still pass this as some people will use this
115108 self
116116-117117- # we need to set this because some modules require it sadly
118118- # you may also recall `modulesPath + /installer/scan/not-detected.nix`
119119- modulesPath
120109 ;
121110 } specialArgs;
122111123123- # A nominal type for modules. When set and non-null, this adds a check to
124124- # make sure that only compatible modules are imported.
125125- class = classToND class;
126126-127112 modules = concatLists [
128128- # bring in all of our base modules
129129- baseModules
130130-131113 # import our host system paths
132114 (
133115 if path != null then
···159141 );
160142 })
161143162162- # some modules to have these arguments, like documentation.nix
163163- # <https://github.com/NixOS/nixpkgs/blob/9692553cb583e8dca46b66ab76c0eb2ada1a4098/nixos/modules/misc/documentation.nix>
164164- (singleton {
165165- _module.args = {
166166- inherit baseModules;
167167-168168- # this should in the future be the modules that the user added without baseModules
169169- modules = [ ];
170170-171171- # TODO: remove in 25.05
172172- # https://github.com/NixOS/nixpkgs/blob/9692553cb583e8dca46b66ab76c0eb2ada1a4098/nixos/lib/eval-config.nix#L38
173173- extraModules = [ ];
174174- };
175175- })
176176-177144 # here we make some basic assumptions about the system the person is using
178145 # like the system type and the hostname
179146 (singleton {
···200167 # without supplying an upstream nixpkgs source, nix-darwin will not be able to build
201168 # and will complain and log an error demanding that you must set this value
202169 nixpkgs.source = mkDefault nixpkgs;
203203-204204- system = {
205205- # i don't quite know why this is set but upstream does it so i will too
206206- checks.verifyNixPath = false;
207207-208208- # we use these values to keep track of what upstream revision we are on, this also
209209- # prevents us from recreating docs for the same configuration build if nothing has changed
210210- darwinVersionSuffix = ".${nix-darwin.shortRev or nix-darwin.dirtyShortRev or "dirty"}";
211211- darwinRevision = nix-darwin.rev or nix-darwin.dirtyRev or "dirty";
212212- };
213170 }))
214171215172 # import any additional modules that the user has provided
···222179 else
223180 assert assertMsg (nix-darwin != null) "nix-darwin must be set when class is darwin";
224181 {
225225- darwinConfigurations.${name} = eval // {
226226- system = eval.config.system.build.toplevel;
227227- };
182182+ darwinConfigurations.${name} = eval;
228183 };
229184230185 foldAttrsRecursive = foldl' (acc: attrs: recursiveUpdate acc attrs) { };