2019-05-30 11:30:01 +00:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
{
|
|
|
|
imports = [
|
|
|
|
./basic-tools.nix
|
|
|
|
];
|
|
|
|
|
|
|
|
boot.loader.grub.enable = false;
|
|
|
|
|
|
|
|
boot.loader.raspberryPi = {
|
|
|
|
enable = true;
|
|
|
|
version = 3;
|
|
|
|
uboot.enable = true;
|
|
|
|
};
|
|
|
|
|
2020-10-11 10:14:54 +00:00
|
|
|
boot.kernelPackages = pkgs.linuxPackages_5_4;
|
2019-05-30 11:30:01 +00:00
|
|
|
|
|
|
|
boot.kernelParams = [
|
|
|
|
"cma=32M" # for virtual console, see https://nixos.wiki/wiki/NixOS_on_ARM
|
|
|
|
"console=tty0"
|
|
|
|
];
|
|
|
|
|
|
|
|
hardware.enableRedistributableFirmware = true;
|
|
|
|
# hardware.firmware = with pkgs; [
|
|
|
|
# (stdenv.mkDerivation {
|
|
|
|
# name = "broadcom-rpi3bplus-extra";
|
|
|
|
# src = fetchurl {
|
|
|
|
# url = "https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/b518de4/brcm/brcmfmac43455-sdio.txt";
|
|
|
|
# sha256 = "0r4bvwkm3fx60bbpwd83zbjganjnffiq1jkaj0h20bwdj9ysawg9";
|
|
|
|
# };
|
|
|
|
# phases = [ "installPhase" ];
|
|
|
|
# installPhase = ''
|
|
|
|
# mkdir -p $out/lib/firmware/brcm
|
|
|
|
# cp $src $out/lib/firmware/brcm/brcmfmac43455-sdio.txt
|
|
|
|
# '';
|
|
|
|
# })
|
|
|
|
# ];
|
|
|
|
# networking.wireless.enable = true;
|
|
|
|
# networking.networkmanager.enable = true;
|
2019-05-31 18:41:17 +00:00
|
|
|
networking.wireless.iwd.enable = true;
|
2019-05-30 11:30:01 +00:00
|
|
|
|
|
|
|
fileSystems = {
|
|
|
|
"/" = {
|
|
|
|
device = "/dev/disk/by-label/NIXOS_SD";
|
|
|
|
fsType = "ext4";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
networking.hostName = "murex";
|
|
|
|
#networking.hostId = "34a820f1";
|
|
|
|
|
2020-08-20 18:02:06 +00:00
|
|
|
time.timeZone = "Europe/Amsterdam";
|
2019-05-30 11:30:01 +00:00
|
|
|
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
raspberrypi-tools
|
|
|
|
];
|
|
|
|
|
|
|
|
users.extraUsers.gebner = {
|
|
|
|
isNormalUser = true;
|
2019-05-30 14:51:30 +00:00
|
|
|
extraGroups = [ "wheel" "networkmanager" "audio" "dialout" ];
|
2019-05-30 11:30:01 +00:00
|
|
|
shell = pkgs.fish;
|
|
|
|
};
|
|
|
|
|
|
|
|
services.openssh = {
|
|
|
|
enable = true;
|
|
|
|
passwordAuthentication = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
documentation.nixos.enable = false;
|
|
|
|
|
|
|
|
services.octoprint = {
|
|
|
|
enable = true;
|
2020-10-11 10:14:54 +00:00
|
|
|
plugins = ps: with ps; [
|
|
|
|
printtimegenius
|
|
|
|
touchui
|
|
|
|
# psucontrol
|
|
|
|
];
|
2019-05-30 11:30:01 +00:00
|
|
|
};
|
2020-10-03 18:19:14 +00:00
|
|
|
# systemd.services.setupGpioForRelais = rec {
|
|
|
|
# wantedBy = [ "octoprint.service" ];
|
|
|
|
# serviceConfig = {
|
|
|
|
# Type = "oneshot";
|
|
|
|
# RemainAfterExit = "yes";
|
|
|
|
# };
|
|
|
|
# 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/gpio${gpio}/value
|
|
|
|
# '';
|
|
|
|
# };
|
2019-05-30 11:30:01 +00:00
|
|
|
users.users.${config.services.octoprint.user}.extraGroups = [
|
|
|
|
"dialout" # ttyUSB access
|
|
|
|
];
|
|
|
|
|
2019-05-31 17:21:58 +00:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2019-05-31 17:27:09 +00:00
|
|
|
services.mjpg-streamer = {
|
|
|
|
enable = true;
|
2019-05-31 18:41:17 +00:00
|
|
|
# inputPlugin = "input_uvc.so -r 1920x1080";
|
2019-05-31 17:27:09 +00:00
|
|
|
};
|
2019-05-30 11:30:01 +00:00
|
|
|
|
|
|
|
networking.firewall = {
|
|
|
|
enable = true;
|
|
|
|
allowedTCPPorts = [
|
|
|
|
# config.services.octoprint.port
|
|
|
|
# 5050 # mjpg-streamer
|
|
|
|
80
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
|
|
|
recommendedTlsSettings = true;
|
|
|
|
recommendedOptimisation = true;
|
|
|
|
recommendedGzipSettings = true;
|
|
|
|
recommendedProxySettings = true;
|
|
|
|
|
2019-10-14 09:03:14 +00:00
|
|
|
virtualHosts."murex.ams.gebner.org" = {
|
2019-05-30 11:30:01 +00:00
|
|
|
locations."/" = {
|
2019-05-30 12:43:03 +00:00
|
|
|
proxyPass = "http://localhost:${toString config.services.octoprint.port}";
|
2019-05-30 11:30:01 +00:00
|
|
|
proxyWebsockets = true;
|
2019-05-31 17:38:30 +00:00
|
|
|
# do not cache that octoprint is inaccessible on startup
|
|
|
|
extraConfig = ''
|
|
|
|
proxy_cache off;
|
2020-10-11 10:14:54 +00:00
|
|
|
proxy_set_header Accept-Encoding "*";
|
2021-04-04 11:34:49 +00:00
|
|
|
client_max_body_size 50M;
|
2019-05-31 17:38:30 +00:00
|
|
|
'';
|
2019-05-30 11:30:01 +00:00
|
|
|
};
|
|
|
|
locations."/webcam/".proxyPass = "http://localhost:5050/?action=stream";
|
2019-05-30 15:52:58 +00:00
|
|
|
locations."/webcampic/".proxyPass = "http://localhost:5050/?action=snapshot";
|
2019-05-30 11:30:01 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-10-03 18:19:14 +00:00
|
|
|
system.stateVersion = "20.09";
|
2019-05-30 11:30:01 +00:00
|
|
|
}
|