Initialize the SATA HAT on startup

This commit is contained in:
2021-05-15 16:51:46 +02:00
parent 8392ac213b
commit 57f5952f8a
3 changed files with 74 additions and 1 deletions

View File

@@ -28,7 +28,22 @@ in {
startAt = "02:00:00";
};
wantedBy = [ "default.target" ];
# Enable SATA HAT
systemd.services.sata-hat = {
description = "Enable software support for SATA Hat";
wantedBy = [ "zfs-import.target" ];
script = ''
${pkgs.bash}/bin/bash -c "/etc/nixos/scripts/SATA-hat.sh on"
'';
serviceConfig = {
Type = "oneshot";
RemainAfterExit = "yes";
ExecStop = ''
${pkgs.bash}/bin/bash -c "/etc/nixos/scripts/SATA-hat.sh off"
'';
};
before = [ "zfs-import.target" "zfs-import-vault.service" ];
requires = [ "systemd-udev-settle.service" ];
after = [ "systemd-udev-settle.service" ];
};
}