about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-07-23T22·22+0100
committerVincent Ambo <tazjin@google.com>2019-07-23T22·23+0100
commit5f471392cf074156857ce913002071ed0ac0fce2 (patch)
treeada332cc241b9deb0cb487fa0c1d6f0a05bdde79
parent83145681997d549461e9f3ff15daf819fb1b3e3b (diff)
feat(build): Add wrapper script & container image setup
Introduces a wrapper script which automatically sets the paths to the
required runtime data dependencies.

Additionally configures a container image derivation which will output
a derivation with Nixery, Nix and other dependencies.
-rw-r--r--tools/nixery/default.nix27
1 files changed, 26 insertions, 1 deletions
diff --git a/tools/nixery/default.nix b/tools/nixery/default.nix
index 19e7df963a50..ebfb41bf6b0f 100644
--- a/tools/nixery/default.nix
+++ b/tools/nixery/default.nix
@@ -38,6 +38,31 @@ rec {
   # for the demo instance running at nixery.appspot.com and provides
   # some background information for what Nixery is.
   nixery-static = runCommand "nixery-static" {} ''
-    cp -r ${./static} $out
+    mkdir $out
+    cp ${./static}/* $out
   '';
+
+  # Wrapper script running the Nixery server with the above two data
+  # dependencies configured.
+  #
+  # In most cases, this will be the derivation a user wants if they
+  # are installing Nixery directly.
+  nixery-bin = writeShellScriptBin "nixery" ''
+    export NIX_BUILDER="${nixery-builder}"
+    export WEB_DIR="${nixery-static}"
+    exec ${nixery-server}/bin/nixery
+  '';
+
+  # Container image containing Nixery and Nix itself. This image can
+  # be run on Kubernetes, published on AppEngine or whatever else is
+  # desired.
+  nixery-image = dockerTools.buildLayeredImage {
+    name = "nixery";
+    contents = [
+      bashInteractive
+      coreutils
+      nix
+      nixery-bin
+    ];
+  };
 }