Skip to content

Replace cargo2nix with Crane and optimize Flake #63

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

Conversation

lafrenierejm
Copy link

Crane obsoletes the need for Cargo.nix by parsing dependencies directly from Cargo.lock and improves build times by building and caching dependencies as their own Nix derivation.

use nix
if command -v nix &>/dev/null; then
use flake
fi
Copy link

Choose a reason for hiding this comment

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

I would think direnv already does the check when setting use flake ?

Copy link
Author

Choose a reason for hiding this comment

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

When I last tested it multiple months ago, direnv would fail if it didn't have the flake module loaded and I omitted the command check. It's definitely possible that has changed in recent versions of direnv, though; feel free to send a link to a changelog entry or commit and I'll gladly simplify this.

inputs.nixpkgs.follows = "nixpkgs";
};
advisory-db = {
url = "github:rustsec/advisory-db";
Copy link

Choose a reason for hiding this comment

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

is that to check for vunerabilities ?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, it provides a way to audit dependencies for vulnerabilities via https://rustsec.org/.

@teto
Copy link

teto commented Nov 21, 2024

I dont know what is the best now for nix + rust. I think I used crane for another package. Per package caching sounds nice, and the removal of Cargo.nix is awesome too. I think I approve but I am not maintainer on the repo.

@teto
Copy link

teto commented Nov 21, 2024

@lafrenierejm would you like to become a maintainer ? maybe @elizagamedev could give you access if positive ?

Crane obsoletes the need for `Cargo.nix` by parsing dependencies directly from
`Cargo.lock` and improves build times by building and caching dependencies as
their own Nix derivation.
@lafrenierejm
Copy link
Author

would you like to become a maintainer ?

@teto I would be glad to help maintain this project. The call is entirely @elizagamedev's, though.

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.

2 participants