about summary refs log tree commit diff
path: root/pkgs/by-name/sh
diff options
context:
space:
mode:
authorRobert Schütz <nix@dotlambda.de>2023-10-02 15:46:12 +0000
committerGitHub <noreply@github.com>2023-10-02 15:46:12 +0000
commit0c7ffbc66e6d78c50c38e717ec91a2a14e0622fb (patch)
tree1eeebae5e1dcbc4aea1490783da36ec60705d435 /pkgs/by-name/sh
parent7ea24a0f10dd1dc3ea3eab04ff49281410094f9e (diff)
parentaadaa919abde30a5ffa7d677b19ff1fdaf1a62ad (diff)
Merge pull request #258270 from dotlambda/shepherd-fetchYarnDeps
shepherd: use fetchYarnDeps
Diffstat (limited to 'pkgs/by-name/sh')
-rw-r--r--pkgs/by-name/sh/shepherd/package.nix77
1 files changed, 77 insertions, 0 deletions
diff --git a/pkgs/by-name/sh/shepherd/package.nix b/pkgs/by-name/sh/shepherd/package.nix
new file mode 100644
index 0000000000000..4cd45aaea0b38
--- /dev/null
+++ b/pkgs/by-name/sh/shepherd/package.nix
@@ -0,0 +1,77 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, fetchYarnDeps
+, makeWrapper
+, nodejs
+, prefetch-yarn-deps
+, yarn
+}:
+
+stdenv.mkDerivation rec {
+  pname = "shepherd";
+  version = "1.16.0";
+
+  src = fetchFromGitHub {
+    owner = "NerdWalletOSS";
+    repo = "shepherd";
+    rev = "v${version}";
+    hash = "sha256-LY8Vde4YpGuKnQ5UnSOpsQDY7AOyZRziUrfZb5dRiX4=";
+  };
+
+  offlineCache = fetchYarnDeps {
+    yarnLock = "${src}/yarn.lock";
+    hash = "sha256-tJXJ8ePr5ArAV+0JcuJsTo/B2PUcgsXfZrSDCpna/9k=";
+  };
+
+  nativeBuildInputs  = [
+    makeWrapper
+    nodejs
+    prefetch-yarn-deps
+    yarn
+  ];
+
+  configurePhase = ''
+    runHook preConfigure
+
+    export HOME=$(mktemp -d)
+    yarn config --offline set yarn-offline-mirror "$offlineCache"
+    fixup-yarn-lock yarn.lock
+    yarn --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive install
+    patchShebangs node_modules
+
+    runHook postConfigure
+  '';
+
+  buildPhase = ''
+    runHook preBuild
+
+    yarn --offline build
+
+    runHook postBuild
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    yarn --offline --production install
+
+    mkdir -p "$out/lib/node_modules/@nerdwallet/shepherd"
+    cp -r . "$out/lib/node_modules/@nerdwallet/shepherd"
+
+    makeWrapper "${nodejs}/bin/node" "$out/bin/shepherd" \
+      --add-flags "$out/lib/node_modules/@nerdwallet/shepherd/lib/cli.js"
+
+    runHook postInstall
+  '';
+
+  meta = {
+    changelog = "https://github.com/NerdWalletOSS/shepherd/blob/${src.rev}/CHANGELOG.md";
+    description = "A utility for applying code changes across many repositories";
+    homepage = "https://github.com/NerdWalletOSS/shepherd";
+    license = lib.licenses.asl20;
+    mainProgram = "shepherd";
+    maintainers = with lib.maintainers; [ dbirks ];
+    platforms = lib.platforms.all;
+  };
+}