Skip to content

Commit 64e2f9a

Browse files
committed
packaging: fetch frontend dependencies using importNpmLock
1 parent 56c2be9 commit 64e2f9a

File tree

3 files changed

+4021
-2293
lines changed

3 files changed

+4021
-2293
lines changed

flake.nix

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
) { };
5858

5959
fernglas-frontend = final.callPackage (
60-
{ lib, stdenv, yarn2nix-moretea, yarn, nodejs-slim }:
60+
{ lib, stdenv, nodejs, importNpmLock }:
6161

6262
stdenv.mkDerivation (finalDrv: {
6363
pname = "fernglas-frontend";
@@ -77,25 +77,14 @@
7777
env.FERNGLAS_COMMIT = self.rev or "main";
7878
env.FERNGLAS_VERSION = finalDrv.version;
7979

80-
offlineCache = let
81-
yarnLock = ./frontend/yarn.lock;
82-
yarnNix = yarn2nix-moretea.mkYarnNix { inherit yarnLock; };
83-
in
84-
yarn2nix-moretea.importOfflineCache yarnNix;
85-
86-
nativeBuildInputs = [ yarn nodejs-slim yarn2nix-moretea.fixup_yarn_lock ];
87-
88-
configurePhase = ''
89-
runHook preConfigure
90-
91-
export HOME=$NIX_BUILD_TOP/fake_home
92-
yarn config --offline set yarn-offline-mirror $offlineCache
93-
fixup_yarn_lock yarn.lock
94-
yarn install --offline --frozen-lockfile --ignore-scripts --no-progress --non-interactive
95-
patchShebangs node_modules/
80+
npmDeps = importNpmLock {
81+
npmRoot = finalDrv.src;
82+
};
9683

97-
runHook postConfigure
98-
'';
84+
nativeBuildInputs = [
85+
nodejs
86+
importNpmLock.npmConfigHook
87+
];
9988

10089
buildPhase = ''
10190
runHook preBuild

0 commit comments

Comments
 (0)