From 4f326738c858c3de5c4fe80aa3f804b5636a3eda Mon Sep 17 00:00:00 2001 From: K900 Date: Wed, 3 Jul 2024 19:46:50 +0300 Subject: [PATCH] decky-loader: switch to fetchPnpmDeps Fixes #262, #385 --- pkgs/decky-loader/generic.nix | 59 ++++++++------------------------ pkgs/decky-loader/prerelease.nix | 2 +- pkgs/decky-loader/stable.nix | 2 +- 3 files changed, 17 insertions(+), 46 deletions(-) diff --git a/pkgs/decky-loader/generic.nix b/pkgs/decky-loader/generic.nix index 9568cfc3..a71fc2ea 100644 --- a/pkgs/decky-loader/generic.nix +++ b/pkgs/decky-loader/generic.nix @@ -4,6 +4,7 @@ , fetchFromGitHub , nodePackages , nodejs +, pnpm , cacert , python3 , psmisc @@ -16,55 +17,28 @@ let inherit hash; }; - frontendDeps = stdenv.mkDerivation { - name = "decky-loader-frontend-deps-${version}.tar.gz"; - inherit src; - - nativeBuildInputs = [ nodePackages.pnpm ]; - - dontConfigure = true; - - buildPhase = '' - runHook preBuild - - export SOURCE_DATE_EPOCH=1 - export NODE_EXTRA_CA_CERTS="${cacert}/etc/ssl/certs/ca-bundle.crt" - cd frontend - pnpm i --ignore-scripts --ignore-pnpmfile --frozen-lockfile --node-linker=hoisted - - runHook postBuild - ''; - - installPhase = '' - runHook preInstall - - rm node_modules/.modules.yaml - tar -czf $out --owner=0 --group=0 --numeric-owner --format=gnu \ - --mtime="@$SOURCE_DATE_EPOCH" --sort=name --hard-dereference \ - node_modules - - runHook postInstall - ''; - - outputHashMode = "flat"; - outputHashAlgo = "sha256"; - outputHash = npmHash; - }; - - frontend = stdenv.mkDerivation { + frontend = stdenv.mkDerivation rec { pname = "decky-loader-frontend"; inherit version src; - nativeBuildInputs = [ nodejs nodePackages.pnpm ]; + pnpmDeps = pnpm.fetchDeps { + inherit pname version src; + sourceRoot = "${src.name}/frontend"; + hash = npmHash; + }; + + pnpmRoot = "frontend"; + + nativeBuildInputs = [ + nodejs + pnpm.configHook + ]; - dontConfigure = true; buildPhase = '' runHook preBuild pushd frontend - tar xf ${frontendDeps} - patchShebangs --build node_modules pnpm build popd @@ -126,10 +100,7 @@ let runHook postInstall ''; - passthru = { - inherit frontendDeps; - python = python3; - }; + passthru.python = python3; meta = with lib; { description = "A plugin loader for the Steam Deck"; diff --git a/pkgs/decky-loader/prerelease.nix b/pkgs/decky-loader/prerelease.nix index 5878a7b0..d97e823d 100644 --- a/pkgs/decky-loader/prerelease.nix +++ b/pkgs/decky-loader/prerelease.nix @@ -1,5 +1,5 @@ import ./generic.nix { version = "2.12.3"; hash = "sha256-0Z7AgG6qkqKDGToP89XLZI7t6rvsVgSeYoXck+d9Jm8="; - npmHash = "sha256-lv5xhCcOXHqA0ILRnknAryMeTL+qqXaPu9zoZ5FLbmo="; + npmHash = "sha256-XeIzMn/VEPiq7YF6nTRu7PfIv0NB/xd+iuf3wpl04Ss=="; } diff --git a/pkgs/decky-loader/stable.nix b/pkgs/decky-loader/stable.nix index 5878a7b0..322ceaac 100644 --- a/pkgs/decky-loader/stable.nix +++ b/pkgs/decky-loader/stable.nix @@ -1,5 +1,5 @@ import ./generic.nix { version = "2.12.3"; hash = "sha256-0Z7AgG6qkqKDGToP89XLZI7t6rvsVgSeYoXck+d9Jm8="; - npmHash = "sha256-lv5xhCcOXHqA0ILRnknAryMeTL+qqXaPu9zoZ5FLbmo="; + npmHash = "sha256-XeIzMn/VEPiq7YF6nTRu7PfIv0NB/xd+iuf3wpl04Ss="; }