about summary refs log tree commit diff
path: root/tools/nixery/build-image/default.nix
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-08-13T22·03+0100
committerVincent Ambo <github@tazj.in>2019-08-13T23·02+0100
commitd9168e3e4d8ee0be01cbe994d171d933af215f2c (patch)
tree9d21cc8f338b74bce486212d526dfb5080753e63 /tools/nixery/build-image/default.nix
parent3939722063f3d08a547fa98e17aac609f7f765ac (diff)
refactor(build-image): Extract package set loading into helper
Some upcoming changes might require the Nix build to be split into
multiple separate nix-build invocations of different expressions, thus
splitting this out is useful.

It also fixes an issue where `build-image/default.nix` might be called
in an environment where no Nix channels are configured.
Diffstat (limited to 'tools/nixery/build-image/default.nix')
-rw-r--r--tools/nixery/build-image/default.nix11
1 files changed, 7 insertions, 4 deletions
diff --git a/tools/nixery/build-image/default.nix b/tools/nixery/build-image/default.nix
index cff403995884..0d3002cb404e 100644
--- a/tools/nixery/build-image/default.nix
+++ b/tools/nixery/build-image/default.nix
@@ -16,14 +16,17 @@
 # moves the files needed to call the Nix builds at runtime in the
 # correct locations.
 
-{ pkgs ? import <nixpkgs> { }, self ? ./.
+{ pkgs ? null, self ? ./.
 
   # Because of the insanity occuring below, this function must mirror
   # all arguments of build-image.nix.
-, tag ? null, name ? null, packages ? null, maxLayers ? null, pkgSource ? null
+, pkgSource ? "nixpkgs!nixos-19.03"
+, tag ? null, name ? null, packages ? null, maxLayers ? null
 }@args:
 
-with pkgs; rec {
+let pkgs = import ./load-pkgs.nix { inherit pkgSource; };
+in with pkgs; rec {
+
   groupLayers = buildGoPackage {
     name = "group-layers";
     goDeps = ./go-deps.nix;
@@ -76,7 +79,7 @@ with pkgs; rec {
   };
 
   buildImage = import ./build-image.nix
-    ({ inherit groupLayers; } // (lib.filterAttrs (_: v: v != null) args));
+    ({ inherit pkgs groupLayers; } // (lib.filterAttrs (_: v: v != null) args));
 
   # Wrapper script which is called by the Nixery server to trigger an
   # actual image build. This exists to avoid having to specify the