murex: initialize gpio

This commit is contained in:
Gabriel Ebner 2019-05-30 16:51:30 +02:00
parent f35353812a
commit c15d04479e

@ -64,7 +64,7 @@
users.extraUsers.gebner = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" "audio" "transmission" ];
extraGroups = [ "wheel" "networkmanager" "audio" "dialout" ];
shell = pkgs.fish;
# password = if config.virtualisation != null then "" else null;
};
@ -135,6 +135,19 @@
})
];
};
systemd.services.setupGpioForRelais = rec {
wantedBy = [ "octoprint.service" ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = "yes";
};
script = ''
if echo 17 > /sys/class/gpio/export; then
echo high > /sys/class/gpio/gpio17/direction
fi
chgrp dialout /sys/class/gpio/gpio17/value
'';
};
users.users.${config.services.octoprint.user}.extraGroups = [
"dialout" # ttyUSB access
];