With efi & grub2.
Server (In grub menu 3 entries available):
root@server> nix-env --list-generations
root@server>
Laptop (Only 2 entries found, but in efi menu more than 100 entries exists.
nix-store --gc, nix-collect-garbage -d doesn't clean them...):
root@nixos_laptop> nix-env --list-generations
1 2017-11-05 19:22:24
2 2017-11-06 09:07:46 (current)
root@nixos_laptop> ls /boot/loader/entries/
nixos-generation-216.conf nixos-generation-218.conf nixos-generation-220.conf nixos-generation-222.conf
nixos-generation-217.conf nixos-generation-219.conf nixos-generation-221.conf nixos-generation-223.conf
After nix-collect-garbage -d
and nix-store --gc
(after reboot to new generation) old entries still exist in grub/uefi menu. Why?
Server configuration.nix - https://gist.github.com/MrSorcus/a52ecc23ee126bc847599241f560641b
Laptop configuration.nix - https://gist.github.com/MrSorcus/3aa2f023d580d9a4a54416e917b0e821
nix-install
nixos-version
, Ubuntu/Fedora: lsb_release -a
, ...)nix-env --version
)nix-instantiate --eval '<nixpkgs>' -A lib.nixpkgsVersion
)grep build-use-sandbox /etc/nix/nix.conf
)Did you mean to list system generations?
nix-env --list-generations --profile /nix/var/nix/profiles/system
Maybe. If --profile
required, why in the manual nothing written about that?
Or i can't find it is...
Without --profile
list/rollback/remove generations doesn't work...
But in manual all commands are written without this argument...
People do not tend to manipulate their system profiles with nix-env directly often, I think. Which part of the manual are you referring to?
https://nixos.org/nix/manual/#sec-profiles
https://nixos.org/nix/manual/#operation-list-generations
https://nixos.org/nix/manual/#operation-delete-generations
https://nixos.org/nix/manual/#operation-switch-generation
https://nixos.org/nix/manual/#operation-rollback
The Nix manual doesn't deal with anything related to the system profile, since that's a NixOS-specific thing. Instead, check out the NixOS manual and see if that helps.
Ok. Sorry, but how to delete old generations from uefi|grub?
nix-collect-garbage -d
? Or nix-store --gc
?
With grub2 after using both commands, entries not deleted from grub menu.
nix-collect-garbage -d
or --delete-older-than ...
as root is right. :)
Ok, good. Why old entries still exist in grub/uefi menu? Bug or not?
Have you rebooted into your newest generation before garbage collecting? Otherwise I think the current system will be prevented from being gc'ed.
Yes.
Hmm, not sure what's going on then. Perhaps someone else can weigh in.
@MrSorcus Perhaps you want to alter the issue text to refer to the problem at hand. The current one is a bit misleading. :)
@srhb Now good?
Are you sure you're running it as root? As in, sudo nix-collect-garbage -d
.
root@nixos_laptop> whoami
root
Update.
Looks like that now it's working. But i'm not sure... I will try it later with clean installation.
On a clean installation, everything is just as empty.
nix-env --list-generations
does not show records.
Either the hands are curves, or Nix.
This is a NixOS UX problem.
As a new user to NixOS, Googleing around for "nixos list generations" in order to see what generation I'm currently on leads to results like nix-env --list-generations
which, as mentioned above, doesn't show system generations.
I'm a single user on my system, and using nix-env
to manage packages doesn't seem like a good fit. I just want my system to have whatever I need, and prevent it from writing anything in my home folder.
I think the expectation that new NixOS users have is that nix-env --list-generations
will simply list the system generations, not multi-user generations for the current user.
Maybe the command can be updated to show both, or someting, by default? As an example, the following would actually help new users get an idea of what's going on:
$ nix-env --list-generations
system:
1 2020-01-06 19:08:56
2 2020-01-13 15:46:54
3 2020-01-13 16:34:14
4 2020-01-13 16:48:07
5 2020-01-13 21:19:21
6 2020-01-14 01:18:33 (current)
user:
1 2020-01-07 18:32:25
2 2020-01-13 16:42:23 (current)
When people start using NixOS, they'll start with a configuration.nix
file, and as a result it is intuitive to expect that nix-env --list-generations
shows the system generations because those are what we start with.
I don't think it is likely that people using nix
will start without NixOS (thus not care about the system generations), but I could be wrong.
All in all, as _awesome_ as the Nix system is, the CLIs are confusing to use from a UX perspective, especially for new people.
I agree, there should be something that makes it more obvious for users to discover that nix-env --list-generations --profile /nix/var/nix/profiles/system
is the right thing to use for NixOS generations.
Perhaps we should have nixos-env
that sets the --profile
by default?
It would be helpful if there is a parameter like --list-system-generations
.
Most helpful comment
This is a NixOS UX problem.
As a new user to NixOS, Googleing around for "nixos list generations" in order to see what generation I'm currently on leads to results like
nix-env --list-generations
which, as mentioned above, doesn't show system generations.I'm a single user on my system, and using
nix-env
to manage packages doesn't seem like a good fit. I just want my system to have whatever I need, and prevent it from writing anything in my home folder.I think the expectation that new NixOS users have is that
nix-env --list-generations
will simply list the system generations, not multi-user generations for the current user.Maybe the command can be updated to show both, or someting, by default? As an example, the following would actually help new users get an idea of what's going on:
When people start using NixOS, they'll start with a
configuration.nix
file, and as a result it is intuitive to expect thatnix-env --list-generations
shows the system generations because those are what we start with.I don't think it is likely that people using
nix
will start without NixOS (thus not care about the system generations), but I could be wrong.All in all, as _awesome_ as the Nix system is, the CLIs are confusing to use from a UX perspective, especially for new people.