Skip to content

Commit

Permalink
Merge pull request #281902 from SuperSandro2000/fixup-yarn-lock
Browse files Browse the repository at this point in the history
fixup-yarn-lock: split out from prefetch-yarn-deps
  • Loading branch information
lilyinstarlight authored Apr 17, 2024
2 parents d786d77 + fb0d661 commit 822af99
Show file tree
Hide file tree
Showing 48 changed files with 126 additions and 105 deletions.
4 changes: 2 additions & 2 deletions pkgs/applications/audio/muzika/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
, desktop-file-utils
, fetchFromGitHub
, fetchYarnDeps
, prefetch-yarn-deps
, fixup-yarn-lock
, gjs
, glib-networking
, gobject-introspection
Expand Down Expand Up @@ -46,7 +46,7 @@ stdenv.mkDerivation rec {
ninja
nodejs
pkg-config
prefetch-yarn-deps
fixup-yarn-lock
wrapGAppsHook4
yarn
];
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/graphics/drawio/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
, fetchYarnDeps
, makeDesktopItem
, copyDesktopItems
, prefetch-yarn-deps
, fixup-yarn-lock
, makeWrapper
, autoSignDarwinBinariesHook
, nodejs
Expand Down Expand Up @@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
};

nativeBuildInputs = [
prefetch-yarn-deps
fixup-yarn-lock
makeWrapper
nodejs
yarn
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/misc/tandoor-recipes/frontend.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ stdenv, fetchYarnDeps, prefetch-yarn-deps, callPackage, nodejs }:
{ stdenv, fetchYarnDeps, fixup-yarn-lock, callPackage, nodejs }:
let
common = callPackage ./common.nix { };
in
Expand All @@ -14,7 +14,7 @@ stdenv.mkDerivation {
};

nativeBuildInputs = [
prefetch-yarn-deps
fixup-yarn-lock
nodejs
nodejs.pkgs.yarn
];
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/networking/cluster/tilt/assets.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
, stdenvNoCC
, version, src
, fetchYarnDeps
, prefetch-yarn-deps, yarn, nodejs
, fixup-yarn-lock, yarn, nodejs
}:

stdenvNoCC.mkDerivation rec {
pname = "tilt-assets";

inherit src version;

nativeBuildInputs = [ prefetch-yarn-deps yarn nodejs ];
nativeBuildInputs = [ fixup-yarn-lock yarn nodejs ];

yarnOfflineCache = fetchYarnDeps {
yarnLock = "${src}/web/yarn.lock";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
, fetchFromGitHub
, makeWrapper
, makeDesktopItem
, prefetch-yarn-deps
, fixup-yarn-lock
, yarn
, nodejs
, fetchYarnDeps
Expand Down Expand Up @@ -42,7 +42,7 @@ stdenv.mkDerivation (finalAttrs: builtins.removeAttrs pinData [ "hashes" ] // {
sha256 = desktopYarnHash;
};

nativeBuildInputs = [ yarn prefetch-yarn-deps nodejs makeWrapper jq ]
nativeBuildInputs = [ yarn fixup-yarn-lock nodejs makeWrapper jq ]
++ lib.optionals stdenv.isDarwin [ desktopToDarwinBundle ];

inherit seshat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
, writeText
, jq
, yarn
, prefetch-yarn-deps
, fixup-yarn-lock
, nodejs
, jitsi-meet
}:
Expand All @@ -33,7 +33,7 @@ stdenv.mkDerivation (finalAttrs: builtins.removeAttrs pinData [ "hashes" ] // {
sha256 = webYarnHash;
};

nativeBuildInputs = [ yarn prefetch-yarn-deps jq nodejs ];
nativeBuildInputs = [ yarn fixup-yarn-lock jq nodejs ];

buildPhase = ''
runHook preBuild
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, stdenv, rustPlatform, fetchFromGitHub, callPackage, sqlcipher, nodejs, python3, yarn, prefetch-yarn-deps, CoreServices, fetchYarnDeps, removeReferencesTo }:
{ lib, stdenv, rustPlatform, fetchFromGitHub, callPackage, sqlcipher, nodejs, python3, yarn, fixup-yarn-lock, CoreServices, fetchYarnDeps, removeReferencesTo }:

let
pinData = lib.importJSON ./pin.json;
Expand All @@ -16,7 +16,7 @@ in rustPlatform.buildRustPackage rec {

sourceRoot = "${src.name}/seshat-node/native";

nativeBuildInputs = [ nodejs python3 yarn prefetch-yarn-deps ];
nativeBuildInputs = [ nodejs python3 yarn fixup-yarn-lock ];
buildInputs = [ sqlcipher ] ++ lib.optional stdenv.isDarwin CoreServices;

npm_config_nodedir = nodejs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
, fetchFromGitHub
, fetchYarnDeps
, yarn
, prefetch-yarn-deps
, fixup-yarn-lock
, nodejs
}:

