vibed improved gc
This commit is contained in:
parent
a79ca6a399
commit
9cb871275a
5 changed files with 208 additions and 4 deletions
|
|
@ -1,4 +1,12 @@
|
|||
{ pkgs, pkgs-unstable, ... }:
|
||||
{ pkgs, pkgs-unstable, lib, ... }:
|
||||
let
|
||||
commands = import ../../../lib/commands.nix { inherit pkgs; };
|
||||
systemNotify = commands."system-notify";
|
||||
notify = urgency: title: body:
|
||||
"${systemNotify} ${lib.escapeShellArgs [ urgency title body ]}";
|
||||
notifyFailure = title: service:
|
||||
"${systemNotify} ${lib.escapeShellArgs [ "critical" title ]} \"${service} ended with: $SERVICE_RESULT\"";
|
||||
in
|
||||
{
|
||||
boot = {
|
||||
plymouth = {
|
||||
|
|
@ -53,6 +61,34 @@
|
|||
8888
|
||||
];
|
||||
|
||||
systemd.services = {
|
||||
nixos-upgrade = {
|
||||
preStart = lib.mkBefore ''
|
||||
${notify "normal" "System update started" "Updating flake inputs and preparing the NixOS switch."}
|
||||
'';
|
||||
postStop = ''
|
||||
if [ "$SERVICE_RESULT" = "success" ]; then
|
||||
${notify "normal" "System update finished" "The automated NixOS update completed successfully."}
|
||||
else
|
||||
${notifyFailure "System update failed" "nixos-upgrade.service"}
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
nix-gc = {
|
||||
preStart = ''
|
||||
${notify "normal" "Garbage collection started" "Cleaning old Nix generations and unreferenced store paths."}
|
||||
'';
|
||||
postStop = ''
|
||||
if [ "$SERVICE_RESULT" = "success" ]; then
|
||||
${notify "normal" "Garbage collection finished" "Nix store garbage collection completed successfully."}
|
||||
else
|
||||
${notifyFailure "Garbage collection failed" "nix-gc.service"}
|
||||
fi
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
environment = {
|
||||
systemPackages = [
|
||||
pkgs-unstable.discord
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue