Skip to content

Commit

Permalink
Merge pull request #386 from Jovian-Experiments/hecky
Browse files Browse the repository at this point in the history
decky-loader: switch to fetchPnpmDeps
  • Loading branch information
K900 authored Jul 3, 2024
2 parents b4b7577 + 4f32673 commit 8dd0f83
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 46 deletions.
59 changes: 15 additions & 44 deletions pkgs/decky-loader/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
, fetchFromGitHub
, nodePackages
, nodejs
, pnpm
, cacert
, python3
, psmisc
Expand All @@ -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
Expand Down Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion pkgs/decky-loader/prerelease.nix
Original file line number Diff line number Diff line change
@@ -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==";
}
2 changes: 1 addition & 1 deletion pkgs/decky-loader/stable.nix
Original file line number Diff line number Diff line change
@@ -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=";
}

0 comments on commit 8dd0f83

Please sign in to comment.