Determine if you need to reboot ️♻️ your NixOS machine ️❄️
Find a file
Stijn Vermeiren 63ea5cc807
All checks were successful
Build / build (aarch64) (push) Successful in 2m10s
Build / build (x86_64) (push) Successful in 1m26s
Lint / lint (push) Successful in 1m31s
Build / publish (push) Successful in 1m6s
feat: reduce go requirement to g1.24
2025-09-16 22:15:40 +02:00
.forgejo/workflows feat: refactor to golang, because that's what I know 2025-09-16 22:08:48 +02:00
.editorconfig feat: refactor to golang, because that's what I know 2025-09-16 22:08:48 +02:00
.envrc init commit: 0.1.0 2024-03-04 22:31:23 +05:30
.gitignore feat: refactor to golang, because that's what I know 2025-09-16 22:08:48 +02:00
.golangci.yml feat: refactor to golang, because that's what I know 2025-09-16 22:08:48 +02:00
.goreleaser.yaml feat: refactor to golang, because that's what I know 2025-09-16 22:08:48 +02:00
compare.go feat: refactor to golang, because that's what I know 2025-09-16 22:08:48 +02:00
flake.lock feat: refactor to golang, because that's what I know 2025-09-16 22:08:48 +02:00
flake.nix feat: refactor to golang, because that's what I know 2025-09-16 22:08:48 +02:00
go.mod feat: reduce go requirement to g1.24 2025-09-16 22:15:40 +02:00
justfile feat: refactor to golang, because that's what I know 2025-09-16 22:08:48 +02:00
LICENSE Clarify license 2024-05-05 18:30:22 +02:00
main.go feat: refactor to golang, because that's what I know 2025-09-16 22:08:48 +02:00
README.md feat: refactor to golang, because that's what I know 2025-09-16 22:08:48 +02:00

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";
    };
  };