about summary refs log tree commit diff
path: root/web/static/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'web/static/default.nix')
-rw-r--r--web/static/default.nix22
1 files changed, 22 insertions, 0 deletions
diff --git a/web/static/default.nix b/web/static/default.nix
new file mode 100644
index 0000000000..ea498057f9
--- /dev/null
+++ b/web/static/default.nix
@@ -0,0 +1,22 @@
+# Expose all static assets as a folder. The derivation contains a
+# `drvHash` attribute which can be used for cache-busting.
+{ depot, lib, pkgs, ... }:
+
+let
+  storeDirLength = with builtins; (stringLength storeDir) + 1;
+  logo = depot.web.tvl.logo;
+in lib.fix(self: pkgs.runCommand "tvl-static" {
+  passthru = {
+    # Preserving the string context here makes little sense: While we are
+    # referencing this derivation, we are not doing so via the nix store,
+    # so it makes little sense for Nix to police the references.
+    drvHash = builtins.unsafeDiscardStringContext (
+      lib.substring storeDirLength 32 self.drvPath
+    );
+  };
+} ''
+  mkdir $out
+  cp -r ${./.}/* $out
+  cp ${logo.pastelRainbow} $out/logo-animated.svg
+  cp ${logo.redPng} $out/logo-red.png
+'')