From c15d04479e423d40161f1926790fe8707edcf42e Mon Sep 17 00:00:00 2001 From: Gabriel Ebner Date: Thu, 30 May 2019 16:51:30 +0200 Subject: [PATCH] murex: initialize gpio --- murex.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/murex.nix b/murex.nix index ad75308..f5c5e69 100644 --- a/murex.nix +++ b/murex.nix @@ -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 ];