about summary refs log tree commit diff
path: root/release.nix
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2017-02-07 23:40:13 +0100
committeraszlig <aszlig@redmoonstudios.org>2017-02-08 00:12:12 +0100
commite413688502b482694b9c4057055e15a83fc8265a (patch)
treeecabd6a39445f57772918c6683eb7842e65a127a /release.nix
parent952c700e5071b8f450feba0ce572b2f800a35ee0 (diff)
modules/core: Add a new module for lazy packages
This allows to add packages to vuizvui.lazyPackages which then aren't
directly installed onto the system but instead built by the Hydra and
only fetched from it as soon as a binary of one of these packages is
executed.

Doing this only within a NixOS module however isn't enough, because by
default gc-keep-outputs is false, so a garbage collect on the Hydra
instance would remove the packages we wrap in vuizvui.lazyPackages.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'release.nix')
-rw-r--r--release.nix15
1 files changed, 13 insertions, 2 deletions
diff --git a/release.nix b/release.nix
index 5591dcac..b71ad0c3 100644
--- a/release.nix
+++ b/release.nix
@@ -69,8 +69,19 @@ let
 in with pkgsUpstream.lib; with builtins; {
 
   machines = let
-    getBuild = const (getAttr "build");
-  in mapAttrsRecursiveCond (m: !(m ? eval)) getBuild allMachines;
+    # We need to expose all the real builds within vuizvui.lazyPackages to make
+    # sure they don't get garbage collected on the Hydra instance.
+    wrapLazy = machine: pkgsUpstream.runCommand machine.build.name {
+      fakeRuntimeDeps = machine.eval.config.vuizvui.lazyPackages;
+      product = machine.build;
+    } ''
+      mkdir -p "$out/nix-support"
+      echo "$product" > "$out/nix-support/fake-runtime-dependencies"
+      for i in $fakeRuntimeDeps; do
+        echo "$i" >> "$out/nix-support/fake-runtime-dependencies"
+      done
+    '';
+  in mapAttrsRecursiveCond (m: !(m ? eval)) (const wrapLazy) allMachines;
 
   isoImages = let
     buildIso = attrs: let