simple strings server for the wentworth coding club / my personal use

Merge branch 'main' into bunify

authored by jaspermayone.com and committed by

GitHub 06e73a52 3e7871e1

+32 -7
+32 -7
flake.nix
··· 11 11 let 12 12 pkgs = nixpkgs.legacyPackages.${system}; 13 13 14 - strings = pkgs.stdenv.mkDerivation { 15 - pname = "strings"; 16 - version = "0.1.0"; 17 - 14 + # Pre-fetch node_modules as a fixed-output derivation 15 + nodeModules = pkgs.stdenv.mkDerivation { 16 + name = "strings-node-modules"; 18 17 src = ./.; 19 18 20 - nativeBuildInputs = [ pkgs.bun pkgs.makeWrapper ]; 19 + nativeBuildInputs = [ pkgs.bun pkgs.cacert ]; 20 + 21 + # Fixed-output derivation - allows network access but requires hash 22 + outputHashMode = "recursive"; 23 + outputHashAlgo = "sha256"; 24 + outputHash = "sha256-40uExawvAkHS9Sz8KRo6tpbKXNkkxbzBvdCkULruYqM="; 21 25 22 26 buildPhase = '' 23 27 runHook preBuild 24 28 export HOME=$(mktemp -d) 25 - bun install 29 + export SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt 30 + bun install --frozen-lockfile 26 31 runHook postBuild 27 32 ''; 28 33 29 34 installPhase = '' 30 35 runHook preInstall 36 + mkdir -p $out 37 + cp -r node_modules $out/ 38 + runHook postInstall 39 + ''; 40 + }; 41 + 42 + strings = pkgs.stdenv.mkDerivation { 43 + pname = "strings"; 44 + version = "0.1.0"; 45 + 46 + src = ./.; 47 + 48 + nativeBuildInputs = [ pkgs.makeWrapper ]; 49 + 50 + # No build phase needed - deps are pre-fetched 51 + dontBuild = true; 52 + 53 + installPhase = '' 54 + runHook preInstall 31 55 32 56 mkdir -p $out/lib/strings $out/bin 33 - cp -r src package.json node_modules $out/lib/strings/ 57 + cp -r src package.json $out/lib/strings/ 58 + ln -s ${nodeModules}/node_modules $out/lib/strings/node_modules 34 59 35 60 makeWrapper ${pkgs.bun}/bin/bun $out/bin/strings \ 36 61 --add-flags "run $out/lib/strings/src/index.ts"