1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00
nix-darwin/eval-config.nix
Drew Hess 9f7e95887f
Pass system to darwinSystem rather than eval-config.
This allows us to specify what kind of darwinSystem we want to build,
rather than determining it at evaluation time.
2021-09-08 13:05:18 +01:00

45 lines
1.2 KiB
Nix

{ lib }:
{ system ? builtins.currentSystem or "x86_64-darwin"
, modules
, inputs
, baseModules ? import ./modules/module-list.nix
, specialArgs ? { }
}@args:
let
inputsModule = {
_file = ./eval-config.nix;
config = {
_module.args.inputs = inputs;
};
};
pkgsModule = { config, inputs, ... }: {
_file = ./eval-config.nix;
config = {
_module.args.pkgs = import inputs.nixpkgs config.nixpkgs;
# This permits the configuration to override the passed-in
# system.
nixpkgs.system = lib.mkDefault system;
};
};
eval = lib.evalModules (builtins.removeAttrs args [ "inputs" "system" ] // {
modules = modules ++ [ inputsModule pkgsModule ] ++ baseModules;
args = { inherit baseModules modules; };
specialArgs = { modulesPath = builtins.toString ./modules; } // specialArgs;
});
# Was moved in nixpkgs #82751, so both need to be handled here until 20.03 is deprecated.
# https://github.com/NixOS/nixpkgs/commits/dcdd232939232d04c1132b4cc242dd3dac44be8c
_module = eval._module or eval.config._module;
in
{
inherit (_module.args) pkgs;
inherit (eval) options config;
system = eval.config.system.build.toplevel;
}