nixpkgs/pkgs/servers/web-apps/lemmy/ui.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

89 lines
1.7 KiB
Nix
Raw Normal View History

2021-09-09 14:28:32 +00:00
{ lib
2024-07-09 00:10:57 +00:00
, stdenvNoCC
2021-09-09 14:28:32 +00:00
, libsass
, nodejs
2024-07-09 00:10:57 +00:00
, pnpm_9
2021-09-09 14:28:32 +00:00
, fetchFromGitHub
, nixosTests
2023-06-26 19:05:06 +00:00
, vips
2021-09-09 14:28:32 +00:00
}:
let
pinData = lib.importJSON ./pin.json;
2021-09-09 14:28:32 +00:00
2024-07-09 00:10:57 +00:00
in
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "lemmy-ui";
version = pinData.uiVersion;
2021-09-09 14:28:32 +00:00
2024-07-09 00:10:57 +00:00
src = with finalAttrs; fetchFromGitHub {
owner = "LemmyNet";
2024-07-09 00:10:57 +00:00
repo = pname;
rev = version;
fetchSubmodules = true;
hash = pinData.uiHash;
};
2021-09-09 14:28:32 +00:00
2024-07-09 00:10:57 +00:00
nativeBuildInputs = [
nodejs
pnpm_9.configHook
];
2021-09-09 14:28:32 +00:00
2024-07-09 00:10:57 +00:00
buildInputs = [libsass vips ];
2021-09-09 14:28:32 +00:00
2024-07-09 00:10:57 +00:00
extraBuildInputs = [ libsass ];
pnpmDeps = pnpm_9.fetchDeps {
inherit (finalAttrs) pname version src;
hash = pinData.uiPNPMDepsHash;
};
2021-09-09 14:28:32 +00:00
2024-07-09 00:10:57 +00:00
buildPhase = ''
runHook preBuild
pnpm build:prod
2023-08-27 11:27:40 +00:00
2024-07-09 00:10:57 +00:00
runHook postBuild
'';
2021-09-09 14:28:32 +00:00
2024-07-09 00:10:57 +00:00
# installPhase = ''
# runHook preInstall
2021-09-09 14:28:32 +00:00
2024-07-09 00:10:57 +00:00
# mkdir -p $out/{bin,lib/${finalAttrs.pname}}
# mv {dist,node_modules} $out/lib/${finalAttrs.pname}
2021-09-09 14:28:32 +00:00
2024-07-09 00:10:57 +00:00
# runHook postInstall
2021-09-09 14:28:32 +00:00
2024-07-09 00:10:57 +00:00
# '';
preInstall = ''
mkdir $out
2024-07-09 00:10:57 +00:00
cp -R ./dist $out
cp -R ./node_modules $out
'';
2021-09-09 14:28:32 +00:00
preFixup = ''
find $out -name libvips-cpp.so.42 -print0 | while read -d $'\0' libvips; do
echo replacing libvips at $libvips
rm $libvips
ln -s ${lib.getLib vips}/lib/libvips-cpp.so.42 $libvips
done
'';
2024-07-09 00:10:57 +00:00
distPhase = "true";
passthru.updateScript = ./update.py;
passthru.tests.lemmy-ui = nixosTests.lemmy;
2024-07-09 00:10:57 +00:00
passthru.commit_sha = finalAttrs.src.rev;
meta = with lib; {
description = "Building a federated alternative to reddit in rust";
homepage = "https://join-lemmy.org/";
license = licenses.agpl3Only;
2024-07-09 00:10:57 +00:00
maintainers = with maintainers; [ happysalada billewanick georgyo ];
inherit (nodejs.meta) platforms;
2021-09-09 14:28:32 +00:00
};
2024-07-09 00:10:57 +00:00
})