{ config, pkgs, ... }: { boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; boot.tmp.useTmpfs = true; time.timeZone = "America/New_York"; networking.hostName = "elmo"; networking.domain = "mou.fo"; # TODO switch to networkd networking.networkmanager.enable = true; # Temp addresses are preferred for IPv6 source address selection (RFC 6724), # which complicates dynamic DNS. networking.tempAddresses = "disabled"; services.avahi = { enable = true; nssmdns = true; publish = { enable = true; addresses = true; }; }; # https://github.com/NixOS/nixpkgs/issues/54707#issuecomment-1132907191 systemd.services.nix-daemon = { environment.TMPDIR = "/var/tmp"; }; # https://nixos.wiki/wiki/Hardware/Apple#Auto_Restart systemd.services.enable-autorestart = { description = "Boot after power failure (server mode)"; wantedBy = [ "multi-user.target" ]; serviceConfig = { Type = "oneshot"; }; # https://superuser.com/a/1051137 script = "${pkgs.pciutils}/bin/setpci -s 00:1f.0 0xa4.b=0"; }; systemd.services.boot-email = { description = "Boot email"; wantedBy = [ "multi-user.target" ]; serviceConfig = { Type = "oneshot"; }; script = '' echo -e "Subject: ${config.networking.fqdn} restarted\n\n$(date)" | /run/wrappers/bin/sendmail root ''; }; # https://wiki.archlinux.org/index.php/Systemd/Timers#MAILTO systemd.services."status-email@" = { description = "Status email for %i"; unitConfig = { # Throttle notifications to twice daily. StartLimitIntervalSec = "12hr"; StartLimitBurst = "1"; }; serviceConfig = { Type = "oneshot"; }; scriptArgs = "%i"; script = '' /run/wrappers/bin/sendmail root < Subject: $1 status Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 $(systemctl status --full "$1") EOF ''; }; }