Skip to content

Commit

Permalink
nix_rs: Fix regression while fetching version and config
Browse files Browse the repository at this point in the history
`--accept-flake-config` expects the flake to be already enabled, which
will fail `om health` on systems with flake not enabled.
  • Loading branch information
shivaraj-bh committed Dec 11, 2024
1 parent d25eab3 commit 416c189
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion crates/nix_rs/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ impl NixConfig {
pub async fn get() -> &'static Result<NixConfig, NixConfigError> {
NIX_CONFIG
.get_or_init(|| async {
let mut cmd = NixCmd::default();
let mut cmd = NixCmd {
extra_experimental_features: vec![],
extra_access_tokens: vec![],
refresh: false,
accept_flake_config: false,
};
cmd.with_nix_command(); // Enable nix-command, since don't yet know if it is already enabled.
let nix_ver = NixVersion::get().await.as_ref()?;
let cfg = NixConfig::from_nix(&cmd, nix_ver).await?;
Expand Down
7 changes: 6 additions & 1 deletion crates/nix_rs/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ impl NixVersion {
pub async fn get() -> &'static Result<NixVersion, NixCmdError> {
NIX_VERSION
.get_or_init(|| async {
let cmd = NixCmd::default();
let cmd = NixCmd {
extra_experimental_features: vec![],
extra_access_tokens: vec![],
refresh: false,
accept_flake_config: false,
};
let nix_ver = NixVersion::from_nix(&cmd).await?;
Ok(nix_ver)
})
Expand Down

0 comments on commit 416c189

Please sign in to comment.