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

fix: enable experimental features #43

Merged
merged 2 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
### Fixed
- [#38](https://github.com/tweag/nixtract/pull/38) fixed bug where found derivations were parsed incorrectly
- [#42](https://github.com/tweag/nixtract/pull/42) reintroduced the src field in the derivation description
- [#43](https://github.com/tweag/nixtract/pull/43) enables the `flakes` and `nix-command` features for nix invocations, this avoids users having to have them enabled manually

### Changed
- [#36](https://github.com/tweag/nixtract/pull/36) moved all nixtract configuration options into a single struct passed to the `nixtract` function
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
in
{
defaultPackage = naersk-lib.buildPackage {
pname = "genealogos";
pname = "nixtract";
src = ./.;

# nixtract uses the reqwest crate to query for narinfo on the substituters.
Expand Down
1 change: 1 addition & 0 deletions src/nix/describe_derivation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ pub fn describe_derivation(args: &DescribeDerivationArgs) -> Result<DerivationDe
.arg(format!("lib={}", args.lib.path().to_string_lossy()))
.args(["--json", "--expr", expr])
.arg("--impure")
.args(["--extra-experimental-features", "flakes nix-command"])
Copy link
Member

Choose a reason for hiding this comment

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

By the way, I haven't looked at it, this Rust API for the Nix CLI was presented at NixCon two years ago I believe by Flox. Don't know if it's really helpful here, but I'm mentioning it just in case.

Copy link
Member Author

Choose a reason for hiding this comment

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

It isn't unfortunately! When I started this project, I investigated it, and there was actually a prototype that used it. But I found it not powerful enough to do what we needed to do with it unfortunately.

.envs(env_vars);

// Add --offline if offline is set
Expand Down
1 change: 1 addition & 0 deletions src/nix/find_attribute_paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ pub fn find_attribute_paths(
.arg(format!("lib={}", lib.path().to_string_lossy()))
.args(["--json", "--expr", expr])
.arg("--impure")
.args(["--extra-experimental-features", "flakes nix-command"])
.envs(env_vars);

if *offline {
Expand Down
2 changes: 2 additions & 0 deletions src/nix/substituters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ fn from_flake_ref(flake_ref: &str) -> Result<Substituters> {
let output = std::process::Command::new("nix")
.args(["eval", "--json", "--impure"])
.args(["--expr", &expr])
.args(["--extra-experimental-features", "flakes nix-command"])
.output()?;

let stdout = String::from_utf8_lossy(&output.stdout);
Expand All @@ -35,6 +36,7 @@ fn from_flake_ref(flake_ref: &str) -> Result<Substituters> {
fn from_nix_conf() -> Result<Substituters> {
let output = std::process::Command::new("nix")
.args(["show-config", "--json"])
.args(["--extra-experimental-features", "flakes nix-command"])
.output()?;

let stdout = String::from_utf8_lossy(&output.stdout);
Expand Down
Loading