Remove installed package question

It’s embarrassing that I could not remember how I installed dbeaver package. Then I find dbeaver exists in my personal local file system.


So I try to remove that package.

First I use the command nix-store -q dbeaver, and it returns error: getting status of '/home/john/Downloads/dbeaver': No such file or directory.

Then I search on the internet, checking the installed packages by nix-env --query --installed, which merely returns nix-2.3.15.

Next I try nix-env --uninstall dbeaver under $HOME dir. The command returns

building '/nix/store/dyqh3ka26zbf004h0gw8wv3vfz9nrwf8-user-environment.drv'...
created 6 symlinks in user environment

But then searching with the command sudo find / -name dbeaver. nix replies


The package(?) is still there. In the end I switch to the directory cd /nix/store/vss624qx54x7sw9msllhrz6cp1mqbg72-nixpkgs-21.11pre312229.08ef0f28e3a/nixpkgs/pkgs/applications/misc/

In that directory I execute following command (and below that is the returned message, and eventually the package dbeaver looks like removed.

$ nix-store --delete --ignore-liveness dbeaver
finding garbage collector roots...
removing stale temporary roots file '/nix/var/nix/temproots/33487'
removing stale temporary roots file '/nix/var/nix/temproots/33952'
removing stale temporary roots file '/nix/var/nix/temproots/34191'
deleting '/nix/store/247xhz7m9nbd13q8fmr7qn9rf22rrixc-user-environment.drv'
deleting '/nix/store/nbl19hcn4hdspvg98akxf6xrl6k5wgx3-user-environment'
deleting '/nix/store/kvm5sxi48m164b1s94zdd7jg3navdg9x-env-manifest.nix'
deleting '/nix/store/vss624qx54x7sw9msllhrz6cp1mqbg72-nixpkgs-21.11pre312229.08ef0f28e3a'
deleting '/nix/store/trash'
deleting unused links...
note: currently hard linking saves -0.00 MiB
4 store paths deleted, 88.93 MiB freed

My question. Why do I have to switch to /nix/store/vss624qx54x7sw9msllhrz6cp1mqbg72-nixpkgs-21.11pre312229.08ef0f28e3a/nixpkgs/pkgs/applications/misc/ for removing the installed package? Thanks

This is not something installed and giving you some software, this is your local copy of nixpkgs, containing a folder that contains the buildinstructions for dbeaver.

Also, just because you have something in the store, it doesn’t mean that it is available in your environment.

Just consider the example:

$ find /nix/store -maxdepth 3 -name hello -executable -type f
$ nix-shell -p hello --run hello
these 2 paths will be fetched (0.10 MiB download, 0.47 MiB unpacked):
copying path '/nix/store/5c9ixzdc3yr5yknb9axn2adagpi13m1n-bash-interactive-5.1-p16-dev' from ''...
copying path '/nix/store/g124820p9hlv4lj8qplzxw1c44dxaw1k-hello-2.12' from ''...
Hello, world!
$ find /nix/store -maxdepth 3 -name hello -executable -type f
$ hello
The program 'hello' is not in your PATH. It is provided by several packages.
You can make it available in an ephemeral shell by typing one of the following:
  nix-shell -p hello
  nix-shell -p mbedtls

I could also do a nix-collect-garbage now, which would remove /nix/store/g124820p9hlv4lj8qplzxw1c44dxaw1k-hello-2.12/bin/hello from the store again.