(I think that, depending on how your mounts/subvolumes are set up, you may need to add a line for "/nix/store".)
This configuration will get added to the configuration declared in the auto-generated hardware-configuration.nix; I believe that the compress option will be added to that file’s options list(s) when merging, as opposed to replacing it.
To actually compress what’s already in, for example, /nix/store:
Note existing usage and compression with:
# btrfs filesystem show /nix/store
# compsize -x /nix/store
(From comments near the end of the discussion on this issue.)
Check new usage and compression with the commands from step 1.
KDE Partition Manager doesn’t seem to work for me in 22.11, either. The window and its UI loads, but everything is grayed out.
Apologies if reviving old threads is frowned upon here. I thought I’d add what I’ve learned so far on this as there were no other answers, and this is one of only two search results I got for my query on defragmenting/compressing here at the forum.
It’s typically enough to enable compression on your /nix/store mount (or its parent, i.e. /) and then just leave it be.
After the next staging-next merge (happens every ~2w), you’ll likely have to download your entire closure again which will be written compressed and after a gc the old uncompressed paths will be gone.
No need to mount the store read-write.
If you do need to compress it immediately though, you should simply mount the subvol containing the Nix store again somewhere else (i.e. mount mount /dev/foo -o subvol=nix /mnt/) and run defrag against the new mount. This prevents issues of bad apps (incompetent or malicious) writing to /nix during the timeframe it’d be rw otherwise.
Happens every now and then, especially when an OpenSSL patch is required
I’d also say: Just enable it, and wait for paths to be compressed as they come in.
If you are still on 22.11 most of you closure will change when moving to 23.05.