From 371d81422ab11deb332524846d1f5bed05743347 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Fri, 24 Nov 2023 02:07:31 +0100 Subject: 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 --- Documentation/default.nix | 18 ++++++++---------- Documentation/jekyll.nix | 5 ++--- 2 files changed, 10 insertions(+), 13 deletions(-) (limited to 'Documentation') 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 +# SPDX-FileCopyrightText: 2022-2023 Alyssa Ross # 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 # 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" ]; } -) { }) +) (_: {}) -- cgit 1.4.1