Simplify PWM and i2c loading using nixos-hardware
This commit is contained in:
@@ -30,23 +30,14 @@ in {
|
||||
};
|
||||
|
||||
# Enable SATA HAT
|
||||
systemd.services.sata-hat = let
|
||||
overlay-directory =
|
||||
"/boot/nixos/4mamyanz1hlc4wz3c427qjh6rabngwvj-linux-5.10.17-1.20210303-dtbs/overlays/";
|
||||
in {
|
||||
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"
|
||||
'';
|
||||
preStart = ''
|
||||
${pkgs.libraspberrypi}/bin/dtoverlay -d ${overlay-directory} pwm-2chan pin=12 func=4 pin2=13 func2=4
|
||||
${pkgs.libraspberrypi}/bin/dtoverlay -d ${overlay-directory} w1-gpio
|
||||
${pkgs.bash}/bin/bash -c "/home/coolneng/system/scripts/SATA-hat.sh on"
|
||||
'';
|
||||
preStop = ''
|
||||
${pkgs.libraspberrypi}/bin/dtoverlay -r -d ${overlay-directory} pwm-2chan
|
||||
${pkgs.libraspberrypi}/bin/dtoverlay -r -d ${overlay-directory} w1-gpio
|
||||
${pkgs.bash}/bin/bash -c "/etc/nixos/scripts/SATA-hat.sh off"
|
||||
${pkgs.bash}/bin/bash -c "/home/coolneng/system/scripts/SATA-hat.sh off"
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
|
||||
Reference in New Issue
Block a user