diff --git a/pkgs/development/web/netlify-cli/default.nix b/pkgs/development/web/netlify-cli/default.nix new file mode 100644 index 000000000000..8b991faf07d4 --- /dev/null +++ b/pkgs/development/web/netlify-cli/default.nix @@ -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 ]; + } diff --git a/pkgs/development/web/netlify-cli/generate.sh b/pkgs/development/web/netlify-cli/generate.sh new file mode 100755 index 000000000000..41858cd98097 --- /dev/null +++ b/pkgs/development/web/netlify-cli/generate.sh @@ -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 \ + ; diff --git a/pkgs/development/web/netlify-cli/shell.nix b/pkgs/development/web/netlify-cli/shell.nix new file mode 100644 index 000000000000..3ad004c9abfa --- /dev/null +++ b/pkgs/development/web/netlify-cli/shell.nix @@ -0,0 +1,7 @@ +{ pkgs ? import ../../../.. {} }: +pkgs.mkShell { + nativeBuildInputs = [ + pkgs.nodePackages.node2nix + pkgs.nix-prefetch-github + ]; +} diff --git a/pkgs/development/web/netlify-cli/update.sh b/pkgs/development/web/netlify-cli/update.sh new file mode 100755 index 000000000000..616b3757db72 --- /dev/null +++ b/pkgs/development/web/netlify-cli/update.sh @@ -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