From b508c467d0a54f1aa60c138acdc6677a8ba77abd Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Wed, 31 Aug 2022 09:37:24 +0000 Subject: Introduce a build configuration file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By default, a file called "config.nix" in the root of the Spectrum repository will be read if it exists. That file should contain an attribute set. Currently, only a "pkgs" key is supported, which allows specifying a custom package set that will be used throughout the Spectrum Nix files. This will allow us to provide configuartion options for people who want to build Spectrum in ways that are probably not suitable for upstreaming. For example, using the "pkgs" config option I'm introducing here, it would be possible to use an overlay to patch individual components, like so: { pkgs = import { overlays = [ (final: super: { weston = super.weston.overrideAttrs ({ patches ? [], ... }: { patches = patches ++ [ path/to/weston.patch ]; }); }) ]; }; } Signed-off-by: Alyssa Ross Message-Id: <20220831093727.282797-1-hi@alyssa.is> Reviewed-by: Ville Ilvonen Tested-by: José Pekkarinen --- host/initramfs/default.nix | 7 +++---- host/initramfs/extfs.nix | 8 ++++---- host/initramfs/shell.nix | 9 +++++---- 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'host/initramfs') diff --git a/host/initramfs/default.nix b/host/initramfs/default.nix index 44932ad..e5ddeb9 100644 --- a/host/initramfs/default.nix +++ b/host/initramfs/default.nix @@ -1,11 +1,10 @@ # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross # SPDX-License-Identifier: MIT -{ pkgs ? import {} -, rootfs ? import ../rootfs { inherit pkgs; } +{ config ? import ../../nix/eval-config.nix {} +, rootfs ? import ../rootfs { inherit config; } }: - -pkgs.callPackage ( +let inherit (config) pkgs; in pkgs.callPackage ( { lib, stdenvNoCC, makeModulesClosure, runCommand, writeReferencesToFile , pkgsStatic, busybox, cpio, microcodeAmd, microcodeIntel }: diff --git a/host/initramfs/extfs.nix b/host/initramfs/extfs.nix index 9fdbd9a..63f436a 100644 --- a/host/initramfs/extfs.nix +++ b/host/initramfs/extfs.nix @@ -1,21 +1,21 @@ # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross # SPDX-License-Identifier: MIT -{ pkgs, runCommand, tar2ext4 }: +{ config, runCommand, tar2ext4 }: let netvm = import ../../vm/sys/net { - inherit pkgs; + inherit config; # inherit (foot) terminfo; }; appvm-catgirl = import ../../vm/app/catgirl { - inherit pkgs; + inherit config; # inherit (foot) terminfo; }; appvm-lynx = import ../../vm/app/lynx { - inherit pkgs; + inherit config; # inherit (foot) terminfo; }; in diff --git a/host/initramfs/shell.nix b/host/initramfs/shell.nix index 42da6a4..cbd2c60 100644 --- a/host/initramfs/shell.nix +++ b/host/initramfs/shell.nix @@ -1,16 +1,17 @@ # SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross -{ pkgs ? import {} }: +{ config ? import ../../nix/eval-config.nix {} }: let + inherit (config) pkgs; inherit (pkgs.lib) cleanSource cleanSourceWith; extfs = pkgs.pkgsStatic.callPackage ./extfs.nix { - inherit pkgs; + inherit config; }; - rootfs = import ../rootfs { inherit pkgs; }; - initramfs = import ./. { inherit pkgs rootfs; }; + rootfs = import ../rootfs { inherit config; }; + initramfs = import ./. { inherit config rootfs; }; in with pkgs; -- cgit 1.4.1