opened 11:58AM - 21 Aug 25 UTC
0.kind: bug
### Nixpkgs version
- Unstable (25.11)
### Describe the bug
The output of `ni…xos-rebuild list-generations` shows wrong build dates compared to `nix-env` and the timestamps in `/nix/var/nix/profiles` after using `nix store optimise`.
### Steps to reproduce
- Build a few generations
- Use `nix store optimise`
### Expected behaviour
The output should be consistent regarding the build dates
### Screenshots
_No response_
### Relevant log output
```console
❯ sudo nixos-rebuild list-generations
Generation Build-date NixOS version Kernel Configuration Revision Specialisation Current
169 2025-08-21 13:17:45 25.11.20250819.2007595 6.16.1-cachyos Unknown [] True
168 2025-08-20 20:37:08 25.11.20250819.2007595 6.16.1-cachyos Unknown [] False
167 2025-08-20 20:37:24 25.11.20250819.2007595 6.16.1-cachyos Unknown [] False
166 2025-08-20 20:37:39 25.11.20250814.fbcf476 6.16.1-cachyos Unknown [] False
❯ sudo nix-env --list-generations --profile /nix/var/nix/profiles/system
166 2025-08-19 20:38:05
167 2025-08-20 13:50:53
168 2025-08-20 20:35:22
169 2025-08-21 13:17:46 (current)
❯ sudo ls -l /nix/var/nix/profiles/
total 20
lrwxrwxrwx 1 root root 43 Mai 3 22:05 default -> /nix/var/nix/profiles/per-user/root/profile
drwxr-xr-x 3 root root 4096 Mai 3 14:16 per-user
lrwxrwxrwx 1 root root 15 Aug 21 13:17 system -> system-169-link
lrwxrwxrwx 1 root root 83 Aug 19 20:38 system-166-link -> /nix/store/yxc3hwyz0y07wjs5gp9frdp5kypcdyjg-nixos-system-dan-25.11.20250814.fbcf476
lrwxrwxrwx 1 root root 83 Aug 20 13:50 system-167-link -> /nix/store/rywn7g9vq7j2b0y7a4j8yc2cd62f9r2j-nixos-system-dan-25.11.20250819.2007595
lrwxrwxrwx 1 root root 83 Aug 20 20:35 system-168-link -> /nix/store/lc3zzj2q32ra8nzgw1fhfmq92q52hsic-nixos-system-dan-25.11.20250819.2007595
lrwxrwxrwx 1 root root 83 Aug 21 13:17 system-169-link -> /nix/store/i557rl9y7y7zvbqn9zanw0xxy0vfa4k4-nixos-system-dan-25.11.20250819.2007595
```
### Additional context
_No response_
### System metadata
- system: `"x86_64-linux"`
- host os: `Linux 6.16.1-cachyos, NixOS, 25.11 (Xantusia), 25.11.20250819.2007595`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.28.4`
- channels(root): `""`
- nixpkgs: `/nix/store/pxnx7dbr0pz3qpgw2r315wdbb00afdw7-source`
### Notify maintainers
---
**Note for maintainers:** Please tag this issue in your pull request description. (i.e. `Resolves #ISSUE`.)
### I assert that this issue is relevant for Nixpkgs
- [x] I assert that this is a bug and not a support request.
- [x] I assert that this is not a [duplicate of an existing issue](https://github.com/NixOS/nixpkgs/issues?q=is%3Aopen+is%3Aissue+label%3A%220.kind%3A+bug%22+-label%3A%226.topic%3A+darwin%22+-label%3A%226.topic%3A+nixos%22).
- [x] I assert that I have read the [NixOS Code of Conduct](https://github.com/NixOS/.github/blob/master/CODE_OF_CONDUCT.md) and agree to abide by it.
### Is this issue important to you?
Add a :+1: [reaction] to [issues you find important].
[reaction]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/
[issues you find important]: https://github.com/NixOS/nixpkgs/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc