diff options
author | Alyssa Ross <hi@alyssa.is> | 2023-11-24 14:35:08 +0100 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-11-26 12:38:12 +0100 |
commit | 1953476c3dcf7bc66c787fa14b3a061ac91d0fa1 (patch) | |
tree | 9a0f9cef5a7a805aef013c23a80dda29be7523d2 | |
parent | 43d58d61acaa2b3b50988c9f3e0205692be3c9a4 (diff) | |
download | spectrum-1953476c3dcf7bc66c787fa14b3a061ac91d0fa1.tar spectrum-1953476c3dcf7bc66c787fa14b3a061ac91d0fa1.tar.gz spectrum-1953476c3dcf7bc66c787fa14b3a061ac91d0fa1.tar.bz2 spectrum-1953476c3dcf7bc66c787fa14b3a061ac91d0fa1.tar.lz spectrum-1953476c3dcf7bc66c787fa14b3a061ac91d0fa1.tar.xz spectrum-1953476c3dcf7bc66c787fa14b3a061ac91d0fa1.tar.zst spectrum-1953476c3dcf7bc66c787fa14b3a061ac91d0fa1.zip |
pkgs: call nixpkgs entrypoint outside of config
By moving this call under our control, we can insert our own default Nixpkgs arguments, for example overlays, or maybe crossSystem. Signed-off-by: Alyssa Ross <hi@alyssa.is>
-rw-r--r-- | Documentation/development/build-configuration.adoc | 25 | ||||
-rw-r--r-- | lib/config.default.nix | 3 | ||||
-rw-r--r-- | pkgs/default.nix | 3 |
3 files changed, 19 insertions, 12 deletions
diff --git a/Documentation/development/build-configuration.adoc b/Documentation/development/build-configuration.adoc index 4f7d8e9..545aa8c 100644 --- a/Documentation/development/build-configuration.adoc +++ b/Documentation/development/build-configuration.adoc @@ -4,6 +4,7 @@ :example-caption: Test // SPDX-FileCopyrightText: 2022 Unikie +// SPDX-FileCopyrightText: 2023 Alyssa Ross <hi@alyssa.is> // SPDX-License-Identifier: GFDL-1.3-no-invariants-or-later OR CC-BY-SA-4.0 Some aspects of a Spectrum build can be customised using a build @@ -15,9 +16,9 @@ the root of the Spectrum source tree, but this can be overridden by setting https://nixos.org/manual/nix/stable/command-ref/env-common.html#env-NIX_PATH[NIX_PATH] to the path of the configuration file. -The configuration file should contain an attribute set. The only -currently allowed attribute name is `pkgs`. It allows using a -custom Nixpkgs to evaluate Spectrum. +The configuration file should contain an attribute set. See +https://spectrum-os.org/git/spectrum/tree/lib/config.default.nix[lib/config.default.nix] +for supported configuration attributes and their default values. .config.nix to build Spectrum with a https://nixos.org/manual/nixpkgs/unstable/#sec-overlays-definition[Nixpkgs overlay] [example] @@ -26,12 +27,16 @@ custom Nixpkgs to evaluate Spectrum. { default, ... }: { - pkgs = default.pkgs.extend (final: super: { - weston = super.weston.overrideAttrs ({ patches ? [], ... }: { - patches = patches ++ [ - path/to/weston.patch - ]; - }); - }); + pkgsArgs = default.pkgsArgs // { + overlays = [ + (final: super: { + weston = super.weston.overrideAttrs ({ patches ? [], ... }: { + patches = patches ++ [ + path/to/weston.patch + ]; + }); + }) + ] ++ default.pkgsArgs.overlays or []; + }; } ---- diff --git a/lib/config.default.nix b/lib/config.default.nix index af01756..a842234 100644 --- a/lib/config.default.nix +++ b/lib/config.default.nix @@ -2,5 +2,6 @@ # SPDX-License-Identifier: MIT { - pkgs = import ./nixpkgs.default.nix {}; + pkgsFun = import ./nixpkgs.default.nix; + pkgsArgs = {}; } diff --git a/pkgs/default.nix b/pkgs/default.nix index 96a31f4..aec09b5 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -20,7 +20,8 @@ let fullConfig = default // callConfig config; - inherit (fullConfig) pkgs; + pkgs = fullConfig.pkgsFun fullConfig.pkgsArgs; + inherit (pkgs.lib) cleanSource cleanSourceWith hasSuffix makeScope optionalAttrs; |