diff --git a/murex.nix b/murex.nix index ea4df3b..7aea3a2 100644 --- a/murex.nix +++ b/murex.nix @@ -13,10 +13,9 @@ uboot.enable = true; }; - # boot.kernelPackages = pkgs.linuxPackages_latest; + boot.kernelPackages = pkgs.linuxPackages_latest; # boot.kernelPackages = pkgs.linuxPackages_4_18; - # boot.kernelPackages = pkgs.linuxPackages_latest; - boot.kernelPackages = pkgs.linuxPackages_rpi; + # boot.kernelPackages = pkgs.linuxPackages_rpi; boot.kernelParams = [ "cma=32M" # for virtual console, see https://nixos.wiki/wiki/NixOS_on_ARM @@ -40,7 +39,7 @@ # ]; # networking.wireless.enable = true; # networking.networkmanager.enable = true; - # networking.wireless.iwd.enable = true; + networking.wireless.iwd.enable = true; fileSystems = { # "/boot" = { @@ -78,62 +77,7 @@ services.octoprint = { enable = true; - plugins = plugins: with pkgs; with python2Packages; - let rpi-gpio = buildPythonPackage rec { - pname = "RPi.GPIO"; - version = "0.6.5"; - src = fetchPypi { - inherit pname version; - sha256 = "a4210ad63bfe844e43995286de0d3950dfacfa0f3799bb9392770ac54a7d2e47"; - }; - }; in - [ - # bundles binary which is not built for aarch64 :-( - # (buildPythonPackage rec { - # pname = "OctoPrint-PrintTimeGenius"; - # version = "1.3"; - # src = fetchFromGitHub { - # owner = "eyal0"; - # repo = pname; - # rev = version; - # sha256 = "1jfiih8vpd1x5yk2yq9sgi0rbjh2ipasj39vs2dmfm3va2fhy75l"; - # }; - # propagatedBuildInputs = [ octoprint ]; - # }) - (buildPythonPackage rec { - pname = "OctoPrint-TouchUI"; - version = "0.3.13"; - src = fetchFromGitHub { - owner = "BillyBlaze"; - repo = pname; - rev = version; - sha256 = "0qk12ysabdzy6cna3l4f8v3qcnppppwxxsjx2i0xn1nd0cv6yzwh"; - }; - propagatedBuildInputs = [ octoprint ]; - }) - (buildPythonPackage rec { - pname = "OctoPrint-Cost"; - version = "master"; - src = fetchFromGitHub { - owner = "jasiek"; - repo = pname; - rev = "d1dc75aa64df332d54a237864a116c63cb9e6cf5"; - sha256 = "0xkz1ygb5jspl1iy841lrv3fwm92ay09m6rw9g4vchwldqbgpjf3"; - }; - propagatedBuildInputs = [ octoprint ]; - }) - (buildPythonPackage rec { - pname = "OctoPrint-PSUControl"; - version = "0.1.8"; - src = fetchFromGitHub { - owner = "kantlivelong"; - repo = pname; - rev = version; - sha256 = "0aj38d7b7d5pzmzq841pip18cpg18wy2vrxq2nd13875597y54b8"; - }; - propagatedBuildInputs = [ octoprint rpi-gpio ]; - }) - ]; + plugins = ps: with ps; [ printtimegenius touchui psucontrol ]; }; systemd.services.setupGpioForRelais = rec { wantedBy = [ "octoprint.service" ]; @@ -141,18 +85,33 @@ Type = "oneshot"; RemainAfterExit = "yes"; }; - script = '' - if echo 17 > /sys/class/gpio/export; then - echo high > /sys/class/gpio/gpio17/direction + script = let gpio = toString (458 + 17); in '' + if echo ${gpio} > /sys/class/gpio/export; then + echo high > /sys/class/gpio/gpio${gpio}/direction fi - chown octoprint:dialout /sys/class/gpio/gpio17/value + chown octoprint:dialout /sys/class/gpio/gpio${gpio}/value ''; }; users.users.${config.services.octoprint.user}.extraGroups = [ "dialout" # ttyUSB access ]; - services.mjpg-streamer.enable = true; + systemd.services.ethKernelPanicFix = rec { + wantedBy = [ "networking.target" ]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = "yes"; + }; + # https://github.com/raspberrypi/linux/issues/2449 + script = '' + ${pkgs.ethtool}/bin/ethtool -K eth0 tx-tcp-segmentation off tx-tcp6-segmentation off + ''; + }; + + services.mjpg-streamer = { + enable = true; + # inputPlugin = "input_uvc.so -r 1920x1080"; + }; networking.firewall = { enable = true; @@ -174,6 +133,10 @@ locations."/" = { proxyPass = "http://localhost:${toString config.services.octoprint.port}"; proxyWebsockets = true; + # do not cache that octoprint is inaccessible on startup + extraConfig = '' + proxy_cache off; + ''; }; locations."/webcam/".proxyPass = "http://localhost:5050/?action=stream"; locations."/webcampic/".proxyPass = "http://localhost:5050/?action=snapshot";