{ config, lib, pkgs, ... }: { imports = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.initrd.availableKernelModules = [ "uhci_hcd" "ehci_pci" "ata_piix" "usbhid" "usb_storage" "sd_mod" ]; boot.loader.grub = { enable = true; device = "/dev/sda"; }; fileSystems."/" = { device = "/dev/main/nixos"; fsType = "ext4"; }; fileSystems."/home" = { device = "/dev/main/home"; fsType = "ext4"; }; fileSystems."/var/lib" = { device = "/dev/data/data"; fsType = "ext4"; }; powerManagement.cpuFreqGovernor = "ondemand"; services.apcupsd = { enable = true; configText = '' UPSTYPE usb UPSCABLE usb NETSERVER on NISPORT 3551 MINUTES 5 ''; hooks = let # Send notifications on the Maxwell # room when something bad happens. notify = msg: ''${pkgs.maxwell-notify}/bin/notify "UPS: ${msg}"''; in { changeme = notify "sostituire le batterie"; battdetach = notify "batterie disconnesse"; battattach = notify "batterie riconnesse"; commfailure = notify "connessione persa"; commok = notify "connessione ristabilita"; loadlimit = notify "livello batterie critico (5%)"; runlimit = notify "autonomia batterie critico (5min)"; doshutdown = notify "inizio sequenza di spegnimento"; powerout = notify "rete elettrica disconnessa"; mainsback = notify "rete elettrica riconnessa"; onbattery = notify "attivate batterie"; offbattery = notify "disattivate batterie"; emergency = notify "malfunzionamento batterie, possibile spegnimento!"; }; }; services.smartd = let # Send a notification on the Maxwell # when a disk is starting to fail. failHook = with pkgs; writeScript "disk-fail-hook" '' #!/bin/sh ${pkgs.maxwell-notify}/bin/notify \ "SMART: rilevato problema al disco $SMARTD_DEVICESTRING:" ${pkgs.maxwell-notify}/bin/notify "> $SMARTD_MESSAGE" ''; in { enable = true; defaults.monitored = "-a -M exec ${failHook}"; }; }