netlify-cli: Prepare shrinkwrap-based node2nix package set

This commit is contained in:
Robert Hensing 2021-10-15 21:19:06 +02:00
parent 5c339ff41e
commit 71429f817d
4 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,13 @@
{ pkgs, lib, fetchFromGitHub }:
let
nodePackages = import ./composition.nix { inherit pkgs; };
in
nodePackages.package.override {
preRebuild = ''
export ESBUILD_BINARY_PATH="${pkgs.esbuild_netlify}/bin/esbuild"
'';
src = fetchFromGitHub (builtins.fromJSON (builtins.readFile ./netlify-cli.json));
bypassCache = true;
reconstructLock = true;
meta.maintainers = with lib.maintainers; [ roberth ];
}

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -eu -o pipefail
cd "$( dirname "${BASH_SOURCE[0]}" )"
rm -f ./node-env.nix
src="$(nix-build --expr '(import ../../../.. {}).fetchFromGitHub (builtins.fromJSON (builtins.readFile ./netlify-cli.json))')"
echo $src
node2nix \
--input $src/package.json \
--lock $src/npm-shrinkwrap.json \
--output node-packages.nix \
--composition composition.nix \
--node-env node-env.nix \
--nodejs-14 \
;

View File

@ -0,0 +1,7 @@
{ pkgs ? import ../../../.. {} }:
pkgs.mkShell {
nativeBuildInputs = [
pkgs.nodePackages.node2nix
pkgs.nix-prefetch-github
];
}

View File

@ -0,0 +1,11 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash
set -euo pipefail
mv netlify-cli.json{,.old}
nix-prefetch-github-latest-release netlify cli >netlify-cli.json
if ! diff -U3 netlify-cli.json{.old,}; then
echo New version detected\; generating expressions...
./generate.sh
fi
rm -f netlify-cli.json.old