viperML / nh

Yet another nix cli helper
European Union Public License 1.2
893 stars 35 forks source link

implement `nixos-rebuild list-generations` #121

Open NotAShelf opened 4 months ago

NotAShelf commented 4 months ago

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 commented 4 months ago

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

NotAShelf commented 4 months ago

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 commented 4 months ago

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