2021-09-18 10:52:07 +00:00
|
|
|
{ lib
|
2024-07-27 06:49:29 +00:00
|
|
|
, stdenvNoCC
|
2021-09-18 10:52:07 +00:00
|
|
|
, libsass
|
|
|
|
, nodejs
|
2024-07-27 06:49:29 +00:00
|
|
|
, pnpm_9
|
2021-09-18 10:52:07 +00:00
|
|
|
, fetchFromGitHub
|
2022-09-09 14:08:57 +00:00
|
|
|
, nixosTests
|
2023-07-15 17:15:38 +00:00
|
|
|
, vips
|
2021-09-18 10:52:07 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2021-12-06 16:07:01 +00:00
|
|
|
pinData = lib.importJSON ./pin.json;
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenvNoCC.mkDerivation (finalAttrs: {
|
|
|
|
|
|
|
|
pname = "lemmy-ui";
|
2023-07-15 17:15:38 +00:00
|
|
|
version = pinData.uiVersion;
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
src = with finalAttrs; fetchFromGitHub {
|
2021-10-04 12:37:57 +00:00
|
|
|
owner = "LemmyNet";
|
2024-07-27 06:49:29 +00:00
|
|
|
repo = pname;
|
2021-10-04 12:37:57 +00:00
|
|
|
rev = version;
|
|
|
|
fetchSubmodules = true;
|
2023-08-04 22:07:22 +00:00
|
|
|
hash = pinData.uiHash;
|
2021-10-04 12:37:57 +00:00
|
|
|
};
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
nodejs
|
|
|
|
pnpm_9.configHook
|
|
|
|
];
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
buildInputs = [libsass vips ];
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
extraBuildInputs = [ libsass ];
|
|
|
|
pnpmDeps = pnpm_9.fetchDeps {
|
|
|
|
inherit (finalAttrs) pname version src;
|
|
|
|
hash = pinData.uiPNPMDepsHash;
|
2021-12-06 16:07:01 +00:00
|
|
|
};
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
|
|
|
pnpm build:prod
|
2023-10-09 19:29:22 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
runHook postBuild
|
2021-10-04 12:37:57 +00:00
|
|
|
'';
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
# installPhase = ''
|
|
|
|
# runHook preInstall
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
# mkdir -p $out/{bin,lib/${finalAttrs.pname}}
|
|
|
|
# mv {dist,node_modules} $out/lib/${finalAttrs.pname}
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
# runHook postInstall
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
# '';
|
2024-09-19 14:19:46 +00:00
|
|
|
preInstall = ''
|
2021-10-04 12:37:57 +00:00
|
|
|
mkdir $out
|
2024-07-27 06:49:29 +00:00
|
|
|
cp -R ./dist $out
|
2021-10-06 13:57:05 +00:00
|
|
|
cp -R ./node_modules $out
|
2021-10-04 12:37:57 +00:00
|
|
|
'';
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2024-09-19 14:19:46 +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-27 06:49:29 +00:00
|
|
|
|
2021-10-04 12:37:57 +00:00
|
|
|
distPhase = "true";
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
passthru.updateScript = ./update.py;
|
2022-09-09 14:08:57 +00:00
|
|
|
passthru.tests.lemmy-ui = nixosTests.lemmy;
|
2024-07-27 06:49:29 +00:00
|
|
|
passthru.commit_sha = finalAttrs.src.rev;
|
2021-12-06 16:07:01 +00:00
|
|
|
|
2021-10-04 12:37:57 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Building a federated alternative to reddit in rust";
|
|
|
|
homepage = "https://join-lemmy.org/";
|
|
|
|
license = licenses.agpl3Only;
|
2024-07-27 06:49:29 +00:00
|
|
|
maintainers = with maintainers; [ happysalada billewanick georgyo ];
|
2023-07-15 17:15:38 +00:00
|
|
|
inherit (nodejs.meta) platforms;
|
2021-09-18 10:52:07 +00:00
|
|
|
};
|
2024-07-27 06:49:29 +00:00
|
|
|
})
|