Expand All @@ -23,7 +23,7 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-N9lUAhfYLlEAIaWSNS3Ecq+aBTz+f7Z22Sclwj9rp6w=";
};

nativeBuildInputs = [ yarn prefetch-yarn-deps nodejs ];
nativeBuildInputs = [ yarn fixup-yarn-lock nodejs ];

configurePhase = ''
runHook preConfigure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
, yarn
, nodejs
, fetchYarnDeps
, prefetch-yarn-deps
, fixup-yarn-lock
, electron
, libnotify
, libpulseaudio
Expand All @@ -34,7 +34,7 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-jBwyIyiWeqNmOnxmVOr7c4oMWwHElEjM25sShhTMi78=";
};

nativeBuildInputs = [ yarn prefetch-yarn-deps nodejs copyDesktopItems makeWrapper ];
nativeBuildInputs = [ yarn fixup-yarn-lock nodejs copyDesktopItems makeWrapper ];

configurePhase = ''
runHook preConfigure
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/networking/irc/thelounge/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
, fetchYarnDeps
, nodejs
, yarn
, prefetch-yarn-deps
, fixup-yarn-lock
, python3
, npmHooks
, darwin
Expand Down Expand Up @@ -38,7 +38,7 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-MM6SgVT7Pjdu96A4eWRucEzT7uNPxBqUDgHKl8mH2C0=";
};

nativeBuildInputs = [ nodejs yarn prefetch-yarn-deps python3 npmHooks.npmInstallHook ] ++ lib.optional stdenv.isDarwin darwin.cctools;
nativeBuildInputs = [ nodejs yarn fixup-yarn-lock python3 npmHooks.npmInstallHook ] ++ lib.optional stdenv.isDarwin darwin.cctools;
buildInputs = [ sqlite ];

configurePhase = ''
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/version-management/gitlab/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
, ruby_3_1, tzdata, git, nettools, nixosTests, nodejs, openssl
, defaultGemConfig, buildRubyGem
, gitlabEnterprise ? false, callPackage, yarn
, prefetch-yarn-deps, replace, file, cacert, fetchYarnDeps, makeWrapper, pkg-config
, fixup-yarn-lock, replace, file, cacert, fetchYarnDeps, makeWrapper, pkg-config
, cargo, rustc, rustPlatform
}:

Expand Down Expand Up @@ -94,7 +94,7 @@ let
sha256 = data.yarn_hash;
};

nativeBuildInputs = [ rubyEnv.wrappedRuby rubyEnv.bundler nodejs yarn git cacert prefetch-yarn-deps ];
nativeBuildInputs = [ rubyEnv.wrappedRuby rubyEnv.bundler nodejs yarn git cacert fixup-yarn-lock ];

