tvl-depot/web/static/default.nix
Vincent Ambo aa122cbae7 style: format entire depot with nixpkgs-fmt
This CL can be used to compare the style of nixpkgs-fmt against other
formatters (nixpkgs, alejandra).

Change-Id: I87c6abff6bcb546b02ead15ad0405f81e01b6d9e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4397
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: lukegb <lukegb@tvl.fyi>
Reviewed-by: wpcarro <wpcarro@gmail.com>
Reviewed-by: Profpatsch <mail@profpatsch.de>
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Reviewed-by: tazjin <tazjin@tvl.su>
Reviewed-by: cynthia <cynthia@tvl.fyi>
Reviewed-by: edef <edef@edef.eu>
Reviewed-by: eta <tvl@eta.st>
Reviewed-by: grfn <grfn@gws.fyi>
2022-01-31 16:11:53 +00:00

29 lines
987 B
Nix

# 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.bluePng} $out/logo-blue.png
cp ${logo.greenPng} $out/logo-green.png
cp ${logo.orangePng} $out/logo-orange.png
cp ${logo.purplePng} $out/logo-purple.png
cp ${logo.redPng} $out/logo-red.png
cp ${logo.yellowPng} $out/logo-yellow.png
'')