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

Add Nix flake #245

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

myclevorname
Copy link

Warning: The test options::common::address::tests::resolve_should_properly_resolve_bind_address fails on my system, which is x86_64-unknown-linux-gnu running NixOS.

I turned this into a flake by request of @dgmcguire.

Warning: The test
`options::common::address::tests::resolve_should_properly_resolve_bind_address`
fails on my system, which is x86_64-unknown-linux-gnu running NixOS.
@chipsenkbeil
Copy link
Owner

chipsenkbeil commented Jun 26, 2024

@myclevorname Hi! Thanks for this. I'm aware of Nix and associated software, but no nothing of the flake file and format. Looking through it, there are multiple version references that I'm assuming I would need to maintain?

The version key is set to 0.20.0-unstable. There is no published crate or released binary with that version, so I'm assuming the -unstable is something specially handled by Nix? But that I'd need to update whenever I publish a new release? For an alpha release (not yet published) like 0.21.0-alpha.1, would this become 0.21.0-alpha.1-unstable for Nix?

Separately, I need to now maintain a Cargo hash. I'm not familiar with this based on the lock file. Is it a hash of the lock file itself?

Lastly, there's a list of targets that I'm assuming apply to Nix? Is this supposed to match our full triple target format? Or something specific to Nix? For example, we also offer aarch64 for Linux and support GNU and musl variants of x86 and aarch64 for Linux.


Also, ignore the linting errors. We use the latest Rust release's linter, and I haven't run a PR recently, so there was probably something additional added that I'll need to correct. Once I figure out the above questions, I can merge this in.

@myclevorname
Copy link
Author

The version argument is completely optional, but I added it for some reason. When you update the cargo lockfile and run nix build, Nix will complain about cargoHash being incorrect. Set the value of cargoHash to whatever Nix expected the hash to be.

@chipsenkbeil
Copy link
Owner

The version argument is completely optional, but I added it for some reason.

Wait, so is it purely cosmetic? Just figuring out what I need to set it to, and if the -unstable is needed.

Set the value of cargoHash to whatever Nix expected the hash to be.

@myclevorname okay, so I need to have nix installed to figure out the hash? Thinking through how to automate this since I don't have it installed on any of my machines. Maybe there's a Github action that can run if the lock file changes, calculate the hash, and then use sed or something to update the flake file.

@myclevorname
Copy link
Author

The version argument is only required when making a Nix package. It wasn't as smart idea for me to add it when this is a flake. There may be a Github action that supports Nix, so you may be able to update it using that.

@myclevorname
Copy link
Author

As of right now, I am refactoring the flake to use flake-utils instead of hard-coding the targets in the flake.

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.

None yet

2 participants