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

internal/nix: support older nix versions in DaemonVersion #2028

Merged
merged 1 commit into from
Apr 27, 2024

Conversation

gcurtis
Copy link
Collaborator

@gcurtis gcurtis commented Apr 26, 2024

To check if nix daemon is running, Devbox runs:

nix store info --json --store daemon

This fails on older versions of Nix for a couple reasons:

  • Before Nix 2.19.0, nix store info was nix store ping.
  • Before Nix 2.14.0, the --json flag wasn't supported.

Check for both of these versions when constructing the nix store command so it works for Nix versions 2.12 - 2.21+.

Also add a nix.VersionInfo.AtLeast method and constants to make checking for supported major Nix versions easier.

Tested by running the nix store commands on all supported Nix versions.

To check if nix daemon is running, Devbox runs:

	nix store info --json --store daemon

This fails on older versions of Nix for a couple reasons:

- Before Nix 2.19.0, `nix store info` was `nix store ping`.
- Before Nix 2.14.0, the `--json` flag wasn't supported.

Check for both of these versions when constructing the `nix store`
command so it works for Nix versions 2.12 - 2.21+.

Also add a `nix.VersionInfo.AtLeast` method and constants to make
checking for supported major Nix versions easier.
@gcurtis gcurtis merged commit 0d3f7f9 into main Apr 27, 2024
24 checks passed
@gcurtis gcurtis deleted the gcurtis/daemon-versions branch April 27, 2024 02:19
Copy link

sentry-io bot commented May 9, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ *Generic Error: <redacted fmt.wrapError>: nix command: /home/velc/.nix-profile/bin/nix --version --debug: <redac... go.jetpack.io/devbox/internal/nix in runNixVersion View Issue

Did you find this useful? React with a 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants