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
Emily 9d6702cf2b eval-config: remove compatibility shims
20.03 and 22.03 are both deprecated.
2023-06-24 10:48:55 +01:00

56 lines
1.4 KiB
Nix

{ lib }:
let
nixpkgs-lib = lib;
in
{ system ? builtins.currentSystem or "x86_64-darwin"
, pkgs ? null
, lib ? nixpkgs-lib
, modules
, inputs
, baseModules ? import ./modules/module-list.nix
, specialArgs ? { }
, check ? true
}@args:
let
argsModule = {
_file = ./eval-config.nix;
config = {
_module.args = {
inherit baseModules inputs modules;
};
};
};
pkgsModule = { config, inputs, ... }: {
_file = ./eval-config.nix;
config = {
assertions = [ {
# Ensure that nixpkgs.* options are not set when pkgs is set
assertion = pkgs == null || (config.nixpkgs.config == { } && config.nixpkgs.overlays == [ ]);
message = ''
`nixpkgs` options are disabled when `pkgs` is supplied through `darwinSystem`.
'';
} ];
_module.args.pkgs = if pkgs != null then pkgs else 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 [ "lib" "inputs" "pkgs" "system" ] // {
modules = modules ++ [ argsModule pkgsModule ] ++ baseModules;
specialArgs = { modulesPath = builtins.toString ./modules; } // specialArgs;
});
in
{
inherit (eval._module.args) pkgs;
inherit (eval) options config;
system = eval.config.system.build.toplevel;
}