Merge pull request #318105 from getchoo/pkgs/surrealist/fetchPnpmDeps

surrealist: use `pnpm.fetchDeps`
This commit is contained in:
Weijia Wang 2024-06-08 22:39:32 +02:00 committed by GitHub
commit a6fc748a68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,4 @@
{ buildGoModule { buildGoModule
, cacert
, cairo , cairo
, cargo , cargo
, cargo-tauri , cargo-tauri
@ -7,15 +6,14 @@
, fetchFromGitHub , fetchFromGitHub
, gdk-pixbuf , gdk-pixbuf
, gobject-introspection , gobject-introspection
, jq
, lib , lib
, libsoup , libsoup
, llvmPackages_15 , llvmPackages_15
, makeBinaryWrapper , makeBinaryWrapper
, moreutils , nodejs
, nodePackages
, pango , pango
, pkg-config , pkg-config
, pnpm
, rustc , rustc
, rustPlatform , rustPlatform
, stdenv , stdenv
@ -95,49 +93,25 @@ in stdenv.mkDerivation (finalAttrs: {
''; '';
}; };
pnpm-deps = stdenvNoCC.mkDerivation {
inherit (finalAttrs) src version;
pname = "${finalAttrs.pname}-pnpm-deps";
dontFixup = true;
nativeBuildInputs = [ cacert jq moreutils nodePackages.pnpm ];
postInstall = ''
export HOME=$(mktemp -d)
pnpm config set store-dir $out
# use --ignore-script and --no-optional to avoid downloading binaries
# use --frozen-lockfile to avoid checking git deps
pnpm install --frozen-lockfile --no-optional --ignore-script
# Remove timestamp and sort the json files
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
'';
outputHashMode = "recursive";
outputHash = "sha256-jT0Bw0xiusOw/5o6EUaEV3/GqkD/l6jkwXmOqc3a/nc=";
};
ui = stdenvNoCC.mkDerivation { ui = stdenvNoCC.mkDerivation {
inherit (finalAttrs) src version; inherit (finalAttrs) src version;
pname = "${finalAttrs.pname}-ui"; pname = "${finalAttrs.pname}-ui";
dontFixup = true; dontFixup = true;
pnpmDeps = pnpm.fetchDeps {
inherit (finalAttrs) pname version src;
hash = "sha256-3x/GKgVX0mnxTZmINe/qTtr/vI0h5IqPYt9N0l/VGzg=";
};
ESBUILD_BINARY_PATH = "${lib.getExe esbuild-18-20}"; ESBUILD_BINARY_PATH = "${lib.getExe esbuild-18-20}";
nativeBuildInputs = [ nodePackages.pnpm ]; nativeBuildInputs = [ nodejs pnpm.configHook ];
postPatch = '' postPatch = ''
ln -s ${finalAttrs.embed} src/generated ln -s ${finalAttrs.embed} src/generated
''; '';
postBuild = '' postBuild = ''
export HOME=$(mktemp -d)
pnpm config set store-dir ${finalAttrs.pnpm-deps}
pnpm install --offline --frozen-lockfile --no-optional --ignore-script
pnpm build pnpm build
''; '';