jetify-com / devbox

Instant, easy, and predictable development environments
https://www.jetify.com/devbox/
Apache License 2.0
8.28k stars 192 forks source link

[Bug]: When you manually remove a package from the config, devbox doesn't remove the package. #1138

Closed dnkmmr69420 closed 1 year ago

dnkmmr69420 commented 1 year ago

Current Behavior (bug) Devbox will leave a package that has been manually removed from the config. So if I run devbox update, the package is still there even though it is not in devbox.json

Expected Behavior (fix) When I remove a package from the config and run devbox update or devbox install the package should get removed. devbox should see that there is a package in the nix profile but is not in the config so it should remove it.

Additional context Please include the output of devbox version -v and a copy of your devbox.json file.

Info

Version:     0.5.4
Platform:    linux_amd64
Commit:      none
Commit Time: unknown
Go Version:  go1.20.4
Launcher:

JSON

{
  "packages": [
    "hyfetch@latest",
    "htop@latest",
    "pfetch@latest",
    "neofetch@latest",
    "ranger@latest",
    "mc@latest",
    "gnome.gnome-tweaks@latest",
    "btop@latest",
    "vim@latest",
    "trash-cli@latest",
    "stow@latest",
    "kitty@latest",
    "mesa@latest"
  ],
  "shell": {
    "init_hook": [
      "echo 'Welcome to devbox!' > /dev/null",
      "export HOME=\"$HOME/custom-devbox/homedir\""
    ],
    "scripts": {
      "test": [
        "echo \"Error: no test specified\" && exit 1"
      ]
    }
  }
}

Nano still exists in the profile even though it is not there.

When I run nix profile install nixpkgs#nano --profile ~/devboxdir/.devbox/nix/profile/default and I run devbox update package doesn't get removed.

ipince commented 1 year ago

Thank you for filing--taking a look.

dnkmmr69420 commented 1 year ago

Is this bug fixable?

ipince commented 1 year ago

Is this bug fixable?

Sorry for the delay. Yes, it is. It wasn't as simple as I expected, but I have a PR incoming.

mdwn commented 1 year ago

I'm wondering if this fix will solve an issue we've been seeing where the contents of .devbox seems to continue to have an impact on the devbox shell even after a dependency has been removed or changed. Very interested in trying this out!