1

I use NixOS:

$ nixos-version 
16.03pre71289.7ae05ed (Emu)
$ nix-env --version
nix-env (Nix) 1.10
$ nix-channel --list

$ sudo nix-channel --list
nixos https://nixos.org/channels/nixos-unstable

Installing something through nix-env outputs information, like:

$ nix-env -i rogue
installing ‘rogue-5.4.4’
these paths will be fetched (0.09 MiB download, 0.28 MiB unpacked):
  /nix/store/rvkjrq24fy510m9dwd12lhry1zkx57iy-rogue-5.4.4
fetching path ‘/nix/store/rvkjrq24fy510m9dwd12lhry1zkx57iy-rogue-5.4.4’...

*** Downloading ‘https://cache.nixos.org/nar/0jpxvn40r27zz9pz54kvfrsy2lwafysbpr6pkhkafizzxqgb2a0c.nar.xz’ (signed by ‘cache.nixos.org-1’) to ‘/nix/store/rvkjrq24fy510m9dwd12lhry1zkx57iy-rogue-5.4.4’...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 95184  100 95184    0     0   104k      0 --:--:-- --:--:-- --:--:--  104k

building path(s) ‘/nix/store/y8z7yi655sslnmx4b7zb1vaqp49ac8i6-user-environment’
created 839 symlinks in user environment

Reading Nix manual suggested nix-store command, but I'm not sure how to use it.

How do I view logs of what I ever installed through nix-env? How do I view logs of what I ever installed through sudo nixos-rebuild switch?

4

As far as I can tell nix has no log. I'm guessing the reason for excluding this feature of every-other-package-manager-ever is that nixos is declarative rather than imperative, so the process it went through to get your system from one state to another should be irrelevant.

Which brings us to what I suspect you really want to know: How can I compare the current generation with the last?

I've found nixos-scripts' diff-generations command very helpful for this. For instance, if you're on generation 115, you can get a diff of installed packages with:

nix-script diff-generations -s -n 114..115

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.