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

Conversation

venikx
Copy link

@venikx venikx commented Sep 10, 2024

Description of changes

The following npm package makes it possible to convert .excalidraw files to .svg files: https://github.com/Timmmm/excalidraw_export and is used by https://github.com/wdavew/org-excalidraw to handle excalidraw files inside org-mode in Emacs.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@venikx venikx changed the title feat(nodePackages): add excalidraw_export package nodePackages.excalidraw_export: init at v1.1.0 Sep 10, 2024
@venikx
Copy link
Author

venikx commented Sep 10, 2024

I wasn't sure which way I should provide this package buildNpmPackage or via the node2nix helper. I saw from the commits that some packages are being dropped, and newer ones are added via buildNpmPackage (for example: #309100). Is there a preference to using buildNpmPackage? If yes, I have no issue converting this.

I also noticed that the script I had to run updated all the packages, as they were outdated. Should I perhaps separate these two concerns in different PR's (updating the existing packages (1), then adding the new package (2))?

@tomodachi94
Copy link
Member

tomodachi94 commented Sep 11, 2024

Is there a preference to using buildNpmPackage? If yes, I have no issue converting this.

Yes, there seems to be consensus among Node-involved Nixpkgs maintainers that we should avoid adding new packages to nodePackages. (c.f. #229475)

@venikx
Copy link
Author

venikx commented Sep 11, 2024

Is there a preference to using buildNpmPackage? If yes, I have no issue converting this.

Yes, there seems to be consensus among Node-involved Nixpkgs maintainers that we should avoid adding new packages to nodePackages. (c.f. #229475)

Updated to use buildNpmPackage instead of the node2nix stuff.

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'.

pkgs/by-name/ex/excalidraw_export/package.nix Outdated Show resolved Hide resolved
Copy link
Member

@tomodachi94 tomodachi94 left a comment

Choose a reason for hiding this comment

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

Lgtm, thank you ❤️

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"
];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants