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 /img | |
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 'img')
-rw-r--r-- | img/app/default.nix | 10 | ||||
-rw-r--r-- | img/app/shell.nix | 7 |
2 files changed, 7 insertions, 10 deletions
diff --git a/img/app/default.nix b/img/app/default.nix index 5386afc..7aa22ad 100644 --- a/img/app/default.nix +++ b/img/app/default.nix @@ -1,10 +1,8 @@ # SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross <hi@alyssa.is> -{ config ? import ../../nix/eval-config.nix {} -, terminfo ? config.pkgs.foot.terminfo -}: - +import ../../nix/eval-config.nix ( +{ config, src, terminfo ? config.pkgs.foot.terminfo, ... }: config.pkgs.pkgsStatic.callPackage ( { lib, stdenvNoCC, runCommand, writeReferencesToFile, buildPackages @@ -64,7 +62,7 @@ in stdenvNoCC.mkDerivation { name = "spectrum-appvm"; - inherit (config) src; + inherit src; sourceRoot = "source/img/app"; nativeBuildInputs = [ jq s6-rc tar2ext4 util-linux ]; @@ -83,4 +81,4 @@ stdenvNoCC.mkDerivation { platforms = platforms.linux; }; } -) {} +) {}) diff --git a/img/app/shell.nix b/img/app/shell.nix index 83dcd76..7a323aa 100644 --- a/img/app/shell.nix +++ b/img/app/shell.nix @@ -1,9 +1,8 @@ # SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross <hi@alyssa.is> -{ config ? import ../../nix/eval-config.nix {} -, run ? ../../vm/app/catgirl.nix -}: +import ../../nix/eval-config.nix ( +{ config, run ? ../../vm/app/catgirl.nix, ... }: with config.pkgs; @@ -21,4 +20,4 @@ with config.pkgs; shellHook = '' export RUN_IMG="$(printf "%s\n" "$runDef"/blk/run.img)" ''; -}) +})) |