nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 96 lines 2.0 kB view raw
1{ 2 lib, 3 stdenvNoCC, 4 libsass, 5 nodejs, 6 pnpm_9, 7 fetchPnpmDeps, 8 pnpmConfigHook, 9 fetchFromGitHub, 10 nixosTests, 11 vips, 12}: 13 14let 15 pinData = lib.importJSON ./pin.json; 16in 17 18stdenvNoCC.mkDerivation (finalAttrs: { 19 20 pname = "lemmy-ui"; 21 version = pinData.uiVersion; 22 23 src = fetchFromGitHub { 24 owner = "LemmyNet"; 25 repo = "lemmy-ui"; 26 tag = finalAttrs.version; 27 fetchSubmodules = true; 28 hash = pinData.uiHash; 29 }; 30 31 nativeBuildInputs = [ 32 nodejs 33 pnpmConfigHook 34 pnpm_9 35 ]; 36 37 buildInputs = [ 38 libsass 39 vips 40 ]; 41 42 extraBuildInputs = [ libsass ]; 43 pnpmDeps = fetchPnpmDeps { 44 inherit (finalAttrs) pname version src; 45 pnpm = pnpm_9; 46 fetcherVersion = 1; 47 hash = pinData.uiPNPMDepsHash; 48 }; 49 50 buildPhase = '' 51 runHook preBuild 52 53 pnpm run prebuild:prod 54 # Required to pass a custom value for COMMIT_HASH, as the normal 55 # `pnpm build:prod` tries to derive its value by running `git`. 56 # This value is only injected into the templated asset URLs for cache invalidation, 57 # so we don't really need a commit hash here, just a value that changes on every 58 # update. 59 pnpm exec webpack --env COMMIT_HASH="${finalAttrs.version}" --mode=production 60 61 runHook postBuild 62 ''; 63 64 preInstall = '' 65 mkdir $out 66 cp -R ./dist $out 67 cp -R ./node_modules $out 68 ''; 69 70 preFixup = '' 71 find $out -name libvips-cpp.so.42 -print0 | while read -d $'\0' libvips; do 72 echo replacing libvips at $libvips 73 rm $libvips 74 ln -s ${lib.getLib vips}/lib/libvips-cpp.so.42 $libvips 75 done 76 ''; 77 78 distPhase = "true"; 79 80 passthru = { 81 updateScript = ./update.py; 82 tests.lemmy-ui = nixosTests.lemmy; 83 }; 84 85 meta = { 86 description = "Building a federated alternative to reddit in rust"; 87 homepage = "https://join-lemmy.org/"; 88 license = lib.licenses.agpl3Only; 89 maintainers = with lib.maintainers; [ 90 happysalada 91 billewanick 92 georgyo 93 ]; 94 inherit (nodejs.meta) platforms; 95 }; 96})