Skip to content

Conversation

savil
Copy link
Collaborator

@savil savil commented Feb 10, 2023

Summary

If a nix-profile-directory was created for an old nix-env profile, then when
trying to use the new flake-y nix profile with the same directory, an error is
reported.

This PR enables us to toggle DEVBOX_FEATURE_FLAKES= on and off for the same
devbox-projects by inspecting the contents of the profile:

  1. a manifest.nix means that its an old style profile
  2. a manifest.json means that its a new style profile (i.e. to be used with flakes feature)

The code will "reset" i.e. delete the directory and re-create it.

How was it tested?

inserted a print statement prior to os.Remove(dir) in the reset function

> DEVBOX_FEATURE_FLAKES=0 devbox shell

> DEVBOX_FEATURE_FLAKES=1 devbox shell
reset = true

> DEVBOX_FEATURE_FLAKES=0 devbox shell
reset = true

Observe:

  1. no error, we can toggle seamlessly
  2. only one reset = true printed despite multiple calls to devbox.profileDir()

Copy link
Collaborator Author

savil commented Feb 10, 2023

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@savil savil force-pushed the savil/reset-profile-dir branch from bcc19bb to 85142d5 Compare February 10, 2023 05:10
@savil savil merged commit 93a8688 into main Feb 10, 2023
@savil savil deleted the savil/reset-profile-dir branch February 10, 2023 05:13
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