-
-
Notifications
You must be signed in to change notification settings - Fork 96
feat: package with nix flake #1847
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
base: master
Are you sure you want to change the base?
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi @alinarielle, thank you for this. I am not too familiar with how nix flakes are used and would need your help here |
dtomvan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alinarielle thanks for this contribution! Looking good so far!
@cpvalente A Nix flake makes it easy to install (and with a nixos module in it, configure) some 3rd-party software. The idea is that I declare github:cpvalente/ontime as an input to my own flake with my NixOS configurations in it, and use the provided package definition to install it on my system.
Copyparty does it similarly. Their documentation has a concrete example on how users can make use of the flake if they so desire: https://github.com/9001/copyparty/blob/e9ab040ce8e72e299a3d8fbd109865b1e218eb57/README.md#nixos-module
We could also try to get this into Nixpkgs to make it even more widely available...
| }: | ||
| { | ||
| formatter = pkgs.nixfmt-tree; | ||
| packages.default = pkgs.callPackage ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd do callPackage ./package.nix {} and put the package in there, because better seperation of concerns and compatibility with non-flake nix (provided you also create a default.nix that also callPackages)
| outputs = | ||
| inputs@{ flake-parts, ... }: | ||
| flake-parts.lib.mkFlake { inherit inputs; } { | ||
| systems = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use https://github.com/nix-systems so the systems can be overidden by consumers of the flake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nit) I've seen complaints with envrcs being enforced like this (what if you want to, even slightly, modify the environment). It's probably better to allow people to choose what they want in their direnvs, and actually gitignore it.
(while you're at it, because of nix-direnv it might be smart to also gitignore result and .direnv)
|
|
||
| inputs = { | ||
| flake-parts.url = "github:hercules-ci/flake-parts"; | ||
| nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nit) technically this can just be on tbe nixpkgs-unstable channel since we're not instantiating NixOS configs in this flake. Doesn't matter much though as nixos-unstable only lags behind a couple days due to it having a bit more CI checks and builds.
| packages.default = pkgs.callPackage ( | ||
| { | ||
| stdenv, | ||
| nodejs, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nit) Might be best to pin nodejs_22 and pnpm_10 to match the expected engines in the package.json...
|
Hi @dtomvan It seems like you have a good grasp on practices and expected outcomes. |
No description provided.