nixos-config/shared/activation.nix

17 lines
617 B
Nix
Raw Normal View History

2024-03-25 19:06:38 +01:00
{ pkgs, config, ... }:
2023-05-16 09:51:30 +02:00
{
system.activationScripts.report-nixos-changes = ''
2023-07-30 19:41:51 +02:00
if [ -e /run/current-system ] && [ -e $systemConfig ]; then
echo System package diff:
${config.nix.package}/bin/nix store diff-closures /run/current-system $systemConfig || true
fi
2024-03-25 19:06:38 +01:00
NO_FORMAT="\033[0m"
F_BOLD="\033[1m"
C_RED="\033[38;5;9m"
${pkgs.diffutils}/bin/cmp --silent \
2024-03-28 22:09:35 +01:00
<(readlink /run/current-system/{kernel,kernel-modules}) \
<(readlink $systemConfig/{kernel,kernel-modules}) \
2024-03-25 19:06:38 +01:00
|| echo -e "''${F_BOLD}''${C_RED}Kernel version changed, reboot is advised.''${NO_FORMAT}"
2023-05-16 09:51:30 +02:00
'';
}