summary refs log tree commit diff
path: root/Documentation
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-11-24 02:07:31 +0100
committerAlyssa Ross <hi@alyssa.is>2023-11-26 12:38:09 +0100
commit371d81422ab11deb332524846d1f5bed05743347 (patch)
tree7b3c9a463ccd1b541a361229bc80825e92d7fab4 /Documentation
parent1af0080f06f746f263204b6e659fa918427c70d2 (diff)
downloadspectrum-371d81422ab11deb332524846d1f5bed05743347.tar
spectrum-371d81422ab11deb332524846d1f5bed05743347.tar.gz
spectrum-371d81422ab11deb332524846d1f5bed05743347.tar.bz2
spectrum-371d81422ab11deb332524846d1f5bed05743347.tar.lz
spectrum-371d81422ab11deb332524846d1f5bed05743347.tar.xz
spectrum-371d81422ab11deb332524846d1f5bed05743347.tar.zst
spectrum-371d81422ab11deb332524846d1f5bed05743347.zip
lib: adjust interface for Nix files
This moves every directly-buildable Nix file in Spectrum from the old
eval-config.nix interface to a new callPackage-based interface.  This
moves us in the direction of stopping files from directly importing
each other, in favor of having a global package set that contains the
Spectrum-specific packages.

Aside from consistency with packages from Nixpkgs, the main advantage
to this is that the packages will be correctly spliced, and so
e.g. lseek being in nativeBuildInputs will now do the right thing.

This is implemented using a scope, so the Spectrum packages are
invisible to Nixpkgs, and are applied on top afterwards, in contrast
to if an overlay was used.

Having a customised package set also paves the way for bringing
modifications to upstream packages (e.g. the Cloud Hypervisor
virtio-gpu patches) into the Spectrum repository, allowing us to use
an unmodified upstream Nixpkgs.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/default.nix18
-rw-r--r--Documentation/jekyll.nix5
2 files changed, 10 insertions, 13 deletions
diff --git a/Documentation/default.nix b/Documentation/default.nix
index f2f9aa4..94d4741 100644
--- a/Documentation/default.nix
+++ b/Documentation/default.nix
@@ -1,10 +1,10 @@
-# SPDX-FileCopyrightText: 2022 Alyssa Ross <hi@alyssa.is>
+# SPDX-FileCopyrightText: 2022-2023 Alyssa Ross <hi@alyssa.is>
 # SPDX-FileCopyrightText: 2022 Unikie
 # SPDX-License-Identifier: MIT
 
-import ../lib/eval-config.nix ({ config, src, ... }: config.pkgs.callPackage (
+import ../lib/call-package.nix
 
-{ stdenvNoCC, jekyll, drawio-headless }:
+({ callSpectrumPackage, src, stdenvNoCC, jekyll, drawio-headless }:
 
 stdenvNoCC.mkDerivation {
   name = "spectrum-docs";
@@ -20,10 +20,8 @@ stdenvNoCC.mkDerivation {
 
   dontInstall = true;
 
-  nativeBuildInputs = [ jekyll drawio-headless ];
-
-  passthru = { inherit jekyll; };
-}
-) {
-  jekyll = import ./jekyll.nix { inherit config; };
-})
+  nativeBuildInputs = [
+    (callSpectrumPackage ./jekyll.nix {})
+    drawio-headless
+  ];
+}) (_: {})
diff --git a/Documentation/jekyll.nix b/Documentation/jekyll.nix
index 4b32ebe..8956683 100644
--- a/Documentation/jekyll.nix
+++ b/Documentation/jekyll.nix
@@ -1,8 +1,7 @@
 # SPDX-FileCopyrightText: 2022 Alyssa Ross <hi@alyssa.is>
 # SPDX-License-Identifier: MIT
 
-import ../lib/eval-config.nix ({ config, ... }: config.pkgs.callPackage (
-
+import ../lib/call-package.nix (
 { bundlerApp }:
 
 bundlerApp {
@@ -10,4 +9,4 @@ bundlerApp {
   gemdir = ./.;
   exes = [ "jekyll" ];
 }
-) { })
+) (_: {})