| .forgejo/workflows | ||
| .editorconfig | ||
| .envrc | ||
| .gitignore | ||
| .golangci.yml | ||
| .goreleaser.yaml | ||
| compare.go | ||
| flake.lock | ||
| flake.nix | ||
| go.mod | ||
| justfile | ||
| LICENSE | ||
| main.go | ||
| README.md | ||
nixos-needsreboot
Checks if you should reboot your NixOS ️❄️ machine in case an upgrade brought in a new kernel.
This project is forked from https://github.com/wimpysworld/nixos-needsreboot/, which was forked from https://codeberg.org/Mynacol/nixos-needsreboot, which was forked from https://github.com/thefossguy/nixos-needsreboot.
This version is written in golang (just because that's what I know and love). It includes some cosmetic changes, and a prometheus node_exporter textfile compatible output printer using the --textfile flag.
Usage as a flake
Add nixos-needsreboot to your flake.nix:
{
inputs.nixos-needsreboot.url = "https://git.dotcircle.dev/dotcircle/nixos-needsreboot/archive/main.tar.gz";
outputs = { self, nixos-needsreboot }: {
# Use in your outputs
};
}
Usage
Check if the currently active system needs a reboot
nixos-needsreboot
Check a different system if it would require a reboot
nixos-needsreboot [/path/to/different-system]
Print the programs version
nixos-needsreboot --version
Output formatted for prometheus node_exporter textfile exporter
nixos-needsreboot --textfile
Output formatted for prometheus node_exporter textfile exporter for a different system
nixos-needsreboot --textfile [/path/to/different-system]
Test during NixOS system activation
system.activationScripts = {
nixos-needsreboot = {
supportsDryActivation = true;
text = "${lib.getExe nixos-needsreboot.packages.${pkgs.system}.default} \"$systemConfig\" || true";
};
};