1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-09-17 14:57:22 +03:00

Make usable with pure eval

This commit is contained in:
Tristan Ross 2024-04-29 21:49:35 -07:00
parent 655c8830d5
commit ee956db359
No known key found for this signature in database
GPG Key ID: B09C422035669AF8
5 changed files with 11 additions and 5 deletions

View File

@ -1,6 +1,7 @@
{ device ? null
, configuration ? null
, pkgs ? (import ./pkgs.nix {})
, system ? builtins.currentSystem
, pkgs ? (import ./pkgs.nix { inherit system; })
}@args':
let

View File

@ -28,6 +28,7 @@ let
dummyEval = evalWith {
device = (dummyConfig "aarch64-linux");
modules = [];
inherit pkgs;
};
optionsJSON = (nixosOptionsDoc { options = dummyEval.options; }).optionsJSON;

View File

@ -8,6 +8,7 @@
# The identifier of the device this should be built for.
# (This gets massaged later on)
, device ? null
, system ? if (pkgs == null) then builtins.currentSystem else pkgs.system
, configuration
# Internally used to tack on configuration by release.nix
, additionalConfiguration ? {}
@ -32,7 +33,7 @@ let
eval = evalWith {
device = final_device;
modules = configuration;
inherit additionalConfiguration;
inherit additionalConfiguration pkgs system;
};
# Makes a mostly useless header.

View File

@ -20,13 +20,15 @@ rec {
evalWith =
{ modules
, device
, pkgs
, system ? pkgs.system
, additionalConfiguration ? {}
, baseModules ? (
(import ../modules/module-list.nix)
++ (import "${toString pkgs.path}/nixos/modules/module-list.nix")
)
}: evalConfig {
inherit baseModules;
inherit baseModules pkgs system;
modules =
(if device ? special
then [ device.config ]
@ -73,7 +75,8 @@ rec {
# Eval with a configuration, for the given device.
evalWithConfiguration = configuration: device: evalWith {
modules = [ configuration ];
inherit device;
inherit device pkgs;
inherit (pkgs) system;
};
# The simplest eval for a device, with an empty configuration.

View File

@ -24,7 +24,7 @@ in
filteredArgs // {
# Needed for hermetic eval, otherwise `eval-config.nix` will try
# to use `builtins.currentSystem`.
inherit system;
inherit system pkgs;
inherit baseModules;
# Newer versions of module system pass specialArgs to modules, so try
# to pass that to eval if possible.