patches = [
# Since version 12.6.0, the rake tasks need the location of git,
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/version-management/sapling/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
, fetchYarnDeps
, yarn
, nodejs
, prefetch-yarn-deps
, fixup-yarn-lock
, glibcLocales
, libiconv
, Cocoa
Expand Down Expand Up @@ -66,7 +66,7 @@ let
inherit version;

nativeBuildInputs = [
prefetch-yarn-deps
fixup-yarn-lock
nodejs
yarn
];
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/virtualization/podman-desktop/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
, fetchFromGitHub
, fetchYarnDeps
, yarn
, prefetch-yarn-deps
, fixup-yarn-lock
, nodejs
, makeWrapper
, copyDesktopItems
Expand Down Expand Up @@ -46,7 +46,7 @@ stdenv.mkDerivation (finalAttrs: {

nativeBuildInputs = [
yarn
prefetch-yarn-deps
fixup-yarn-lock
nodejs
makeWrapper
copyDesktopItems
Expand Down
44 changes: 32 additions & 12 deletions pkgs/build-support/node/fetch-yarn-deps/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,49 @@ in {
name = "prefetch-yarn-deps";

dontUnpack = true;
dontBuild = true;

nativeBuildInputs = [ makeWrapper ];
buildInputs = [ coreutils nix-prefetch-git nodejs-slim nix ];
buildInputs = [ nodejs-slim ];

buildPhase = ''
runHook preBuild
installPhase = ''
runHook preInstall
mkdir -p $out/bin $out/libexec
mkdir libexec
tar --strip-components=1 -xf ${yarnpkg-lockfile-tar} package/index.js
mv index.js libexec/yarnpkg-lockfile.js
cp ${./.}/*.js libexec/
patchShebangs libexec
mv index.js $out/libexec/yarnpkg-lockfile.js
cp ${./.}/common.js ${./.}/index.js $out/libexec/
patchShebangs $out/libexec
makeWrapper $out/libexec/index.js $out/bin/prefetch-yarn-deps \
--prefix PATH : ${lib.makeBinPath [ coreutils nix-prefetch-git nix ]}
runHook postBuild
runHook postInstall
'';

passthru = { inherit tests; };
};

fixup-yarn-lock = stdenv.mkDerivation {
name = "fixup-yarn-lock";

dontUnpack = true;
dontBuild = true;

nativeBuildInputs = [ makeWrapper ];
buildInputs = [ nodejs-slim ];

installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp -r libexec $out
makeWrapper $out/libexec/index.js $out/bin/prefetch-yarn-deps \
--prefix PATH : ${lib.makeBinPath [ coreutils nix-prefetch-git nix ]}
mkdir -p $out/bin $out/libexec
tar --strip-components=1 -xf ${yarnpkg-lockfile-tar} package/index.js
mv index.js $out/libexec/yarnpkg-lockfile.js
cp ${./.}/common.js ${./.}/fixup.js $out/libexec/
patchShebangs $out/libexec
makeWrapper $out/libexec/fixup.js $out/bin/fixup-yarn-lock
runHook postInstall
Expand Down
4 changes: 2 additions & 2 deletions pkgs/by-name/aw/aws-azure-login/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
, fetchYarnDeps
, makeWrapper
, nodejs
, prefetch-yarn-deps
, fixup-yarn-lock
, yarn
}:
stdenv.mkDerivation (finalAttrs: {
Expand All @@ -28,7 +28,7 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [
makeWrapper
nodejs
prefetch-yarn-deps
fixup-yarn-lock
yarn
];

Expand Down
4 changes: 2 additions & 2 deletions pkgs/by-name/de/devcontainer/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
, stdenv
, fetchYarnDeps
, fetchFromGitHub
, prefetch-yarn-deps
, fixup-yarn-lock
, nodejs
, python3
, makeWrapper
Expand All @@ -27,7 +27,7 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-Wy0UP8QaQzZ1par7W5UhnRLc5DF2PAif0JIZJtRokBk=";
};

nativeBuildInputs = [ yarn prefetch-yarn-deps python3 makeWrapper ];
nativeBuildInputs = [ yarn fixup-yarn-lock python3 makeWrapper ];

buildPhase = ''
runHook preBuild
Expand Down
4 changes: 2 additions & 2 deletions pkgs/by-name/fe/fernglas/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
, rustPlatform
, fetchFromGitHub
, fetchYarnDeps
, prefetch-yarn-deps
, fixup-yarn-lock
, python3
, jq
, yarn
Expand All @@ -21,7 +21,7 @@ rustPlatform.buildRustPackage rec {
hash = "sha256-0wj5AS8RLVr+S/QWWxCsMvmVjmXUWGfR9kPaZimJEss=";
};

nativeBuildInputs = [ yarn nodejs-slim prefetch-yarn-deps python3 jq ];
nativeBuildInputs = [ yarn nodejs-slim fixup-yarn-lock python3 jq ];

nlnog_communities = fetchFromGitHub {
owner = "NLNOG";
Expand Down
4 changes: 2 additions & 2 deletions pkgs/by-name/gi/gitmoji-cli/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
, fetchYarnDeps
, makeWrapper
, nodejs
, prefetch-yarn-deps
, fixup-yarn-lock
, yarn
, testers
}:
Expand All @@ -28,7 +28,7 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [
makeWrapper
nodejs
prefetch-yarn-deps
fixup-yarn-lock
yarn
];

Expand Down
4 changes: 2 additions & 2 deletions pkgs/by-name/in/incus/ui.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
, fetchFromGitHub
, fetchYarnDeps
, nodejs
, prefetch-yarn-deps
, fixup-yarn-lock
, yarn
, nixosTests
, git
Expand Down Expand Up @@ -42,7 +42,7 @@ stdenv.mkDerivation rec {

nativeBuildInputs = [
nodejs
prefetch-yarn-deps
fixup-yarn-lock
yarn
git
];
Expand Down
4 changes: 2 additions & 2 deletions pkgs/by-name/lx/lxd-ui/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
fetchFromGitHub,
fetchYarnDeps,
nodejs,
prefetch-yarn-deps,
fixup-yarn-lock,
yarn,
nixosTests,
nix-update-script,
Expand All @@ -28,7 +28,7 @@ stdenv.mkDerivation rec {

nativeBuildInputs = [
nodejs
prefetch-yarn-deps
fixup-yarn-lock
yarn
];

Expand Down
Loading

0 comments on commit 822af99

Please sign in to comment.