mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-12-13 04:04:35 +03:00
lib/release-tools: eval helpers don't include default.nix anymore
This is required for more hermetic evals. A simple thing to try is, before this change, replace `default.nix` with `throw "No thanks..."`. It would throw. It was also possible to observe `local.nix` was being included by the warnings. Wioth this change, `release.nix` does not include `local.nix` through `default.nix`. I think this was the last piece of Mobile NixOS that actually relied on `default.nix` being a thing. We have finally completely inverted the control, where `default.nix` uses the helpers, rather than the helpers evaluating a specialized `default.nix`. From now on, it should be entirely safe to experiment with `default.nix`. We should be able to **fail noisily** when a user builds the default empty configuration!
This commit is contained in:
parent
7332254db2
commit
f1268082f9
@ -15,7 +15,7 @@ let
|
||||
devicesDir = ../../../devices;
|
||||
devicesInfo = symlinkJoin {
|
||||
name = "devices-metadata";
|
||||
paths = (map (device: (evalFor device).build.device-metadata) all-devices);
|
||||
paths = (map (device: (evalFor device).config.system.build.device-metadata) all-devices);
|
||||
};
|
||||
in
|
||||
|
||||
|
@ -4,7 +4,7 @@ let
|
||||
# Original `evalConfig`
|
||||
evalConfig = import "${toString pkgs.path}/nixos/lib/eval-config.nix";
|
||||
in
|
||||
{
|
||||
rec {
|
||||
# This should *never* rely on lib or pkgs.
|
||||
all-devices =
|
||||
builtins.filter
|
||||
@ -36,7 +36,7 @@ in
|
||||
;
|
||||
};
|
||||
|
||||
# These can rely freely on lib, avoir depending on pkgs.
|
||||
# These can rely freely on lib, avoid depending on pkgs.
|
||||
withPkgs = pkgs:
|
||||
let
|
||||
inherit (pkgs) lib;
|
||||
@ -67,10 +67,13 @@ in
|
||||
armv7l-linux = lib.systems.examples.armv7l-hf-multiplatform;
|
||||
};
|
||||
|
||||
# Given a device compatible with `default.nix`, eval.
|
||||
# Eval with a configuration, for the given device.
|
||||
evalWithConfiguration = configuration: device: evalWith {
|
||||
modules = [ configuration ];
|
||||
inherit device;
|
||||
};
|
||||
|
||||
# The simplest eval for a device, with an empty configuration.
|
||||
evalFor = evalWithConfiguration {};
|
||||
evalWithConfiguration = additionalConfiguration: device:
|
||||
import ../. { inherit device additionalConfiguration; }
|
||||
;
|
||||
};
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ let
|
||||
lib.genAttrs systems (system:
|
||||
(evalWithConfiguration {
|
||||
nixpkgs.localSystem = knownSystems.${system};
|
||||
} device).build.default
|
||||
} device).config.system.build.default
|
||||
)
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user