diff options
52 files changed, 1698 insertions, 123 deletions
diff --git a/krebs/2configs/shack/glados/default.nix b/krebs/2configs/shack/glados/default.nix index 54e7aef5c..dc345cc4e 100644 --- a/krebs/2configs/shack/glados/default.nix +++ b/krebs/2configs/shack/glados/default.nix @@ -3,18 +3,21 @@ let shackopen = import ./multi/shackopen.nix; wasser = import ./multi/wasser.nix; in { - services.nginx.virtualHosts."hass.shack".locations."/" = { - proxyPass = "http://localhost:8123"; - extraConfig = '' - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; + services.nginx.virtualHosts."hass.shack" = { + serverAliases = [ "glados.shack" ]; + locations."/" = { + proxyPass = "http://localhost:8123"; + extraConfig = '' + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; - proxy_buffering off; - ''; + proxy_buffering off; + ''; + }; }; services.home-assistant = let dwd_pollen = pkgs.fetchFromGitHub { diff --git a/krebs/2configs/shack/glados/multi/wasser.nix b/krebs/2configs/shack/glados/multi/wasser.nix index a2c80851b..da5cac36d 100644 --- a/krebs/2configs/shack/glados/multi/wasser.nix +++ b/krebs/2configs/shack/glados/multi/wasser.nix @@ -12,6 +12,7 @@ let retain = false; qos = 1; }; + seconds = 30; in { switch = [ @@ -19,7 +20,7 @@ in ]; automation = [ - { alias = "Water the plant for 10 seconds"; + { alias = "Water the plant for ${toString seconds} seconds"; trigger = [ { # trigger at 20:00 no matter what # TODO: retry or run only if switch.wasser is available @@ -35,7 +36,7 @@ in "switch.wasser" ]; } - { delay.seconds = 10; } + { delay.seconds = seconds; } { service = "homeassistant.turn_off"; entity_id = [ @@ -44,13 +45,13 @@ in } ]; } - { alias = "Always turn off water after 15 seconds"; + { alias = "Always turn off water after ${toString (seconds * 2)}seconds"; trigger = [ { platform = "state"; entity_id = "switch.wasser"; to = "on"; - for.seconds = 15; + for.seconds = seconds*2; } ]; action = diff --git a/krebs/3modules/makefu/default.nix b/krebs/3modules/makefu/default.nix index 9581712fb..ab24d9096 100644 --- a/krebs/3modules/makefu/default.nix +++ b/krebs/3modules/makefu/default.nix @@ -189,6 +189,7 @@ in { wg.euer IN A ${nets.internet.ip4.addr} wiki.euer IN A ${nets.internet.ip4.addr} wikisearch IN A ${nets.internet.ip4.addr} + bookmark.euer IN A ${nets.internet.ip4.addr} io IN NS gum.krebsco.de. mediengewitter IN CNAME over.dose.io. ''; diff --git a/makefu/1systems/gum/config.nix b/makefu/1systems/gum/config.nix index 9585d8599..3b084d35a 100644 --- a/makefu/1systems/gum/config.nix +++ b/makefu/1systems/gum/config.nix @@ -81,7 +81,7 @@ in { # ci # <stockholm/makefu/2configs/exim-retiolum.nix> <stockholm/makefu/2configs/git/cgit-retiolum.nix> - <stockholm/makefu/2configs/shack/events-publisher> + # <stockholm/makefu/2configs/shack/events-publisher> <stockholm/makefu/2configs/shack/gitlab-runner> <stockholm/makefu/2configs/remote-build/slave.nix> <stockholm/makefu/2configs/remote-build/aarch64-community.nix> @@ -90,36 +90,20 @@ in { # services # <stockholm/makefu/2configs/sabnzbd.nix> <stockholm/makefu/2configs/mail/mail.euer.nix> - { - krebs.exim.enable = mkForce false; - } + { krebs.exim.enable = mkForce false; } # sharing <stockholm/makefu/2configs/share/gum.nix> <stockholm/makefu/2configs/torrent.nix> - { services.sickbeard = { - enable = true; - package = pkgs.sickgear; - user = "sickbeard"; - group = "download"; - port = 8280; - }; - services.nginx.virtualHosts."sick.makefu.r" = { - locations."/".proxyPass = http://localhost:8280; - extraConfig = '' - if ( $server_addr = "${external-ip}" ) { - return 403; - } - ''; - }; - users.users.sickbeard.extraGroups = [ "nginx" ]; - } + <stockholm/makefu/2configs/sickbeard> + { nixpkgs.config.allowUnfree = true; } #<stockholm/makefu/2configs/retroshare.nix> ## <stockholm/makefu/2configs/ipfs.nix> #<stockholm/makefu/2configs/syncthing.nix> # <stockholm/makefu/2configs/opentracker.nix> + ## network <stockholm/makefu/2configs/vpn/openvpn-server.nix> # <stockholm/makefu/2configs/vpn/vpnws/server.nix> @@ -151,6 +135,8 @@ in { <stockholm/makefu/2configs/deployment/graphs.nix> <stockholm/makefu/2configs/deployment/owncloud.nix> <stockholm/makefu/2configs/deployment/boot-euer.nix> + <stockholm/makefu/2configs/shiori.nix> + <stockholm/makefu/2configs/bgt/download.binaergewitter.de.nix> <stockholm/makefu/2configs/bgt/hidden_service.nix> <stockholm/makefu/2configs/bgt/backup.nix> @@ -159,6 +145,11 @@ in { # sharing <stockholm/makefu/2configs/dcpp/airdcpp.nix> + { krebs.airdcpp.dcpp.shares = { + download.path = config.makefu.dl-dir + "/finished"; + sorted.path = config.makefu.dl-dir + "/sorted"; + }; + } <stockholm/makefu/2configs/dcpp/hub.nix> ## Temporary: diff --git a/makefu/1systems/gum/hardware-config.nix b/makefu/1systems/gum/hardware-config.nix index e49b621e7..2d7efe9cf 100644 --- a/makefu/1systems/gum/hardware-config.nix +++ b/makefu/1systems/gum/hardware-config.nix @@ -69,6 +69,11 @@ in { fsType = "ext4"; options = [ "nofail" ]; }; + fileSystems."/var/www/o.euer.krebsco.de" = { + device = "/dev/nixos/nextcloud"; + fsType = "ext4"; + options = [ "nofail" ]; + }; fileSystems."/var/lib/borgbackup" = { device = "/dev/nixos/backup"; fsType = "ext4"; diff --git a/makefu/1systems/omo/config.nix b/makefu/1systems/omo/config.nix index ac2677b7f..9b9b91a6f 100644 --- a/makefu/1systems/omo/config.nix +++ b/makefu/1systems/omo/config.nix @@ -11,6 +11,7 @@ in { ./hw/omo.nix #./hw/tsp.nix <stockholm/makefu> + { environment.systemPackages = with pkgs;[ tmux picocom ];} <stockholm/makefu/2configs/support-nixos.nix> <stockholm/makefu/2configs/zsh-user.nix> <stockholm/makefu/2configs/backup/state.nix> diff --git a/makefu/1systems/wbob/config.nix b/makefu/1systems/wbob/config.nix index ad7fc825c..7002b1002 100644 --- a/makefu/1systems/wbob/config.nix +++ b/makefu/1systems/wbob/config.nix @@ -47,6 +47,7 @@ in { <stockholm/makefu/2configs/bureautomation> # new hass entry point <stockholm/makefu/2configs/bureautomation/led-fader.nix> + <stockholm/makefu/2configs/bureautomation/visitor-photostore.nix> # <stockholm/makefu/2configs/bureautomation/mpd.nix> #mpd is only used for TTS <stockholm/makefu/2configs/mqtt.nix> (let @@ -146,10 +147,8 @@ in { # rt2870.bin wifi card, part of linux-unfree hardware.enableAllFirmware = true; nixpkgs.config.allowUnfree = true; - networking.wireless.enable = true; # rt2870 with nonfree creates wlp2s0 from wlp0s20u2 # not explicitly setting the interface results in wpa_supplicant to crash - networking.wireless.interfaces = [ "wlp2s0" ]; networking.interfaces.virbr1.ipv4.addresses = [{ address = "10.8.8.11"; prefixLength = 24; @@ -161,8 +160,8 @@ in { hardware.cpu.intel.updateMicrocode = true; boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; - boot.kernelModules = [ "kvm-intel" - "snd-seq" "snd-rawmidi" + boot.kernelModules = [ + "kvm-intel" "snd-seq" "snd-rawmidi" ]; fileSystems = { "/" = { diff --git a/makefu/1systems/x/config.nix b/makefu/1systems/x/config.nix index 32a548954..ad9a3324b 100644 --- a/makefu/1systems/x/config.nix +++ b/makefu/1systems/x/config.nix @@ -15,6 +15,7 @@ <stockholm/makefu/2configs/main-laptop.nix> <stockholm/makefu/2configs/extra-fonts.nix> + <stockholm/makefu/2configs/editor/neovim> <stockholm/makefu/2configs/tools/all.nix> { programs.adb.enable = true; } @@ -58,6 +59,7 @@ # Krebs <stockholm/makefu/2configs/tinc/retiolum.nix> # <stockholm/makefu/2configs/share/gum-client.nix> + # <stockholm/makefu/2configs/share/temp-share-samba.nix> # applications @@ -68,7 +70,7 @@ # Virtualization # <stockholm/makefu/2configs/virtualisation/libvirt.nix> - # <stockholm/makefu/2configs/virtualisation/docker.nix> + <stockholm/makefu/2configs/virtualisation/docker.nix> <stockholm/makefu/2configs/virtualisation/virtualbox.nix> #{ # networking.firewall.allowedTCPPorts = [ 8080 ]; @@ -189,6 +191,7 @@ "/home/makefu/.imapfilter" "/home/makefu/.mutt" "/home/makefu/docs" + "/home/makefu/notes" "/home/makefu/.password-store" "/home/makefu/.secrets-pass" "/home/makefu/.config/syncthing" @@ -198,4 +201,11 @@ services.syncthing.dataDir = lib.mkForce "/home/makefu/.config/syncthing/"; # latest kernel (5.0) has issues with wifi card boot.kernelPackages = pkgs.linuxPackages; + # Bugfix for wifi card + powerManagement.resumeCommands = '' + sleep 2 + echo 1 > /sys/bus/pci/devices/0000:03:00.0/remove + sleep 3 + echo 1 > /sys/bus/pci/rescan + ''; } diff --git a/makefu/2configs/bgt/download.binaergewitter.de.nix b/makefu/2configs/bgt/download.binaergewitter.de.nix index f223081e9..77c9ddc81 100644 --- a/makefu/2configs/bgt/download.binaergewitter.de.nix +++ b/makefu/2configs/bgt/download.binaergewitter.de.nix @@ -37,6 +37,11 @@ in { ''; }; services.nginx = { + appendHttpConfig = '' + types { + audio/ogg oga ogg opus; + } + ''; enable = lib.mkDefault true; recommendedGzipSettings = true; recommendedOptimisation = true; diff --git a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix index 007f6064a..b9aa710c3 100644 --- a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix +++ b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix @@ -34,18 +34,18 @@ } { alias = "Turn off Fernseher after last in group left"; trigger = [ - { # trigger when movement was detected at the time - platform = "state"; - entity_id = "group.team"; - from = "home"; - to = "not_home"; - } - { # trigger at 18:00 no matter what - # to avoid 'everybody left before 18:00:00' - platform = "time"; - at = "18:00:00"; - } - ]; + { # trigger when movement was detected at the time + platform = "state"; + entity_id = "group.team"; + from = "home"; + to = "not_home"; + } + { # trigger at 18:00 no matter what + # to avoid 'everybody left before 18:00:00' + platform = "time"; + at = "18:00:00"; + } + ]; action = [ { service = "homeassistant.turn_off"; @@ -58,7 +58,7 @@ } { service = "notify.telegrambot"; - data = { + data_template = { title = "Bureau Shutdown"; message = "All devices are turned off due to {{ trigger.platform }}"; }; diff --git a/makefu/2configs/bureautomation/camera/comic.nix b/makefu/2configs/bureautomation/camera/comic.nix new file mode 100644 index 000000000..a847b0add --- /dev/null +++ b/makefu/2configs/bureautomation/camera/comic.nix @@ -0,0 +1,6 @@ +[ + { name = "Poorly Drawn Lines"; + platform = "generic"; + still_image_url = http://127.0.0.1:8123/local/lines.png ; + } +] diff --git a/makefu/2configs/bureautomation/comic-updater.nix b/makefu/2configs/bureautomation/comic-updater.nix new file mode 100644 index 000000000..5f26bc2c7 --- /dev/null +++ b/makefu/2configs/bureautomation/comic-updater.nix @@ -0,0 +1,28 @@ +{ config, lib, pkgs, buildPythonPackage, ... }: + +let + mq = "192.168.8.11"; + pkg = pkgs.ampel; +in { + systemd.services.comic-updater = { + startAt = "daily"; + description = "Send led change to message queue"; + after = [ "network-online.target" ] ++ (lib.optional config.services.mosquitto.enable "mosquitto.service"); + path = with pkgs; [ wget xmlstarlet ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + User = "hass"; + WorkingDirectory = config.services.home-assistant.configDir; + ExecStart = pkgs.writeDash "update-poorly-drawn-lines" '' + set -euf + mkdir -p www/ + cd www/ + pic=$(wget -O- http://www.poorlydrawnlines.com/feed/ \ + | xml sel -t -v '/rss/channel/item/content:encoded' \ + | head -n 2 | sed -n 's/.*src="\([^"]\+\)".*/\1/p' ) + wget "$pic" -nc && cp -v "$(basename "$pic")" lines.png + ''; + PrivateTmp = true; + }; + }; +} diff --git a/makefu/2configs/bureautomation/default.nix b/makefu/2configs/bureautomation/default.nix index 8ec9dacc2..d745d894a 100644 --- a/makefu/2configs/bureautomation/default.nix +++ b/makefu/2configs/bureautomation/default.nix @@ -1,12 +1,14 @@ { config, pkgs, lib, ... }: let kodi-host = "192.168.8.11"; - ten_hours = import ./combination/10h_timers.nix { inherit lib; }; # provides: timer automation script - mittagessen = import ./combination/mittagessen.nix { inherit lib; }; # provides: automation script - matrix = import ./combination/matrix.nix { inherit lib; }; # provides: matrix automation + ten_hours = import ./multi/10h_timers.nix { inherit lib; }; # provides: timer automation script + mittagessen = import ./multi/mittagessen.nix { inherit lib; }; # provides: automation script + matrix = import ./multi/matrix.nix { inherit lib; }; # provides: matrix automation + aramark = import ./multi/aramark.nix { inherit lib; }; # provides: pommes sensor in { imports = [ ./ota.nix + ./comic-updater.nix ]; networking.firewall.allowedTCPPorts = [ 8123 ]; state = [ "/var/lib/hass/known_devices.yaml" ]; @@ -113,7 +115,8 @@ in { ]; binary_sensor = (import ./binary_sensor/buttons.nix) ++ - (import ./binary_sensor/motion.nix); + (import ./binary_sensor/motion.nix) ++ + aramark.binary_sensor; sensor = [{ platform = "version"; }] ++ @@ -122,10 +125,12 @@ in { (import ./sensor/airquality.nix) ++ ((import ./sensor/outside.nix) {inherit lib;}) ++ (import ./sensor/influxdb.nix) ++ - (import ./sensor/tasmota_firmware.nix); + (import ./sensor/tasmota_firmware.nix) ++ + aramark.sensor; camera = - (import ./camera/verkehrskamera.nix); + (import ./camera/verkehrskamera.nix) + ++ (import ./camera/comic.nix); # not yet released #person = @@ -174,6 +179,7 @@ in { "group.team" "group.nachtlicht" "group.switches" + "group.aramark" ]; }; automation = []; @@ -195,7 +201,6 @@ in { "device_tracker.carsten_phone" "device_tracker.thierry_phone" "device_tracker.frank_phone" - "device_tracker.anthony_phone" # "person.thorsten" # "person.felix" # "person.ecki" @@ -205,6 +210,7 @@ in { "camera.Baumarkt" "camera.Autobahn_Heilbronn" "camera.Autobahn_Singen" + "camera.poorly_drawn_lines" ]; nachtlicht = [ "switch.nachtlicht_a" @@ -212,6 +218,21 @@ in { "switch.nachtlicht_c" "switch.nachtlicht_d" ]; + Aramark = [ + "binary_sensor.pommes" + "sensor.menu_1" + "sensor.menu_1_text" + "sensor.menu_1_preis" + "sensor.menu_2" + "sensor.menu_2_text" + "sensor.menu_2_preis" + "sensor.aktion" + "sensor.aktion_text" + "sensor.aktion_preis" + "sensor.mercato" + "sensor.mercato_text" + "sensor.mercato_preis" + ]; sensors = [ "media_player.kodi" "script.blitz_10s" @@ -221,6 +242,7 @@ in { "sensor.easy2_dht22_humidity" "sensor.easy2_dht22_temperature" "sensor.air_quality" + # "binary_sensor.aramark_pommes" # "binary_sensor.redbutton" ]; outside = [ diff --git a/makefu/2configs/bureautomation/lib/scripts.nix b/makefu/2configs/bureautomation/lib/scripts.nix new file mode 100644 index 000000000..d8665f94f --- /dev/null +++ b/makefu/2configs/bureautomation/lib/scripts.nix @@ -0,0 +1,18 @@ +{ lib, ... }: +{ + multi_flash = { entity, delays ? [ 500 ], alias ? "${entity}_multi_flash_${toString (lib.length delays)}" }: + { + inherit alias; + sequence = lib.flatten (builtins.map (delay: [ + { service = "homeassistant.turn_on"; + data.entity_id = entity; + } + { delay.milliseconds = delay; } + { service = "homeassistant.turn_off"; + data.entity_id = entity; + } + { delay.milliseconds = delay; } + ] + ) delays); + }; +} diff --git a/makefu/2configs/bureautomation/combination/10h_timers.nix b/makefu/2configs/bureautomation/multi/10h_timers.nix index dec5347a6..53bfd3725 100644 --- a/makefu/2configs/bureautomation/combination/10h_timers.nix +++ b/makefu/2configs/bureautomation/multi/10h_timers.nix @@ -1,7 +1,6 @@ {lib, ... }: let - persons = [ "frank" "daniel" "thorsten" "carsten" "thierry" "ecki" "felix" - "anthony" # antony + persons = [ "frank" "daniel" "thorsten" "carsten" "ecki" "felix" "thierry" # tjeri ]; random_zu_lange = name: ''{{ [ @@ -45,7 +44,7 @@ let "Im Kalender von ${name} sind heute acht Meetings eingeplant, von denen zwei bereits verpasst wurden", "Das Postfach von ${name} beinhaltet einhundertachtundzwanzig ungelesene E-Mails.", "Nachricht von Serge: ${name}, bitte melden Sie sich Umgehend bei mir im Büro!", - "Luftqualität hat sich durch das Eintreffen von ${name} um zweihunder Punk |