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

excalidraw_export: init at v1.1.0 #341078

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21973,6 +21973,12 @@
githubId = 2856634;
name = "Tyler Compton";
};
venikx = {
email = "[email protected]";
github = "venikx";
githubId = 24815061;
name = "Kevin De Baerdemaeker";
};
veprbl = {
email = "[email protected]";
github = "veprbl";
Expand Down
38 changes: 38 additions & 0 deletions pkgs/by-name/ex/excalidraw_export/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
lib,
buildNpmPackage,
fetchFromGitHub,
cairo,
pango,
pkg-config,
}:

buildNpmPackage rec {
pname = "excalidraw_export";
version = "1.1.0";

src = fetchFromGitHub {
owner = "Timmmm";
repo = "excalidraw_export";
rev = "320c8be92f468e5e19564f83e37709b80afc0e46";
hash = "sha256-E5kYI8+hzObd2WNVBd0aQDKMH1Sns539loCQfClJs1Q=";
};

npmDepsHash = "sha256-5yec7BCi1c/e+y00TqxIeoazs49+WdKdfsskAqnVkFs=";

npmBuildScript = "compile";

buildInputs = [
cairo
pango
];
nativeBuildInputs = [ pkg-config ];
Copy link
Member

Choose a reason for hiding this comment

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

Is this necessary? I can't find any references to it in the upstream source, though maybe I didn't look deep enough into its dependencies.

Copy link
Author

@venikx venikx Sep 17, 2024

Choose a reason for hiding this comment

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

I think it's needed since one of the dependencies depends on some binaries being on built on the system. Without it, the installation seems to fail. I might be misunderstanding something though, but at least with it, it seems to work.

npm error /nix/store/8jind2ncd72hlzym9pghjjdj79fvqzv5-bash-5.2p32/bin/sh: line 1: pkg-config: command not found
npm error gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
npm error gyp ERR! configure error
npm error gyp ERR! stack Error: `gyp` failed with exit code: 1
npm error gyp ERR! stack at ChildProcess.<anonymous> (/nix/store/vc64zpxndmp3xh9699yb2vpbl81pxbk0-nodejs-20.17.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:297:18)
npm error gyp ERR! stack at ChildProcess.emit (node:events:519:28)
npm error gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12)
npm error gyp ERR! System Linux 6.8.10-asahi
npm error gyp ERR! command "/nix/store/vc64zpxndmp3xh9699yb2vpbl81pxbk0-nodejs-20.17.0/bin/node" "/nix/store/vc64zpxndmp3xh9699yb2vpbl81pxbk0-nodejs-20.17.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--update-binary" "--module=/build/source/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/build/source/node_modules/canvas/build/Release" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v115" "--nodedir=/nix/store/s6jmwml9fhazzvrva1jhmzmr5qrbbhgd-nodejs-20.17.0-source"
npm error gyp ERR! cwd /build/source/node_modules/canvas
npm error gyp ERR! node -v v20.17.0
npm error gyp ERR! node-gyp -v v10.1.0
npm error gyp ERR! not ok
npm error node-pre-gyp ERR! build error
npm error node-pre-gyp ERR! stack Error: Failed to execute '/nix/store/vc64zpxndmp3xh9699yb2vpbl81pxbk0-nodejs-20.17.0/bin/node /nix/store/vc64zpxndmp3xh9699yb2vpbl81pxbk0-nodejs-20.17.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/build/source/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/build/source/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v115 --nodedir=/nix/store/s6jmwml9fhazzvrva1jhmzmr5qrbbhgd-nodejs-20.17.0-source' (1)
npm error node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/build/source/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
npm error node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:519:28)
npm error node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1105:16)
npm error node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:305:5)
npm error node-pre-gyp ERR! System Linux 6.8.10-asahi
npm error node-pre-gyp ERR! command "/nix/store/vc64zpxndmp3xh9699yb2vpbl81pxbk0-nodejs-20.17.0/bin/node" "/build/source/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
npm error node-pre-gyp ERR! cwd /build/source/node_modules/canvas
npm error node-pre-gyp ERR! node -v v20.17.0
npm error node-pre-gyp ERR! node-pre-gyp -v v1.0.11
npm error node-pre-gyp ERR! not ok
npm error Log files were not written due to an error writing to the directory: /nix/store/31h9lfa8p68kgd9ahn36s1gzcvgz0fjw-excalidraw_export-1.1.0-npm-deps/_logs
npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
error: builder for '/nix/store/n2ww9gn8928b8gknb3vmay9amzc5rsxj-excalidraw_export-1.1.0.drv' failed with exit code 1;
       last 10 log lines:
       > npm error node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1105:16)
       > npm error node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:305:5)
       > npm error node-pre-gyp ERR! System Linux 6.8.10-asahi
       > npm error node-pre-gyp ERR! command "/nix/store/vc64zpxndmp3xh9699yb2vpbl81pxbk0-nodejs-20.17.0/bin/node" "/build/source/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
       > npm error node-pre-gyp ERR! cwd /build/source/node_modules/canvas
       > npm error node-pre-gyp ERR! node -v v20.17.0
       > npm error node-pre-gyp ERR! node-pre-gyp -v v1.0.11
       > npm error node-pre-gyp ERR! not ok
       > npm error Log files were not written due to an error writing to the directory: /nix/store/31h9lfa8p68kgd9ahn36s1gzcvgz0fjw-excalidraw_export-1.1.0-npm-deps/_logs
       > npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
       For full logs, run 'nix log /nix/store/n2ww9gn8928b8gknb3vmay9amzc5rsxj-excalidraw_export-1.1.0.drv'.


meta = {
description = "CLI to export Excalidraw drawings to SVG and PDF";
homepage = "https://github.com/Timmmm/excalidraw_export";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ venikx ];
mainProgram = "excalidraw_export";
Copy link
Author

@venikx venikx Sep 24, 2024

Choose a reason for hiding this comment

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

I noticed the darwin builds are failing, and I don't have a darwin machine. I guess it would be better practice to limit the platforms?

Suggested change
mainProgram = "excalidraw_export";
mainProgram = "excalidraw_export";
platforms = [
"aarch64-linux"
"x86_64-linux"
];

Copy link
Member

@tomodachi94 tomodachi94 Sep 24, 2024

Choose a reason for hiding this comment

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

That would work, but if Darwin builds are supported upstream, but are broken locally (at the Nixpkgs level), setting broken to stdenv.isDarwin is better.

Copy link
Author

@venikx venikx Sep 24, 2024

Choose a reason for hiding this comment

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

That would work, but if Darwin builds are supported upstream, but are broken locally (at the Nixpkgs level), setting broken to stdenv.isDarwin is better.

I am not sure if I fully understand this. With upstream, do you mean the original library, so in this case https://github.com/Timmmm/excalidraw_export? If yes, from what I understand, macOS should be supported by it, but I think it needs to be built differently (the canvas internal deps, requires some binaries to exist in the environment, and I added them for linux, but not sure for darwin).

The last thing you mentioned, would look like this?

Suggested change
mainProgram = "excalidraw_export";
mainProgram = "excalidraw_export";
broken = stdenv.isDarwin;

};
}