Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

carto: use buildNpmPackage #249879

Merged
merged 2 commits into from
Aug 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pkgs/build-support/node/build-npm-package/hooks/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
npmInstallHook = makeSetupHook
{
name = "npm-install-hook";
propagatedBuildInputs = [ buildPackages.makeWrapper ];
propagatedBuildInputs = with buildPackages; [
installShellFiles
makeWrapper
];
substitutions = {
hostNode = "${nodejs}/bin/node";
jq = "${buildPackages.jq}/bin/jq";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ npmInstallHook() {
else "invalid type " + $typ | halt_error end' "${npmWorkspace-.}/package.json")

while IFS= read -r man; do
mkdir -p "$out/share/man"
ln -s "$packageOut/$man" "$out/share/man"
installManPage "$packageOut/$man"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't quite accurate either. According to https://docs.npmjs.com/cli/v9/configuring-npm/package-json/#man we're supposed to modify the name of the man page. That would be easiest to do if we modify installManPage to accept the man page name as an optional argument.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL about "installManPage", thanks! No objection to leaving that bug for now, it's still better than the previous or current status and I don't want to block this particular PR on the man page question.

done < <(@jq@ --raw-output '(.man | type) as $typ | if $typ == "string" then .man
elif $typ == "list" then .man | join("\n")
else "invalid type " + $typ | halt_error end' "${npmWorkspace-.}/package.json")
Expand Down
1 change: 1 addition & 0 deletions pkgs/development/node-packages/aliases.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ mapAliases {
balanceofsatoshis = pkgs.balanceofsatoshis; # added 2023-07-31
bibtex-tidy = pkgs.bibtex-tidy; # added 2023-07-30
bitwarden-cli = pkgs.bitwarden-cli; # added 2023-07-25
inherit (pkgs) carto; # added 2023-08-17
castnow = pkgs.castnow; # added 2023-07-30
eask = pkgs.eask; # added 2023-08-17
eslint_d = pkgs.eslint_d; # Added 2023-05-26
Expand Down
1 change: 0 additions & 1 deletion pkgs/development/node-packages/node-packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
, "browser-sync"
, "btc-rpc-explorer"
, "carbon-now-cli"
, "carto"
, "cdk8s-cli"
, "cdktf-cli"
, "clean-css-cli"
Expand Down
89 changes: 0 additions & 89 deletions pkgs/development/node-packages/node-packages.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions pkgs/development/tools/carto/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{ lib
, buildNpmPackage
, fetchFromGitHub
}:

buildNpmPackage rec {
pname = "carto";
version = "1.2.0";

src = fetchFromGitHub {
owner = "mapbox";
repo = "carto";
rev = "v${version}";
hash = "sha256-TylMgb2EI52uFmVeMJiQltgNCSh6MutFwUjsYC7gfEA=";
};

npmDepsHash = "sha256-8M9hze71bQWhyxcXeI/EOr0SQ+tx8Lb9LfvnGxYYo0A=";

dontNpmBuild = true;

meta = {
changelog = "https://github.com/mapbox/carto/blob/${src.rev}/CHANGELOG.md";
description = "Mapnik stylesheet compiler";
homepage = "https://github.com/mapbox/carto";
license = lib.licenses.asl20;
mainProgram = "carto";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both the package and the binary it provides are called "carto", right? In this case you should remove mainProgram as it is unnecessary.

Suggested change
mainProgram = "carto";

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not anymore: #246386

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I didn't know.

maintainers = with lib.maintainers; [ Luflosi ];
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18742,6 +18742,8 @@ with pkgs;

cadre = callPackage ../development/tools/cadre { };

carto = callPackage ../development/tools/carto { };

catnip = callPackage ../tools/audio/catnip { };

catnip-gtk4 = callPackage ../tools/audio/catnip-gtk4 { };
Expand Down