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

[nix profile] Changes to support format changes from nix 2.20 #1770

Merged
merged 3 commits into from
Feb 1, 2024

Conversation

savil
Copy link
Collaborator

@savil savil commented Feb 1, 2024

Summary

The latest nix version (2.20) changed how the nix profile output is represented:

From the release notes:

nix profile now allows referring to elements by human-readable names NixOS/nix#8678

nix profile now uses names to refer to installed packages when running list, remove or upgrade as opposed to indices. Profile element names are generated when a package is installed and remain the same until the package is removed.

Warning: The manifest.nix file used to record the contents of profiles has changed. Nix will automatically upgrade profiles to the new version when you modify the profile. After that, the profile can no longer be used by older versions of Nix.

and for nix search:

Disallow empty search regex in nix search #9481

nix search now requires a search regex to be passed. To show all packages, use ^.

TODOs:

  • update nix.readManifest to handle the new format
  • nix search requires a regex to be passed
  • manually test on nix < 2.20 on devbox.sh to verify the older nix still works

Fixes #1767

How was it tested?

CICD should pass

Installed nix 2.20.1 locally and am using Devbox with it to add, remove packages and run scripts and shell.

verified flake updating works:

  1. examples/flakes/remote. Did devbox shell, dropped the v0.43.1 from process-compose flake, did devbox update, and verified that process-compose now had the latest version (IIRC 0.80+)
  2. examples/flakes/php. Did devbox shell, edited the flake to drop ds and did devbox update. Verified no ds in php -m | grep ds

Copy link
Collaborator Author

savil commented Feb 1, 2024

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

@savil savil force-pushed the savil/profile-list-for-nix-2-20 branch from 3d8613f to 7674d3d Compare February 1, 2024 02:16
@savil savil force-pushed the savil/profile-list-for-nix-2-20 branch 2 times, most recently from 6eea75d to bad3e85 Compare February 1, 2024 13:31
@savil savil force-pushed the savil/profile-list-for-nix-2-20 branch from bad3e85 to c5092c5 Compare February 1, 2024 13:41
internal/nix/nixprofile/profile.go Outdated Show resolved Hide resolved
index: 2,
unlockedReference: "github:NixOS/nixpkgs/52e3e80afff4b16ccb7c52e9f0f5220552f03d04#legacyPackages.x86_64-darwin.python39Packages.numpy",
lockedReference: "github:NixOS/nixpkgs/52e3e80afff4b16ccb7c52e9f0f5220552f03d04#legacyPackages.x86_64-darwin.python39Packages.numpy",
nixStorePaths: []string{"/nix/store/qly36iy1p4q1h5p4rcbvsn3ll0zsd9pd-python3.9-numpy-1.23.3"},
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

should add a test-case with name: field

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

actually, this test is for legacy nix profile list parsing. Not the modern --json output. Renamed to clarify.

@savil savil requested a review from mikeland73 February 1, 2024 15:28
@savil savil marked this pull request as ready for review February 1, 2024 15:28
@savil savil merged commit 67f4f9f into main Feb 1, 2024
27 of 32 checks passed
@savil savil deleted the savil/profile-list-for-nix-2-20 branch February 1, 2024 19:15
github-merge-queue bot pushed a commit to jetify-com/devbox-install-action that referenced this pull request Mar 4, 2024
upgrade devbox cli test to use version 0.9.1, which addresses a nix
output change in version 2.20. Corresponding Devbox PR
jetify-com/devbox#1770
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.

Failing to add packages due to Go unmarshalling error
2 participants