activationScripts: fix error messages which would occur on boot, for scripts which only want to run during upgrades
This commit is contained in:
parent
dfbae7e7b5
commit
e55c264c29
|
@ -94,12 +94,21 @@
|
||||||
text = ''
|
text = ''
|
||||||
# show which packages changed versions or are new/removed in this upgrade
|
# show which packages changed versions or are new/removed in this upgrade
|
||||||
# source: <https://github.com/luishfonseca/dotfiles/blob/32c10e775d9ec7cc55e44592a060c1c9aadf113e/modules/upgrade-diff.nix>
|
# source: <https://github.com/luishfonseca/dotfiles/blob/32c10e775d9ec7cc55e44592a060c1c9aadf113e/modules/upgrade-diff.nix>
|
||||||
${pkgs.nvd}/bin/nvd --nix-bin-dir=${pkgs.nix}/bin diff /run/current-system "$systemConfig"
|
# modified to not error on boot (when /run/current-system doesn't exist)
|
||||||
|
if [ -d /run/current-system ]; then
|
||||||
|
${pkgs.nvd}/bin/nvd --nix-bin-dir=${pkgs.nix}/bin diff /run/current-system "$systemConfig"
|
||||||
|
fi
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
system.activationScripts.notifyActive = {
|
system.activationScripts.notifyActive = {
|
||||||
text = ''
|
text = ''
|
||||||
SWAYSOCK="$(ls /run/user/1000/sway-ipc.1000*.sock)" ${pkgs.sway}/bin/swaymsg -- exec "${pkgs.libnotify}/bin/notify-send 'nixos activated' 'version: $(cat $systemConfig/nixos-version)'"
|
# send a notification to any sway users logged in, that the system has been activated/upgraded.
|
||||||
|
# this probably doesn't work if more than one sway session exists on the system.
|
||||||
|
_notifyActiveSwaySock="$(echo /run/user/*/sway-ipc.*.sock)"
|
||||||
|
if [ -e "$_notifyActiveSwaySock" ]; then
|
||||||
|
SWAYSOCK="$_notifyActiveSwaySock" ${pkgs.sway}/bin/swaymsg -- exec \
|
||||||
|
"${pkgs.libnotify}/bin/notify-send 'nixos activated' 'version: $(cat $systemConfig/nixos-version)'"
|
||||||
|
fi
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user