diff --git a/pkgs/by-name/ll/lldap/package.nix b/pkgs/by-name/ll/lldap/package.nix index becae0dea4a3..e14a5d130be4 100644 --- a/pkgs/by-name/ll/lldap/package.nix +++ b/pkgs/by-name/ll/lldap/package.nix @@ -10,6 +10,10 @@ wasm-bindgen-cli_0_2_100, wasm-pack, which, + runCommand, + cacert, + curl, + staticAssetsHash ? "sha256-xVbHD9s3ofbtHCDvjYwmsWXDEJ9z9vRxQDRR6pW6rt8=", }: let @@ -29,7 +33,35 @@ let cargoHash = "sha256-SO7+HiiXNB/KF3fjzSMeiTPjRQq/unEfsnplx4kZv9c="; }; + staticAssets = + src: + runCommand "${commonDerivationAttrs.pname}-static-assets" + { + outputHash = staticAssetsHash; + outputHashAlgo = "sha256"; + outputHashMode = "recursive"; + + inherit src; + + nativeBuildInputs = [ + curl + ]; + + env.SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt"; + } + '' + mkdir $out + mkdir $out/fonts + for file in $(cat ${src}/app/static/libraries.txt); do + curl $file --location --remote-name --output-dir $out + done + for file in $(cat ${src}/app/static/fonts/fonts.txt); do + curl $file --location --remote-name --output-dir $out/fonts + done + ''; + frontend = rustPlatform.buildRustPackage ( + finalAttrs: commonDerivationAttrs // { pname = commonDerivationAttrs.pname + "-frontend"; @@ -49,7 +81,10 @@ let installPhase = '' mkdir -p $out - cp -R app/{index.html,pkg,static} $out/ + cp -R app/{pkg,static} $out/ + cp app/index_local.html $out/index.html + cp -R ${staticAssets finalAttrs.src}/* $out/static + rm $out/static/libraries.txt $out/static/fonts/fonts.txt ''; doCheck = false;