Skip to content

Commit

Permalink
netlify-cli: Use mkPackage
Browse files Browse the repository at this point in the history
This allows the all-packages.nix entry to be removed
when the package goes to pkgs/by-name 🎉
  • Loading branch information
roberth committed Jan 15, 2025
1 parent 70d9798 commit 5cbca85
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 41 deletions.
77 changes: 39 additions & 38 deletions pkgs/development/web/netlify-cli/default.nix
Original file line number Diff line number Diff line change
@@ -1,43 +1,44 @@
{
buildNpmPackage,
callPackage,
fetchFromGitHub,
lib,
nix-update-script,
nodejs,
pkg-config,
vips,
}:
{ mkPackage }: mkPackage (
{ lib, layers, stdenv, fetchFromGitHub, nix-update-script, pkg-config, vips, callPackage, testers, nodejs_20, ... }:
[
(layers.derivation { inherit stdenv; })
(this: old: {
name = "netlify-cli";
version = "17.38.0";

buildNpmPackage rec {
pname = "netlify-cli";
version = "17.38.0";
deps = old.deps // {
nodejs = nodejs_20;
};

src = fetchFromGitHub {
owner = "netlify";
repo = "cli";
tag = "v${version}";
hash = "sha256-fK+Z6bqnaqSYXgO0lUbGALZeCiAnvMd6LkMSH7JB7J8=";
};
npmFetch.hash = "sha256-oFt+l8CigOtm3W5kiT0kFsqKLOJB9ggfiFQgUU5xQ1I=";

npmDepsHash = "sha256-oFt+l8CigOtm3W5kiT0kFsqKLOJB9ggfiFQgUU5xQ1I=";
setup = {
buildInputs = [ vips ];
nativeBuildInputs = [ pkg-config ];
src = fetchFromGitHub {
owner = "netlify";
repo = "cli";
tag = "v${this.version}";
hash = "sha256-fK+Z6bqnaqSYXgO0lUbGALZeCiAnvMd6LkMSH7JB7J8=";
};
};

inherit nodejs;
public = old.public // {
tests = {
version = testers.testVersion { package = this.public; };
run = callPackage ./test.nix { netlify-cli = this.public; };
};
updateScript = nix-update-script { };
};

buildInputs = [ vips ];
nativeBuildInputs = [ pkg-config ];

passthru = {
tests.test = callPackage ./test.nix { };
updateScript = nix-update-script { };
};

meta = {
description = "Netlify command line tool";
homepage = "https://github.com/netlify/cli";
changelog = "https://github.com/netlify/cli/blob/v${version}/CHANGELOG.md";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ roberth ];
mainProgram = "netlify";
};
}
meta = {
description = "Netlify command line tool";
homepage = "https://github.com/netlify/cli";
changelog = "https://github.com/netlify/cli/blob/v${this.version}/CHANGELOG.md";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ roberth ];
mainProgram = "netlify";
};
})
layers.buildNpmPackage
])
4 changes: 1 addition & 3 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4357,9 +4357,7 @@ with pkgs;
};
});

netlify-cli = callPackage ../development/web/netlify-cli {
nodejs = nodejs_20;
};
netlify-cli = callPackage ../development/web/netlify-cli { };

netpbm = callPackage ../tools/graphics/netpbm { };

Expand Down

0 comments on commit 5cbca85

Please sign in to comment.