From 2ff4e9ea8463bff0f7646b17a6028d7b20a2ec1f Mon Sep 17 00:00:00 2001 From: panda2134 Date: Tue, 22 Nov 2022 01:04:49 +0800 Subject: [PATCH] netlify-cli: refactor Co-authored-by: Robert Hensing --- pkgs/development/web/netlify-cli/default.nix | 7 ++----- pkgs/development/web/netlify-cli/generate.sh | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/pkgs/development/web/netlify-cli/default.nix b/pkgs/development/web/netlify-cli/default.nix index 33837af622b6..5f702b4b080a 100644 --- a/pkgs/development/web/netlify-cli/default.nix +++ b/pkgs/development/web/netlify-cli/default.nix @@ -1,17 +1,14 @@ { callPackage, fetchFromGitHub, lib, pkgs }: let nodePackages = import ./composition.nix { inherit pkgs; }; - meta = (lib.importJSON ./netlify-cli.json); + sourceInfo = (lib.importJSON ./netlify-cli.json); in nodePackages.package.override { preRebuild = '' export ESBUILD_BINARY_PATH="${pkgs.esbuild_netlify}/bin/esbuild" ''; src = fetchFromGitHub { - owner = meta.owner; - repo = meta.repo; - rev = meta.rev; - sha256 = meta.sha256; + inherit (sourceInfo) owner repo rev sha256; }; bypassCache = true; reconstructLock = true; diff --git a/pkgs/development/web/netlify-cli/generate.sh b/pkgs/development/web/netlify-cli/generate.sh index aa038a8202f8..20264f1b3e24 100755 --- a/pkgs/development/web/netlify-cli/generate.sh +++ b/pkgs/development/web/netlify-cli/generate.sh @@ -2,7 +2,7 @@ set -eu -o pipefail cd "$( dirname "${BASH_SOURCE[0]}" )" rm -f ./node-env.nix -src="$(nix-build --expr 'let pkgs = import ../../../.. {}; lib = import ../../../../lib; meta = (lib.importJSON ./netlify-cli.json); in pkgs.fetchFromGitHub {owner = meta.owner; repo = meta.repo; rev = meta.rev; sha256 = meta.sha256;}')" +src="$(nix-build --expr 'let pkgs = import ../../../.. {}; meta = (pkgs.lib.importJSON ./netlify-cli.json); in pkgs.fetchFromGitHub { inherit (meta) owner repo rev sha256; }')" echo $src node2nix \ --input $src/package.json \