about summary refs log tree commit diff
path: root/tools/nixery/default.nix
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-07-23T20·48+0100
committerVincent Ambo <tazjin@google.com>2019-07-23T20·48+0100
commit5d9b32977ddd332f47f89aa30202b80906d3e719 (patch)
treeaaf93e2f0215fee7f19764039af698bbc72fa592 /tools/nixery/default.nix
parent30424447574a0bc0ac8a7c9862b4000c70da846f (diff)
feat(build): Introduce build configuration using Nix
Rather than migrating to Bazel, it seems more appropriate to use Nix
for this project.

The project is split into several different components (for data
dependencies and binaries). A derivation for building an image for
Nixery itself will be added.
Diffstat (limited to 'tools/nixery/default.nix')
-rw-r--r--tools/nixery/default.nix43
1 files changed, 43 insertions, 0 deletions
diff --git a/tools/nixery/default.nix b/tools/nixery/default.nix
new file mode 100644
index 000000000000..19e7df963a50
--- /dev/null
+++ b/tools/nixery/default.nix
@@ -0,0 +1,43 @@
+{ pkgs ? import <nixpkgs> {} }:
+
+with pkgs;
+
+rec {
+  # Go implementation of the Nixery server which implements the
+  # container registry interface.
+  #
+  # Users will usually not want to use this directly, instead see the
+  # 'nixery' derivation below, which automatically includes runtime
+  # data dependencies.
+  nixery-server = buildGoPackage {
+    name = "nixery-server";
+
+    # Technically people should not be building Nixery through 'go get'
+    # or similar (as other required files will not be included), but
+    # buildGoPackage requires a package path.
+    goPackagePath = "github.com/google/nixery";
+
+    goDeps = ./go-deps.nix;
+    src    = ./.;
+
+    meta = {
+      description = "Container image build serving Nix-backed images";
+      homepage    = "https://github.com/google/nixery";
+      license     = lib.licenses.ascl20;
+      maintainers = [ lib.maintainers.tazjin ];
+    };
+  };
+
+  # Nix expression (unimported!) which is used by Nixery to build
+  # container images.
+  nixery-builder = runCommand "build-registry-image.nix" {} ''
+    cat ${./build-registry-image.nix} > $out
+  '';
+
+  # Static files to serve on the Nixery index. This is used primarily
+  # 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
+  '';
+}