summaryrefslogtreecommitdiff
path: root/hostnix/elmo
diff options
context:
space:
mode:
authorJoe Mou <dev@mou.fo>2024-02-15 12:38:56 -0500
committerJoe Mou <dev@mou.fo>2024-02-18 06:25:31 -0500
commit174837fe9714ab1bb79c7c6cdd0bd0d4f8586e15 (patch)
tree8b8934a37faf30c5a25e29cdd937ca0e2177f25e /hostnix/elmo
parentc31a6a7761f54cc9ab8c6ce0049571fbaece96e7 (diff)
Boot after power failure (server mode)
Diffstat (limited to 'hostnix/elmo')
-rw-r--r--hostnix/elmo/system.nix13
1 files changed, 12 insertions, 1 deletions
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";
+ };
}