Is it possible to squash builds or give custom names for grub entries?

Hi!

I’m new on the nixos ecosystem and I realized that I generate around 7 to 8 entries on the bootloader. I believe those are the “versions” of OS generated by the nixos-rebuild command. Right?

Anyway. I do believe that would all those entries could be more or less squashed since all the packages and changes done did not broken my installation.

So the question is: Can we squash those builds? If not can we sort of “remove X version and rebuild” ?

If none of the above are viable or advised is it possible to at least tag the build with a more meaningful message (like a commit message)?

Besides that everything else worked out of the box. Distro is smooth and responsive. Outstanding work!

The term is “generation”. Each is the result of running nixos-rebuild boot/switch. They’re useful for recovery in case your most recent build cannot boot properly anymore - then you can just switch to an older one that you know still worked.

You can just delete all but the most recent one with sudo nix-collect-garbage -d. That command has some options to limit the removal to specific dates and suchlike if you want to keep some generations around.

You can’t “squash” them like with git - nix generations have nothing to do with git commits, they’re not diffs of one another or anything. Nix can keep all of them maintained independently (though they will share some paths in /nix/store, nix can just choose not to delete any paths that are still needed by generations that won’t be deleted).

If you don’t want to be forced to manually clean your boot entries, you can use your boot loaders’ configurationLimit, but you will still need to collect garbage (though you can skip -d) to actually delete the underlying files on disk.

I don’t think you can easily name generations and have them show up that way in the boot loader, but it’s probably possible if you build a generation, make a garbage collector root for it, and manually create a boot loader entry.

Thank your for the explanation :slight_smile: