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

Added flake.nix #3

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open

Added flake.nix #3

wants to merge 1 commit into from

Conversation

YPares
Copy link

@YPares YPares commented Nov 12, 2024

This adds a flake.nix file so jj-fzf can be installed with its deps with Nix, just like jj.

It uses jj v0.23.0 from nixpkgs.

@tim-janik
Copy link
Owner

Thanks for the submission.

I am not familiar with nix packaging, so I have a couple questions:

  • Where is the dependency on jj-0.23.0 in there, and the fzf version dependency?
  • Shouldn't it depend on gnu-sed as well? (MacOS users need that)
  • Does it have to add files in the root directory of the project?
  • Why is the lock file needed? (With npm, I have had the experience that adding a lock file is usually a bad idea)
  • Is there a spec somewhere for flake.nix where I can read up on the details of the format (and possibly answer some of the above questions)?

@YPares
Copy link
Author

YPares commented Nov 12, 2024

So all the deps are provided by nixpkgs, which is itself pinned by the flake.lock (that's why it is meant to be committed. nix flakes have no need for version boundaries: everything is pinned by default). The current nixpkgs provide jj-0.23.0 and fzf-0.56.0, that's why you need nothing more. nix flake update --refresh would be the command to update the lockfile (possibly when a new jj or fzf version gets released on nixpkgs). But as long as you don't explicitly update it yourself, downstream users will always be installing a jj-fzf that uses jj 0.23.0 and fzf 0.56.0.

Yeah, the flake.nix should usually be put at the top-level.

Good point about gnu-sed, I'm adding it. Though I'll be unable to test on MacOS

Re. a starting point, I think https://zero-to-nix.com/concepts/flakes is nice.

Since https://github.com/martinvonz/jj is also packaged with a flake.nix, there could also be the option of depending on a dev version of jj (which would be locked & updated in the same way) if you instead want dev versions of jj-fzf to remain more in sync with bleeding-edge jj.

Also, once your project is packaged with a flake, CI/CD comes for free with for instance https://garnix.io/ (with no need for extra config files)

@emilazy
Copy link

emilazy commented Nov 14, 2024

There is a work‐in‐progress Nixpkgs PR for jj-fzf at NixOS/nixpkgs#353879. It might be good to coordinate, e.g. to use the same package definition so that the flake and Nixpkgs package work the same way.

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

Successfully merging this pull request may close these issues.

3 participants