Skip to content

build: add nix flake #260

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

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

build: add nix flake #260

wants to merge 1 commit into from

Conversation

btraven00
Copy link

Add Nix flake for reproducible builds and easy installation

This commit adds Nix flake support to enable reproducible builds and
simple installation via the Nix package manager. The flake:

  • Configures rust-overlay for consistent Rust toolchain
  • Extracts version automatically from Cargo.toml
  • Enables the "cli" feature required for binary builds
  • Provides a development shell

With this change, users can install or run rv with nix run github:A2-ai/rv
or get a development environment with nix develop.

@btraven00
Copy link
Author

btraven00 commented Jun 4, 2025

hi! I did this mostly as a learning exercise; feel free to close if nix is not a desired distribution or build mechanism. really excited about a sensible package manager for R!

if this is desired for the project, you also might want not to include the lock file I guess.

@dpastoor
Copy link
Member

dpastoor commented Jun 4, 2025

Thanks for the PR! I have less experience with nix flakes but get the appeal of the ecosystem. I will take a look around at some other projects to see what they are doing - if you have other examples that would be great as well. For example i love the atuin toolchain and they have a flake https://github.com/atuinsh/atuin/blob/main/flake.nix + lock. This definitely would be something to add and we very much appreciate the contribution.

Is there anything we can do to test/show some evidence that this runs correctly. Would we also need an rv.nix file?

flake.nix Outdated
description = "A reproducible, fast and declarative package manager for R";
homepage = "https://github.com/A2-ai/rv";
license = licenses.mit;
maintainers = [ maintainers.btraven00 ];
Copy link
Collaborator

Choose a reason for hiding this comment

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

I haven't used Nix in 10 years so i could be completely wrong but should maintainers be defined somewhere first? Where is maintainers.btraven00 coming from

Copy link
Author

Choose a reason for hiding this comment

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

my assumption is that it's referencing the official list coming from the registry of nixpkgs maintainers in pkgs.lib.maintainers. but leaving it blank (since I'm not in that list).

flake.nix Outdated
buildInputs = [
rustToolchain
pkgs.cargo-watch
pkgs.ripgrep
Copy link
Collaborator

Choose a reason for hiding this comment

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

why do we need cargo-watch and ripgrep?

Copy link
Author

@btraven00 btraven00 Jun 4, 2025

Choose a reason for hiding this comment

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

no need for them, sorry. removed - I guess any extra tool useful for daily dev could be placed here if needed

@btraven00
Copy link
Author

btraven00 commented Jun 4, 2025

Is there anything we can do to test/show some evidence that this runs correctly. Would we also need an rv.nix file?

what I was doing for testing is:

nix build -j auto
nix run .# -- --version

afaik flake.nix would be sufficient

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