vikunja: use pnpm.fetchDeps

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2024-05-05 23:19:28 +02:00
parent 1ec98f0d10
commit 3b2e68d242
No known key found for this signature in database
GPG Key ID: E13DFD4B47127951
2 changed files with 12 additions and 60 deletions

View File

@ -1,4 +1,4 @@
{ lib, fetchFromGitHub, stdenv, stdenvNoCC, nodePackages, buildGoModule, jq, mage, writeShellScriptBin, nixosTests, buildNpmPackage, moreutils, cacert }:
{ lib, fetchFromGitHub, stdenv, nodejs, pnpm, buildGoModule, mage, writeShellScriptBin, nixosTests }:
let
version = "0.23.0";
@ -13,72 +13,20 @@ let
pname = "vikunja-frontend";
inherit version src;
postPatch = ''
cd frontend
'';
sourceRoot = "${finalAttrs.src.name}/frontend";
pnpmDeps = stdenvNoCC.mkDerivation {
pname = "${finalAttrs.pname}-pnpm-deps";
inherit (finalAttrs) src version;
nativeBuildInputs = [
jq
nodePackages.pnpm
moreutils
cacert
];
pnpmPatch = builtins.toJSON {
pnpm.supportedArchitectures = {
os = [ "linux" ];
cpu = [ "x64" "arm64" ];
};
};
postPatch = ''
cd frontend
mv package.json package.json.orig
jq --raw-output ". * $pnpmPatch" package.json.orig > package.json
'';
# https://github.com/NixOS/nixpkgs/blob/763e59ffedb5c25774387bf99bc725df5df82d10/pkgs/applications/misc/pot/default.nix#L56
installPhase = ''
export HOME=$(mktemp -d)
pnpm config set store-dir $out
pnpm install --frozen-lockfile --ignore-script
rm -rf $out/v3/tmp
for f in $(find $out -name "*.json"); do
sed -i -E -e 's/"checkedAt":[0-9]+,//g' $f
jq --sort-keys . $f | sponge $f
done
'';
dontBuild = true;
dontFixup = true;
outputHashMode = "recursive";
outputHash = {
x86_64-linux = "sha256-ybAkXe2/VhGZhr59ZQOcQ+SI2a204e8uPjyE40xUVwU=";
aarch64-linux = "sha256-2iURs6JtI/b2+CnLwhog1X5hSFFO6OmmgFRuTbMjH+k=";
}.${stdenv.system} or (throw "Unsupported system: ${stdenv.system}");
pnpmDeps = pnpm.fetchDeps {
inherit (finalAttrs) pname version src sourceRoot;
hash = "sha256-awQgOLkb46v2aWfw6yv+zGPoOnczalkzg02tBgMTyMY=";
};
nativeBuildInputs = [
nodePackages.pnpm
nodePackages.nodejs
nodejs
pnpm.configHook
];
doCheck = true;
preBuild = ''
export HOME=$(mktemp -d)
pnpm config set store-dir ${finalAttrs.pnpmDeps}
pnpm install --offline --frozen-lockfile --ignore-script
patchShebangs node_modules/{*,.*}
'';
postBuild = ''
pnpm run build
'';
@ -121,8 +69,10 @@ buildGoModule {
vendorHash = "sha256-d4AeQEAtPqMDe5a5aKhCe3i3pDXAMZJkJXxfcAFTx7A=";
inherit frontend;
prePatch = ''
cp -r ${frontend} frontend/dist
cp -r $frontend frontend/dist
'';
postConfigure = ''

View File

@ -14077,6 +14077,8 @@ with pkgs;
viking = callPackage ../applications/misc/viking { };
vikunja = callPackage ../by-name/vi/vikunja/package.nix { pnpm = pnpm_8; };
vim-vint = callPackage ../development/tools/vim-vint { };
vimer = callPackage ../tools/misc/vimer { };