mirror of
https://codeberg.org/privacy1st/nix-git
synced 2024-12-25 02:56:05 +01:00
docs: add why-depends
This commit is contained in:
parent
c8acfc6ae6
commit
655ac9e53c
75
NixOS.md
75
NixOS.md
@ -22,6 +22,7 @@ This document contains general notes about NixOS that are independent of my NixO
|
||||
* [List system profiles](#list-system-profiles)
|
||||
* [Garbage collection - Keep most recent X system profiles](#garbage-collection---keep-most-recent-x-system-profiles)
|
||||
* [Garbage collection - Delete system profiles older than X days](#garbage-collection---delete-system-profiles-older-than-x-days)
|
||||
* [why-depends: Why is a package/dependency installed](#why-depends-why-is-a-packagedependency-installed)
|
||||
* [Compare two system profiles](#compare-two-system-profiles)
|
||||
* [NixOS configuration debugging](#nixos-configuration-debugging)
|
||||
* [Show Nix configuration](#show-nix-configuration)
|
||||
@ -465,9 +466,43 @@ runtime dependencies of firefox-121.0.1:
|
||||
|
||||
### List system profiles
|
||||
|
||||
Not sure why 432 is marked as current. It is the default generation that gets activated on next boot. The currently active generation is, however, 429.
|
||||
|
||||
```shell
|
||||
sudo nix-env --list-generations --profile /nix/var/nix/profiles/system
|
||||
```
|
||||
```console
|
||||
...
|
||||
428 2024-03-06 12:37:56
|
||||
429 2024-03-07 11:27:20
|
||||
430 2024-03-10 12:48:34
|
||||
431 2024-03-11 11:18:57
|
||||
432 2024-03-12 22:19:53 (current)
|
||||
```
|
||||
|
||||
```shell
|
||||
ls -l /nix/var/nix/profiles/
|
||||
```
|
||||
```console
|
||||
lrwxrwxrwx 1 root root 43 Dez 14 12:21 default -> /nix/var/nix/profiles/per-user/root/profile
|
||||
drwxr-xr-x 1 root root 16 Sep 1 2023 per-user
|
||||
lrwxrwxrwx 1 root root 15 Mär 12 22:19 system -> system-432-link
|
||||
...
|
||||
lrwxrwxrwx 1 root root 77 Mär 6 12:37 system-428-link -> /nix/store/damngdyial0i96xa46csdqk36j2njavi-nixos-system-yodaTux-23.11pre-git
|
||||
lrwxrwxrwx 1 root root 77 Mär 7 11:27 system-429-link -> /nix/store/k7c7576sz868gzjci1z6l6nzmdnpd6xr-nixos-system-yodaTux-23.11pre-git
|
||||
lrwxrwxrwx 1 root root 77 Mär 10 12:48 system-430-link -> /nix/store/7468m7rgk425kb23aq222a498ynfqdkc-nixos-system-yodaTux-23.11pre-git
|
||||
lrwxrwxrwx 1 root root 77 Mär 11 11:18 system-431-link -> /nix/store/r51yw36ddfxq8hdsz2mm6axpbqvjaigy-nixos-system-yodaTux-23.11pre-git
|
||||
lrwxrwxrwx 1 root root 77 Mär 12 22:19 system-432-link -> /nix/store/i9pxh3ax6m0yr7xlk7y7c5xdzp74xqi4-nixos-system-yodaTux-23.11pre-git
|
||||
```
|
||||
|
||||
The currently running system. This is the currently active generation. By comparing the store path with the above output, we see that it matches generation 429.
|
||||
|
||||
```shell
|
||||
ls -l /run/current-system
|
||||
```
|
||||
```console
|
||||
lrwxrwxrwx 1 root root 77 Mär 9 12:44 /run/current-system -> /nix/store/k7c7576sz868gzjci1z6l6nzmdnpd6xr-nixos-system-yodaTux-23.11pre-git
|
||||
```
|
||||
|
||||
### Garbage collection - Keep most recent X system profiles
|
||||
|
||||
@ -496,6 +531,46 @@ Remove leftover EFI entries of removed generations:
|
||||
sudo /run/current-system/bin/switch-to-configuration boot
|
||||
```
|
||||
|
||||
### why-depends: Why is a package/dependency installed
|
||||
|
||||
Usage of `why-depends`: https://github.com/tldr-pages/tldr/blob/f952fc71c2587fa13207aee278eb8795af913438/pages/common/nix3-why-depends.md
|
||||
|
||||
Show why the currently running NixOS system requires a certain store path.
|
||||
|
||||
- Example: Why is one store path required.
|
||||
|
||||
```shell
|
||||
nix --extra-experimental-features flakes --extra-experimental-features nix-command why-depends /run/current-system /nix/store/mzx8sgjkw7x2p9alq6cgz0vcdzaqz188-openssh-9.6p1
|
||||
```
|
||||
```console
|
||||
/nix/store/k7c7576sz868gzjci1z6l6nzmdnpd6xr-nixos-system-yodaTux-23.11pre-git
|
||||
└───/nix/store/b9mbk3jvazblxfma5p2yvc9xlmvrqxx7-etc
|
||||
└───/nix/store/mzx8sgjkw7x2p9alq6cgz0vcdzaqz188-openssh-9.6p1
|
||||
```
|
||||
|
||||
- Example: Why are any of the `ffmpeg-headless` store paths currently required?
|
||||
|
||||
```shell
|
||||
for i in /nix/store/*ffmpeg-headless-*; do
|
||||
env PAGER=cat nix --extra-experimental-features flakes --extra-experimental-features nix-command why-depends /run/current-system "$i" 2>/dev/null
|
||||
done;
|
||||
```
|
||||
```console
|
||||
/nix/store/k7c7576sz868gzjci1z6l6nzmdnpd6xr-nixos-system-yodaTux-23.11pre-git
|
||||
└───/nix/store/b9mbk3jvazblxfma5p2yvc9xlmvrqxx7-etc
|
||||
└───/nix/store/snva91gl7hlm0fsf5mg5k0prv8mwnhcv-pipewire-1.0.1
|
||||
└───/nix/store/jqlvhb8jfz43vkl14wsm88h6csmx8aia-ffmpeg-headless-6.0-lib
|
||||
/nix/store/k7c7576sz868gzjci1z6l6nzmdnpd6xr-nixos-system-yodaTux-23.11pre-git
|
||||
└───/nix/store/b9mbk3jvazblxfma5p2yvc9xlmvrqxx7-etc
|
||||
└───/nix/store/nhypp8f5h0xv9ar9wzbp12hzyg1vah1a-user-environment
|
||||
└───/nix/store/0df15gc1a4s98n961vdd2j1pkkckn901-resources-1.3.0
|
||||
└───/nix/store/f61vlw8ampb5nh25kvs9p7rbi3cclcr4-gtk4-4.12.5
|
||||
└───/nix/store/5r52pj0fj3b06r0qgglasfmqmsfh315q-gst-plugins-bad-1.22.9
|
||||
└───/nix/store/dsdfn1k9hnxzdwvzirx2smfinziqc8bz-openal-soft-1.23.1
|
||||
└───/nix/store/ci4z4i38d7akpi5fqcdr2nvd1sr30l3i-pipewire-1.0.3
|
||||
└───/nix/store/rpnsg493xz3fjhfrlc3ifz2ln65kmi8q-ffmpeg-headless-6.1-lib
|
||||
...
|
||||
```
|
||||
|
||||
### Compare two system profiles
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user