From 174837fe9714ab1bb79c7c6cdd0bd0d4f8586e15 Mon Sep 17 00:00:00 2001 From: Joe Mou Date: Thu, 15 Feb 2024 12:38:56 -0500 Subject: Boot after power failure (server mode) --- hostnix/elmo/system.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'hostnix/elmo') diff --git a/hostnix/elmo/system.nix b/hostnix/elmo/system.nix index d92de59..311338f 100644 --- a/hostnix/elmo/system.nix +++ b/hostnix/elmo/system.nix @@ -1,4 +1,4 @@ -{ ... }: +{ pkgs, ... }: { boot.loader.systemd-boot.enable = true; @@ -10,4 +10,15 @@ networking.networkmanager.enable = true; time.timeZone = "America/New_York"; + + # https://nixos.wiki/wiki/Hardware/Apple#Auto_Restart + systemd.services.enable-autorestart = { + description = "Boot after power failure (server mode)"; + wantedBy = [ "default.target" ]; + serviceConfig = { + Type = "oneshot"; + }; + # https://superuser.com/a/1051137 + script = "${pkgs.pciutils}/bin/setpci -s 00:1f.0 0xa4.b=0"; + }; } -- cgit v1.3.1