From 4f5148fbf4a1f96995b6880ae6a8285aada6ecc9 Mon Sep 17 00:00:00 2001 From: Fugi Date: Thu, 29 Feb 2024 12:03:02 +0100 Subject: [PATCH] Show warning when kernel version changes --- modules/base.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/base.nix b/modules/base.nix index 35d77e3..3302201 100755 --- a/modules/base.nix +++ b/modules/base.nix @@ -11,6 +11,14 @@ echo System package diff: ${config.nix.package}/bin/nix store diff-closures /run/current-system $systemConfig || true fi + + NO_FORMAT="\033[0m" + F_BOLD="\033[1m" + C_RED="\033[38;5;9m" + ${pkgs.diffutils}/bin/cmp --silent \ + <(readlink /run/booted-system/{initrd,kernel,kernel-modules}) \ + <(readlink /run/current-system/{initrd,kernel,kernel-modules}) \ + || echo -e "''${F_BOLD}''${C_RED}Kernel version changed, reboot is advised.''${NO_FORMAT}" ''; # Select internationalisation properties.