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

51 lines
1.1 KiB
Nix
Raw Normal View History

{ lib }:
let
nixpkgs-lib = lib;
in
2020-10-18 10:46:59 +00:00
{ system ? builtins.currentSystem or "x86_64-darwin"
, pkgs ? null
, lib ? nixpkgs-lib
, modules
2020-10-18 10:46:59 +00:00
, inputs
, baseModules ? import ./modules/module-list.nix
, specialArgs ? { }
, check ? true
2020-10-18 10:46:59 +00:00
}@args:
let
2021-12-20 19:29:59 +00:00
argsModule = {
2020-10-18 10:46:59 +00:00
_file = ./eval-config.nix;
config = {
2021-12-20 19:29:59 +00:00
_module.args = {
inherit baseModules inputs modules;
};
2020-10-18 10:46:59 +00:00
};
};
pkgsModule = { config, inputs, ... }: {
_file = ./eval-config.nix;
config = {
_module.args.pkgs = lib.mkIf (pkgs != null) (lib.mkForce pkgs);
nixpkgs.source = lib.mkDefault inputs.nixpkgs;
# This permits the configuration to override the passed-in
# system.
nixpkgs.system = lib.mkDefault system;
2020-10-18 10:46:59 +00:00
};
};
eval = lib.evalModules (builtins.removeAttrs args [ "lib" "inputs" "pkgs" "system" ] // {
2021-12-20 19:29:59 +00:00
modules = modules ++ [ argsModule pkgsModule ] ++ baseModules;
2020-10-18 10:46:59 +00:00
specialArgs = { modulesPath = builtins.toString ./modules; } // specialArgs;
});
in
{
inherit (eval._module.args) pkgs;
2020-10-18 10:46:59 +00:00
inherit (eval) options config;
system = eval.config.system.build.toplevel;
}