Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 87 lines 1.7 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 buildGo123Module, 6 nodejs_22, 7 pnpm_9, 8 9 nixosTests, 10}: 11 12let 13 version = "2.40.1"; 14 15 pnpm = pnpm_9; 16 nodejs = nodejs_22; 17 18 src = fetchFromGitHub { 19 owner = "filebrowser"; 20 repo = "filebrowser"; 21 rev = "v${version}"; 22 hash = "sha256-UsY5pJU0eVeYQVi7Wqf4RrBfPLQv78zHi96mTLJJS1o="; 23 }; 24 25 frontend = stdenv.mkDerivation (finalAttrs: { 26 pname = "filebrowser-frontend"; 27 inherit version src; 28 29 nativeBuildInputs = [ 30 nodejs 31 pnpm.configHook 32 ]; 33 34 pnpmRoot = "frontend"; 35 36 pnpmDeps = pnpm.fetchDeps { 37 inherit (finalAttrs) pname version src; 38 fetcherVersion = 2; 39 sourceRoot = "${src.name}/frontend"; 40 hash = "sha256-AwjMQ9LDJ72x5JYdtLF4V3nxJTYiCb8e/RVyK3IwPY4="; 41 }; 42 43 installPhase = '' 44 runHook preInstall 45 46 pnpm install -C frontend --frozen-lockfile 47 pnpm run -C frontend build 48 49 mkdir $out 50 mv frontend/dist $out 51 52 runHook postInstall 53 ''; 54 }); 55 56in 57buildGo123Module { 58 pname = "filebrowser"; 59 inherit version src; 60 61 vendorHash = "sha256-FY5rPzWAzkrDaFktTM7VxO/hMk17/x21PL1sKq0zlxg="; 62 63 excludedPackages = [ "tools" ]; 64 65 preBuild = '' 66 cp -r ${frontend}/dist frontend/ 67 ''; 68 69 ldflags = [ 70 "-X github.com/filebrowser/filebrowser/v2/version.Version=v${version}" 71 ]; 72 73 passthru = { 74 inherit frontend; 75 tests = { 76 inherit (nixosTests) filebrowser; 77 }; 78 }; 79 80 meta = with lib; { 81 description = "Filebrowser is a web application for managing files and directories"; 82 homepage = "https://filebrowser.org"; 83 license = licenses.asl20; 84 maintainers = with maintainers; [ oakenshield ]; 85 mainProgram = "filebrowser"; 86 }; 87}