summary refs log tree commit diff
path: root/release
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-02-22 16:27:38 +0000
committerAlyssa Ross <hi@alyssa.is>2023-02-22 16:27:38 +0000
commit9a65ff8c87d8160384d9558769108eced531f0af (patch)
tree43b2c5c5414db3c6790684b62bba90a2a0e5cded /release
parentf2b7b942ea8a53f22a4fe3270d241dcb6734d4a9 (diff)
downloadspectrum-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 'release')
-rw-r--r--release/combined/default.nix4
-rw-r--r--release/combined/eosimages.nix4
-rw-r--r--release/combined/run-vm.nix4
-rw-r--r--release/installer/default.nix5
-rw-r--r--release/installer/run-vm.nix4
-rw-r--r--release/live/default.nix7
-rw-r--r--release/live/shell.nix4
7 files changed, 16 insertions, 16 deletions
diff --git a/release/combined/default.nix b/release/combined/default.nix
index 2865376..7f7b3a2 100644
--- a/release/combined/default.nix
+++ b/release/combined/default.nix
@@ -3,7 +3,7 @@
 # SPDX-FileCopyrightText: 2021 Yureka <yuka@yuka.dev>
 # SPDX-FileCopyrightText: 2022 Unikie
 
-{ config ? import ../../nix/eval-config.nix {} }: with config.pkgs;
+import ../../nix/eval-config.nix ({ config, ... } @ args: with config.pkgs;
 
 let
   inherit (builtins) storeDir;
@@ -113,4 +113,4 @@ runCommand "spectrum-installer" {
   fillPartition $out 0 ${esp}
   fillPartition $out 1 ${rootfs}
   fillPartition $out 2 ${eosimages}
-''
+'')
diff --git a/release/combined/eosimages.nix b/release/combined/eosimages.nix
index 9f2ab10..b2dba13 100644
--- a/release/combined/eosimages.nix
+++ b/release/combined/eosimages.nix
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: MIT
 # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross <hi@alyssa.is>
 
-{ config ? import ../../nix/eval-config.nix {} }: with config.pkgs;
+import ../../nix/eval-config.nix ({ config, ... }: with config.pkgs;
 
 runCommand "eosimages.img" {
   nativeBuildInputs = [ e2fsprogs tar2ext4 ];
@@ -15,4 +15,4 @@ runCommand "eosimages.img" {
   tar -chf $NIX_BUILD_TOP/eosimages.tar *
   tar2ext4 -i $NIX_BUILD_TOP/eosimages.tar -o $out
   e2label $out eosimages
-''
+'')
diff --git a/release/combined/run-vm.nix b/release/combined/run-vm.nix
index 2fc474e..10bd8bf 100644
--- a/release/combined/run-vm.nix
+++ b/release/combined/run-vm.nix
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: MIT
 # SPDX-FileCopyrightText: 2021 Alyssa Ross <hi@alyssa.is>
 
-{ config ? import ../../nix/eval-config.nix {} }: with config.pkgs;
+import ../../nix/eval-config.nix ({ config, ... }: with config.pkgs;
 
 let
   image = import ./. { inherit config; };
@@ -22,4 +22,4 @@ writeShellScript "run-spectrum-installer-vm.sh" ''
     -drive file=${qemu_kvm}/share/qemu/edk2-${stdenv.hostPlatform.qemuArch}-code.fd,format=raw,if=pflash,readonly=true \
     -drive file=${image},id=drive1,format=raw,if=none,readonly=true \
     -drive file=/proc/self/fd/3,format=raw,if=virtio
-''
+'')
diff --git a/release/installer/default.nix b/release/installer/default.nix
index 0c57704..16a7d35 100644
--- a/release/installer/default.nix
+++ b/release/installer/default.nix
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: MIT
 # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross <hi@alyssa.is>
 
-{ config ? import ../../nix/eval-config.nix {}, extraConfig ? {} }:
+import ../../nix/eval-config.nix ({ config, extraConfig ? {}, ... }:
 with config.pkgs;
 
 let
@@ -21,5 +21,4 @@ in
   ] ++ config.boot.kernelParams);
 
   store = writeReferencesToFile config.system.build.toplevel;
-}
-
+})
diff --git a/release/installer/run-vm.nix b/release/installer/run-vm.nix
index fe014f8..c42155b 100644
--- a/release/installer/run-vm.nix
+++ b/release/installer/run-vm.nix
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: MIT
 # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross <hi@alyssa.is>
 
-{ config ? import ../../nix/eval-config.nix {} }:
+import ../../nix/eval-config.nix ({ config, ... }:
 
 let
   inherit (builtins) storeDir;
@@ -43,4 +43,4 @@ writeShellScript "run-spectrum-installer-vm.sh" ''
     -kernel ${installer.kernel} \
     -initrd ${installer.initramfs} \
     -append ${escapeShellArg installer.kernelParams}
-''
+'')
diff --git a/release/live/default.nix b/release/live/default.nix
index 66bba26..c36c34b 100644
--- a/release/live/default.nix
+++ b/release/live/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 {} }: config.pkgs.callPackage (
+import ../../nix/eval-config.nix ({ config, src, ... }:
+config.pkgs.callPackage (
 
 { stdenvNoCC, cryptsetup, dosfstools, jq, mtools, util-linux, stdenv
 , systemd }:
@@ -22,7 +23,7 @@ in
 stdenvNoCC.mkDerivation {
   name = "spectrum-live.img";
 
-  inherit (config) src;
+  inherit src;
   sourceRoot = "source/release/live";
 
   nativeBuildInputs = [ cryptsetup dosfstools jq mtools util-linux ];
@@ -46,4 +47,4 @@ stdenvNoCC.mkDerivation {
 
   passthru = { inherit rootfs; };
 }
-) {}
+) {})
diff --git a/release/live/shell.nix b/release/live/shell.nix
index dcf2059..7cec144 100644
--- a/release/live/shell.nix
+++ b/release/live/shell.nix
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: MIT
 # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross <hi@alyssa.is>
 
-{ config ? import ../../nix/eval-config.nix {} }:
+import ../../nix/eval-config.nix ({ config, ... }:
 
 with config.pkgs;
 
@@ -12,4 +12,4 @@ with config.pkgs;
 
     OVMF_CODE = "${qemu_kvm}/share/qemu/edk2-${stdenv.hostPlatform.qemuArch}-code.fd";
   }
-)
+))