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

Unable to remove GUI applications from /nix/store using garbage collection #1161

Open
ryullulala opened this issue Nov 10, 2024 · 4 comments

Comments

@ryullulala
Copy link

Description

I attempted to clean up /nix/store using both sudo nix-collect-garbage -d and nix-collect-garbage, but certain packages remain undeleted. The persistent packages are GUI applications such as Alacritty, Arc-Browser, Google Chrome...

Steps Taken

  1. Removed the applications from Nix configuration and ran darwin-rebuild switch
  2. sudo nix-collect-garbage -d
  3. nix-collect-garbage
  4. ls -la | grep "arc-browser"
    image

Expected Behavior

The garbage collection commands should remove unused packages from /nix/store

Question

What is the proper way to remove these GUI applications from /nix/store?

@x6ufeng
Copy link

x6ufeng commented Nov 17, 2024

Well, as far as I know, the gui apps may need a reboot to finish the removal.

@ryullulala
Copy link
Author

Well, as far as I know, the gui apps may need a reboot to finish the removal.

I've tried multiple times but it's not disappearing at all.

@DontEatOreo
Copy link

Usually when I run nix-collect-garabage -d I will run into an error like this:

deleting '/nix/store/1zdm48k9nv0sf4n5qmipfj1z5zwwyzxc-discord-0.0.324'
0 store paths deleted, 0.00 MiB freed
error: chmod '"/nix/store/1zdm48k9nv0sf4n5qmipfj1z5zwwyzxc-discord-0.0.324/Applications/Discord.app"': Operation not permitted

I get around it by just doing sudo nix store delete /nix/path/to/program

e.g:

$ sudo nix store delete /nix/store/1zdm48k9nv0sf4n5qmipfj1z5zwwyzxc-discord-0.0.324/Applications/Discord.app/
  /nix/store/1zdm48k9nv0sf4n5qmipfj1z5zwwyzxc-discord-0.0.324
[0.0 MiB DL]1 store paths deleted, 417.82 MiB freed

@maxRN
Copy link

maxRN commented Dec 10, 2024

I solved it by running nix-collect-garbage -d (NOTE: not running as root)
and then running sudo nix-collect-garbage --delete-older-than 5d (adjust the days as necessary).
The first step deletes old home-manager generations which keep these packages from being removed.

There is currently a "bug" which prevents nix from deleting old generations when running as root, see NixOS/nix#8508 and https://discourse.nixos.org/t/home-manager-and-garbage-collection/41715

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

No branches or pull requests

4 participants