summary refs log tree commit diff
path: root/host/rootfs/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2022-08-31 09:37:24 +0000
committerAlyssa Ross <hi@alyssa.is>2022-09-10 15:25:37 +0000
commitb508c467d0a54f1aa60c138acdc6677a8ba77abd (patch)
treea12a3f21cf7dcb88037850e84890b7f6337c6888 /host/rootfs/default.nix
parent44d289986b1ef4d7a0c6655b97a487fb61b45534 (diff)
downloadspectrum-b508c467d0a54f1aa60c138acdc6677a8ba77abd.tar
spectrum-b508c467d0a54f1aa60c138acdc6677a8ba77abd.tar.gz
spectrum-b508c467d0a54f1aa60c138acdc6677a8ba77abd.tar.bz2
spectrum-b508c467d0a54f1aa60c138acdc6677a8ba77abd.tar.lz
spectrum-b508c467d0a54f1aa60c138acdc6677a8ba77abd.tar.xz
spectrum-b508c467d0a54f1aa60c138acdc6677a8ba77abd.tar.zst
spectrum-b508c467d0a54f1aa60c138acdc6677a8ba77abd.zip
Introduce a build configuration file
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 <nixpkgs> {
	    overlays = [
	      (final: super: {
	        weston = super.weston.overrideAttrs ({ patches ? [], ... }: {
	          patches = patches ++ [
	            path/to/weston.patch
	          ];
	        });
	      })
	    ];
	  };
	}

Signed-off-by: Alyssa Ross <hi@alyssa.is>
Message-Id: <20220831093727.282797-1-hi@alyssa.is>
Reviewed-by: Ville Ilvonen <ville.ilvonen@unikie.com>
Tested-by: José Pekkarinen <jose.pekkarinen@unikie.com>
Diffstat (limited to 'host/rootfs/default.nix')
-rw-r--r--host/rootfs/default.nix7
1 files changed, 5 insertions, 2 deletions
diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix
index a651a20..874de78 100644
--- a/host/rootfs/default.nix
+++ b/host/rootfs/default.nix
@@ -2,7 +2,8 @@
 # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross <hi@alyssa.is>
 # SPDX-FileCopyrightText: 2022 Unikie
 
-{ pkgs ? import <nixpkgs> {} }: pkgs.pkgsStatic.callPackage (
+{ config ? import ../../nix/eval-config.nix {} }: let inherit (config) pkgs; in
+pkgs.pkgsStatic.callPackage (
 
 { lib, stdenvNoCC, nixos, runCommand, writeReferencesToFile, s6-rc, tar2ext4
 , busybox, cloud-hypervisor, cryptsetup, execline, jq, kmod
@@ -13,7 +14,9 @@ let
   inherit (lib) cleanSource cleanSourceWith concatMapStringsSep hasSuffix;
   inherit (nixosAllHardware.config.hardware) firmware;
 
-  start-vm = import ../start-vm { pkgs = pkgs.pkgsStatic; };
+  start-vm = import ../start-vm {
+    config = config // { pkgs = pkgs.pkgsStatic; };
+  };
 
   pkgsGui = pkgs.pkgsMusl.extend (final: super: {
     systemd = final.libudev-zero;