Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement nixos-rebuild list-generations #121

Open
NotAShelf opened this issue Jun 2, 2024 · 9 comments
Open

implement nixos-rebuild list-generations #121

NotAShelf opened this issue Jun 2, 2024 · 9 comments

Comments

@NotAShelf
Copy link
Contributor

I've recently noticed the list-generations option for nixos-rebuild that outputs a neat table of available generations. Maybe we could implement a nh os generations command as a replacement, that returns similar table of data (+ any other data that we might want) as a formatted table or JSON for parsing purposes.

For reference, here's the example output:

Generation    Build-date           NixOS version                                 Kernel         Configuration Revision  Specialisation
1689 current  2024-06-02 00:20:26  graphical-workstation-24.11.20240527.9ca3f64  6.9.1-xanmod1  dirty                   *
1688          2024-05-31 07:53:58  graphical-workstation-24.11.20240527.9ca3f64  6.9.1-xanmod1  dirty                   *
1687          2024-05-31 07:49:22  graphical-workstation-24.11.20240527.9ca3f64  6.9.1-xanmod1  dirty                   *
1686          2024-05-29 23:45:01  graphical-workstation-24.11.20240527.9ca3f64  6.9.1-xanmod1  dirty                   *
@viperML
Copy link
Owner

viperML commented Jun 2, 2024

Some time ago I planned a nh os info subcommand, perhaps we could show more useful info

@NotAShelf
Copy link
Contributor Author

What else would you like to display? I was going to pick apart the list-generations subcommand, so we can definitely add more data

@viperML
Copy link
Owner

viperML commented Jun 2, 2024

I don't know, that's why I didn't write the command in the end 🤣

Though perhaps closure size (nix path-info -Sh) and nixpkgs commit

@Vortriz
Copy link

Vortriz commented Oct 21, 2024

commenting to refloat this

@viperML viperML closed this as not planned Won't fix, can't repro, duplicate, stale Oct 21, 2024
@NotAShelf
Copy link
Contributor Author

I was working on this :(

@viperML viperML reopened this Oct 21, 2024
@NotAShelf
Copy link
Contributor Author

:)

@Vortriz
Copy link

Vortriz commented Oct 21, 2024

i have some suggestions on what all can be shown upon nh os info:

  • size of nix store (if thats useful)
  • space saved by hardlinking

@NotAShelf
Copy link
Contributor Author

Nix itself (as per my knowledge) does not report either of those stats. I can calculate the size of the Nix store, but there are already better tools (du, dust, etc.) which I am not sure if we should bother wrapping.

@NotAShelf
Copy link
Contributor Author

I've started actually implementing this, as nh os generations. Acts as a convenient alias to nix-env --list-generations or nixos-rebuild list-generations by parsing /nix/var/nix/profiles to discover generations.

Current output:

2649 	2024-12-09 03:38:57	graphical-workstation-25.05.20241205.d0797a0	6.12.3-shelf	7612a7fc-dirty	
2650 	2024-12-10 22:50:12	graphical-workstation-25.05.20241207.22c3f2c	6.12.3-shelf	b2be6825-dirty	
2651 	2024-12-10 23:38:47	graphical-workstation-25.05.20241207.22c3f2c	6.12.4-shelf	b2be6825-dirty	
2652 	2024-12-11 00:37:42	graphical-workstation-25.05.20241207.22c3f2c	6.12.4-shelf	75758fde-dirty	
2653 	2024-12-11 04:47:10	graphical-workstation-25.05.20241209.a73246e	6.12.4-shelf	88d9419	

Not final.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants