feat: add Nix flake for package distribution - #28
Conversation
Enables installation via NixOS configuration without requiring npx. Includes: - buildNpmPackage derivation for the CLI - NixOS module for easy system integration - Dev shell with Node.js 22 - Overlay for use in other flakes
theDakshJaitly
left a comment
There was a problem hiding this comment.
Hey @PJalv, thanks for this — nice contribution for Nix users! A few things to address before merging:
Version mismatch
flake.nix:22 hardcodes version = "0.4.0" but package.json is currently at 0.3.2. This should match. Ideally it would be derived from package.json so it doesn't drift on every release, but at minimum it needs to be 0.3.2 right now.
npmDepsHash maintenance
flake.nix:25 — this hash will break any time package-lock.json changes. Could you add a comment above it noting that? Something like:
# Update this hash when package-lock.json changes:
# nix build 2>&1 | grep 'got:' | awk '{print $2}'
npmDepsHash = "sha256-...";Just so future contributors know what to do when the build fails.
Add result to .gitignore
nix build creates a result symlink in the project root. Should add that to .gitignore so it doesn't get accidentally committed.
Minor note
The postInstall path ($out/lib/node_modules/promexeus/templates/) uses the npm package name promexeus — that's correct today, just flagging it as something that would need updating if the package name ever changes.
Everything else looks solid — platform coverage, the NixOS module, overlay, and dev shell all follow standard patterns. Nice work.
- Use version 0.3.2 to match package.json - Add comment explaining how to update npmDepsHash - Add 'result' symlink to .gitignore
|
Thanks for checking it out! |
theDakshJaitly
left a comment
There was a problem hiding this comment.
All review feedback addressed — version aligned to 0.3.2, npmDepsHash comment added, result in .gitignore. Looks good, thanks @PJalv!
Summary
mexwithout requiringnpxFeatures
buildNpmPackagederivation for the CLIprograms.mex.enable = true)Usage
NixOS Configuration
Ad-hoc Usage
Dev Shell