diff options
author | Alyssa Ross <hi@alyssa.is> | 2023-02-22 16:27:38 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-02-22 16:27:38 +0000 |
commit | 9a65ff8c87d8160384d9558769108eced531f0af (patch) | |
tree | 43b2c5c5414db3c6790684b62bba90a2a0e5cded /host/rootfs/default.nix | |
parent | f2b7b942ea8a53f22a4fe3270d241dcb6734d4a9 (diff) | |
download | spectrum-9a65ff8c87d8160384d9558769108eced531f0af.tar spectrum-9a65ff8c87d8160384d9558769108eced531f0af.tar.gz spectrum-9a65ff8c87d8160384d9558769108eced531f0af.tar.bz2 spectrum-9a65ff8c87d8160384d9558769108eced531f0af.tar.lz spectrum-9a65ff8c87d8160384d9558769108eced531f0af.tar.xz spectrum-9a65ff8c87d8160384d9558769108eced531f0af.tar.zst spectrum-9a65ff8c87d8160384d9558769108eced531f0af.zip |
nix/eval-config.nix: fix custom configuration
When I introduced the global src attribute, I broke custom configurations, since they wouldn't be passing that key in, and nor should they. To allow for non-customisable globals like src, we need to separate them from config. Here, I've modified eval-config.nix to take a callback, so that it can provide multiple attributes, and handle command line arguments itself so that doesn't need to be in every entry point any more. This gives us an interface similar to the NixOS module system's, where a variety of globals are available that can be pulled out of the passed attribute set as required, but with the additional advantage that files are usable directly from nix-build, and support command line arguments. Signed-off-by: Alyssa Ross <hi@alyssa.is> Fixes: 0149885 ("nix: centralise source cleaning")
Diffstat (limited to 'host/rootfs/default.nix')
-rw-r--r-- | host/rootfs/default.nix | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix index ad997d1..acc0719 100644 --- a/host/rootfs/default.nix +++ b/host/rootfs/default.nix @@ -2,7 +2,8 @@ # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross <hi@alyssa.is> # SPDX-FileCopyrightText: 2022 Unikie -{ config ? import ../../nix/eval-config.nix {} }: let inherit (config) pkgs; in +import ../../nix/eval-config.nix ( +{ config, src, ... }: let inherit (config) pkgs; in pkgs.pkgsStatic.callPackage ( { lib, stdenvNoCC, nixos, runCommand, writeReferencesToFile, s6-rc, tar2ext4 @@ -120,7 +121,7 @@ in stdenvNoCC.mkDerivation { name = "spectrum-rootfs"; - inherit (config) src; + inherit src; sourceRoot = "source/host/rootfs"; nativeBuildInputs = [ s6-rc tar2ext4 ]; @@ -142,4 +143,4 @@ stdenvNoCC.mkDerivation { platforms = platforms.linux; }; } -) {} +) {}) |