From 8079877eee34d0a658e8419adfa8987e648388a8 Mon Sep 17 00:00:00 2001 From: jeschli Date: Mon, 10 Jun 2019 18:56:19 +0200 Subject: j brauerei: -python35 +python37 --- jeschli/1systems/brauerei/config.nix | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/jeschli/1systems/brauerei/config.nix b/jeschli/1systems/brauerei/config.nix index 059ec6d71..f536801ba 100644 --- a/jeschli/1systems/brauerei/config.nix +++ b/jeschli/1systems/brauerei/config.nix @@ -78,19 +78,9 @@ in gcc ghc go - python35 - python35Packages.pip - (vagrant.override { - bundlerEnv = bundlerEnv.override { - bundler = bundler.overrideAttrs (old: { - name = "bundler-1.16.1"; - src = fetchurl { - url = "https://rubygems.org/gems/bundler-1.16.1.gem"; - sha256 = "1s2nq4qnffxg3kwrk7cnwxcvfihlhxm9absl2l6d3qckf3sy1f22"; - }; - }); - }; - }) + python37 + python37Packages.pip + pipenv # dev tools gnumake jetbrains.clion -- cgit v1.2.3 From c33078ddf6e56c4085c7baa7395ad2358e90b497 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 17 Jun 2019 07:51:41 +0200 Subject: ma wiregrill: rockit -> shackdev --- krebs/3modules/makefu/default.nix | 9 ++++++++- krebs/3modules/makefu/wiregrill/rockit.pub | 2 +- krebs/3modules/makefu/wiregrill/shackdev.pub | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 krebs/3modules/makefu/wiregrill/shackdev.pub diff --git a/krebs/3modules/makefu/default.nix b/krebs/3modules/makefu/default.nix index 601762b93..9581712fb 100644 --- a/krebs/3modules/makefu/default.nix +++ b/krebs/3modules/makefu/default.nix @@ -236,6 +236,7 @@ in { "tracker.makefu.r" "wiki.gum.r" "wiki.makefu.r" + "sick.makefu.r" ]; }; }; @@ -288,10 +289,16 @@ in { ip4.addr = "10.243.189.130"; }; }; + }; + + shackdev = rec { # router@shack + cores = 1; + nets.wiregrill.ip4.addr = "10.244.245.2"; }; + rockit = rec { # router@home cores = 1; - nets.wiregrill.ip4.addr = "10.244.245.2"; + nets.wiregrill.ip4.addr = "10.244.245.3"; }; senderechner = rec { diff --git a/krebs/3modules/makefu/wiregrill/rockit.pub b/krebs/3modules/makefu/wiregrill/rockit.pub index 6cb0d960d..ace109450 100644 --- a/krebs/3modules/makefu/wiregrill/rockit.pub +++ b/krebs/3modules/makefu/wiregrill/rockit.pub @@ -1 +1 @@ -YmvTL4c13WS6f88ZAz2m/2deL2pnPXI0Ay3edCPE1Qc= +LPMs1h9+8ABqeZsS6xmHC7votPqpUT609XuktAhaik8= diff --git a/krebs/3modules/makefu/wiregrill/shackdev.pub b/krebs/3modules/makefu/wiregrill/shackdev.pub new file mode 100644 index 000000000..6cb0d960d --- /dev/null +++ b/krebs/3modules/makefu/wiregrill/shackdev.pub @@ -0,0 +1 @@ +YmvTL4c13WS6f88ZAz2m/2deL2pnPXI0Ay3edCPE1Qc= -- cgit v1.2.3 From 9564a24c32db0c220477963c221fdf003f597223 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 17 Jun 2019 07:52:55 +0200 Subject: config collectd-base: send logs to wolf --- krebs/2configs/collectd-base.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/krebs/2configs/collectd-base.nix b/krebs/2configs/collectd-base.nix index 440f83fce..71a00be3a 100644 --- a/krebs/2configs/collectd-base.nix +++ b/krebs/2configs/collectd-base.nix @@ -9,7 +9,7 @@ let ModulePath "${collectd-connect-time}/lib/${python.libPrefix}/site-packages/" Import "collectd_connect_time" - target "localhost:22" "google.com" "google.de" "gum.r:22" "gum.krebsco.de" "heidi.shack:22" "10.42.0.1:22" "heise.de" "t-online.de" + target "localhost:22" "google.com" "google.de" "gum.r:22" "gum.krebsco.de" "10.42.0.1:22" "heise.de" "t-online.de" interval 10 @@ -18,7 +18,7 @@ let LoadPlugin write_graphite - Host "heidi.shack" + Host "wolf.r" Port "2003" Prefix "retiolum." EscapeCharacter "_" -- cgit v1.2.3 From 64eee34bbeac88ef8c4c27c8b4245ac0aaa7bfe7 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 17 Jun 2019 07:53:44 +0200 Subject: ma wiregrill: init --- makefu/2configs/wireguard/wiregrill.nix | 46 +++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 makefu/2configs/wireguard/wiregrill.nix diff --git a/makefu/2configs/wireguard/wiregrill.nix b/makefu/2configs/wireguard/wiregrill.nix new file mode 100644 index 000000000..082090755 --- /dev/null +++ b/makefu/2configs/wireguard/wiregrill.nix @@ -0,0 +1,46 @@ +with import ; +{ config, pkgs, ... }: let + + self = config.krebs.build.host.nets.wiregrill; + isRouter = !isNull self.via; # via "internet" is not set + ext-if = config.makefu.server.primary-itf; + +in mkIf (hasAttr "wiregrill" config.krebs.build.host.nets) { + #hack for modprobe inside containers + systemd.services."wireguard-wiregrill".path = mkIf config.boot.isContainer (mkBefore [ + (pkgs.writeDashBin "modprobe" ":") + ]); + + boot.kernel.sysctl = mkIf isRouter { + "net.ipv6.conf.all.forwarding" = 1; + }; + + networking.firewall = { + allowedUDPPorts = [ self.wireguard.port ]; + extraCommands = '' + iptables -A FORWARD -i wiregrill -o wiregrill -j ACCEPT + ''; + }; + + networking.wireguard.interfaces.wiregrill = { + ips = + (optional (!isNull self.ip4) self.ip4.addr) ++ + (optional (!isNull self.ip6) self.ip6.addr); + listenPort = self.wireguard.port; + privateKeyFile = (toString ) + "/wiregrill.key"; + allowedIPsAsRoutes = true; + peers = mapAttrsToList + (_: host: { + allowedIPs = if isRouter then + (optional (!isNull host.nets.wiregrill.ip4) host.nets.wiregrill.ip4.addr) ++ + (optional (!isNull host.nets.wiregrill.ip6) host.nets.wiregrill.ip6.addr) + else + host.nets.wiregrill.wireguard.subnets + ; + endpoint = mkIf (!isNull host.nets.wiregrill.via) (host.nets.wiregrill.via.ip4.addr + ":${toString host.nets.wiregrill.wireguard.port}"); + persistentKeepalive = mkIf (!isNull host.nets.wiregrill.via) 61; + publicKey = (replaceStrings ["\n"] [""] host.nets.wiregrill.wireguard.pubkey); + }) + (filterAttrs (_: h: hasAttr "wiregrill" h.nets) config.krebs.hosts); + }; +} -- cgit v1.2.3 From ea8d45793ef7375dcb9c324d1a235f47898fdef3 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 17 Jun 2019 07:54:31 +0200 Subject: ma bureautomation: prepare dwd_pollen, update presence --- makefu/2configs/bureautomation/default.nix | 14 +++---- .../bureautomation/device_tracker/openwrt.nix | 3 ++ makefu/2configs/bureautomation/dwd_pollen.nix | 32 ++++++++++++++++ makefu/2configs/bureautomation/gtts-token.nix | 27 ++++++++++++++ makefu/2configs/bureautomation/hass.nix | 43 +++++++++++++++++++--- makefu/2configs/bureautomation/sensor/pollen.nix | 7 ++++ 6 files changed, 113 insertions(+), 13 deletions(-) create mode 100644 makefu/2configs/bureautomation/dwd_pollen.nix create mode 100644 makefu/2configs/bureautomation/gtts-token.nix create mode 100644 makefu/2configs/bureautomation/sensor/pollen.nix diff --git a/makefu/2configs/bureautomation/default.nix b/makefu/2configs/bureautomation/default.nix index 1782becd8..56c845744 100644 --- a/makefu/2configs/bureautomation/default.nix +++ b/makefu/2configs/bureautomation/default.nix @@ -24,22 +24,20 @@ in { ./ota.nix ]; services.logstash = { - package = pkgs.logstash5; + package = pkgs.logstash7; + plugins = [ pkgs.logstash-output-exec ]; enable = true; inputConfig = '' http { port => ${toString port} host => "127.0.0.1" + type => "schlechteluft" } ''; - filterConfig = '' - ''; outputConfig = '' - stdout { codec => json } - exec { command => "${runit} '%{ruleName}' '%{state}'" } - ''; - extraSettings = '' - path.plugins: [ "${pkgs.logstash-output-exec}" ] + if [type] == "schlechteluft" { + exec { command => "${runit} '%{ruleName}' '%{state}'" } + } ''; }; } diff --git a/makefu/2configs/bureautomation/device_tracker/openwrt.nix b/makefu/2configs/bureautomation/device_tracker/openwrt.nix index 0db9821a1..d32eab60f 100644 --- a/makefu/2configs/bureautomation/device_tracker/openwrt.nix +++ b/makefu/2configs/bureautomation/device_tracker/openwrt.nix @@ -1,3 +1,6 @@ +# requires `opkg install luci-mod-rpc` on router +# see https://www.home-assistant.io/components/luci/ + [ { platform = "luci"; name = "router"; diff --git a/makefu/2configs/bureautomation/dwd_pollen.nix b/makefu/2configs/bureautomation/dwd_pollen.nix new file mode 100644 index 000000000..39d9c3069 --- /dev/null +++ b/makefu/2configs/bureautomation/dwd_pollen.nix @@ -0,0 +1,32 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, python +, voluptuous +}: + +buildPythonPackage rec { + format = "other"; + pname = "dwd_pollen"; + version = "0.1"; + + src = fetchFromGitHub { + owner = "marcschumacher"; + repo = "dwd_pollen"; + rev = version; + sha256 = "1af2mx99gv2hk1ad53g21fwkdfdbymqcdl3jvzd1yg7dgxlkhbj1"; + }; + propagatedBuildInputs = [ + voluptuous + ]; + installPhase = '' + install -D -t $out/${python.sitePackages}/homeassistant/components/sensor/dwd_pollen * + ''; + + meta = with lib; { + description = "Home Assistant component to retrieve Pollen data from DWD (Germany)"; + homepage = https://github.com/marcschumacher/dwd_pollen; + license = licenses.mit; + maintainers = [ maintainers.makefu ]; + }; +} diff --git a/makefu/2configs/bureautomation/gtts-token.nix b/makefu/2configs/bureautomation/gtts-token.nix new file mode 100644 index 000000000..69640f03d --- /dev/null +++ b/makefu/2configs/bureautomation/gtts-token.nix @@ -0,0 +1,27 @@ +{ lib +, buildPythonPackage +, fetchPypi +, requests +}: + +buildPythonPackage rec { + pname = "gtts-token"; + version = "1.1.3"; + + src = fetchPypi { + pname = "gTTS-token"; + inherit version; + sha256 = "9d6819a85b813f235397ef931ad4b680f03d843c9b2a9e74dd95175a4bc012c5"; + }; + + propagatedBuildInputs = [ + requests + ]; + + meta = with lib; { + description = "Calculates a token to run the Google Translate text to speech"; + homepage = https://github.com/boudewijn26/gTTS-token; + license = licenses.mit; + # maintainers = [ maintainers. ]; + }; +} diff --git a/makefu/2configs/bureautomation/hass.nix b/makefu/2configs/bureautomation/hass.nix index ace1d10ce..ed9cb0905 100644 --- a/makefu/2configs/bureautomation/hass.nix +++ b/makefu/2configs/bureautomation/hass.nix @@ -1,12 +1,32 @@ -{ pkgs, lib, ... }: +{ config, pkgs, lib, ... }: let kodi-host = "192.168.8.11"; + in { networking.firewall.allowedTCPPorts = [ 8123 ]; state = [ "/var/lib/hass/known_devices.yaml" ]; - services.home-assistant = { + services.home-assistant = let + dwd_pollen = pkgs.fetchFromGitHub { + owner = "marcschumacher"; + repo = "dwd_pollen"; + rev = "0.1"; + sha256 = "1af2mx99gv2hk1ad53g21fwkdfdbymqcdl3jvzd1yg7dgxlkhbj1"; + }; + in { enable = true; - package = pkgs.home-assistant.override { python3 = pkgs.python36; }; + package = (pkgs.home-assistant.overrideAttrs (old: { + # TODO: find correct python package + postInstall = '' + cp -r ${dwd_pollen} $out/lib/python3.7/site-packages/homeassistant/components/dwd_pollen + ''; + })).override { + extraPackages = ps: with ps; [ + pkgs.pico2wave + python-forecastio jsonrpc-async jsonrpc-websocket + (callPackage ./gtts-token.nix { }) + ]; + }; + autoExtraComponents = true; config = { homeassistant = { name = "Bureautomation"; @@ -84,6 +104,7 @@ in { (import ./binary_sensor/motion.nix); sensor = + (import ./sensor/pollen.nix) ++ (import ./sensor/espeasy.nix) ++ ((import ./sensor/outside.nix) {inherit lib;}) ++ (import ./sensor/influxdb.nix) ++ @@ -99,6 +120,7 @@ in { frontend = { }; http = { # TODO: https://github.com/home-assistant/home-assistant/issues/16149 + base_url = "http://192.168.8.11:8123"; api_password = "sistemas"; trusted_networks = [ "127.0.0.1/32" @@ -110,7 +132,18 @@ in { conversation = {}; history = {}; logbook = {}; - tts = [ { platform = "google";} ]; + tts = [ + { platform = "google"; + language = "de"; + } + { platform = "voicerss"; + api_key = builtins.readFile ; + language = "de-de"; + } + { platform = "picotts"; + language = "de-DE"; + } + ]; recorder = {}; sun = {}; telegram_bot = [ @@ -147,6 +180,7 @@ in { "device_tracker.daniel_phone" "device_tracker.carsten_phone" "device_tracker.thierry_phone" + "device_tracker.frank_phone" # "person.thorsten" # "person.felix" # "person.ecki" @@ -181,7 +215,6 @@ in { "sensor.dark_sky_uv_index" # "sensor.dark_sky_pressure" "sensor.dark_sky_hourly_summary" - "device_tracker.router" ]; }; # only for automation diff --git a/makefu/2configs/bureautomation/sensor/pollen.nix b/makefu/2configs/bureautomation/sensor/pollen.nix new file mode 100644 index 000000000..506dbf123 --- /dev/null +++ b/makefu/2configs/bureautomation/sensor/pollen.nix @@ -0,0 +1,7 @@ +[ { + platform = "dwd_pollen"; + partsregion_ids = [ + 112 + ]; +} +] -- cgit v1.2.3 From dbd3278f49c36acdbd73afedaa6ef9d6e7485fd2 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 17 Jun 2019 07:55:30 +0200 Subject: ma gum.r: add sickbeard,wiregrill --- makefu/1systems/gum/config.nix | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/makefu/1systems/gum/config.nix b/makefu/1systems/gum/config.nix index 7bc06f833..9585d8599 100644 --- a/makefu/1systems/gum/config.nix +++ b/makefu/1systems/gum/config.nix @@ -97,6 +97,24 @@ in { # sharing + { 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" ]; + } + { nixpkgs.config.allowUnfree = true; } # ## # @@ -111,6 +129,7 @@ in { + # Removed until move: no extra mails @@ -153,11 +172,17 @@ in { makefu.dl-dir = "/var/download"; - services.openssh.hostKeys = [ + services.openssh.hostKeys = lib.mkForce [ { bits = 4096; path = (toString ); type = "rsa"; } { path = (toString ); type = "ed25519"; } ]; ###### stable - services.nginx.virtualHosts.cgit.serverAliases = [ "cgit.euer.krebsco.de" ]; + + services.nginx.virtualHosts."cgit.euer.krebsco.de" = { + forceSSL = true; + enableACME = true; + locations."/".proxyPass = "http://cgit.gum.r"; + }; + krebs.build.host = config.krebs.hosts.gum; # Network -- cgit v1.2.3 From 2a5743d3fafa825822755b994ea3a373e38ad569 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 17 Jun 2019 07:56:22 +0200 Subject: ma filepimp.r: remove obsolete zramSwap numDevices --- makefu/1systems/filepimp/config.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/makefu/1systems/filepimp/config.nix b/makefu/1systems/filepimp/config.nix index 30ba61a9b..e023c2885 100644 --- a/makefu/1systems/filepimp/config.nix +++ b/makefu/1systems/filepimp/config.nix @@ -48,7 +48,6 @@ in { hardware.cpu.amd.updateMicrocode = true; zramSwap.enable = true; - zramSwap.numDevices = 2; makefu.snapraid = let toMedia = name: "/media/" + name; -- cgit v1.2.3 From c9f906a54aa0cb866d1605524ae3921f3ddf4fd9 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 17 Jun 2019 07:57:26 +0200 Subject: ma gum.r/hardware-config: do not automount binaergewtter only nofail --- makefu/1systems/gum/hardware-config.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/makefu/1systems/gum/hardware-config.nix b/makefu/1systems/gum/hardware-config.nix index 857fad7aa..e49b621e7 100644 --- a/makefu/1systems/gum/hardware-config.nix +++ b/makefu/1systems/gum/hardware-config.nix @@ -41,7 +41,7 @@ in { boot.loader.grub.enable = true; boot.loader.grub.version = 2; boot.loader.grub.devices = [ main-disk ]; - boot.initrd.kernelModules = [ "dm-raid" "dm_cache" ]; + boot.initrd.kernelModules = [ "dm-raid" "dm_cache" "dm-thin-pool" ]; boot.initrd.availableKernelModules = [ "ata_piix" "vmw_pvscsi" "virtio_pci" "sd_mod" "ahci" "xhci_pci" "ehci_pci" "ahci" "sd_mod" @@ -67,7 +67,7 @@ in { fileSystems."/var/www/binaergewitter" = { device = "/dev/nixos/binaergewitter"; fsType = "ext4"; - options = [ "nofail" "x-systemd.automount" "x-systemd.device-timeout=5s" "x-systemd.mount-timeout=5s" ]; + options = [ "nofail" ]; }; fileSystems."/var/lib/borgbackup" = { device = "/dev/nixos/backup"; -- cgit v1.2.3 From 45229593215e54362b80277322beae9beb662346 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 17 Jun 2019 07:58:09 +0200 Subject: ma wbob.r: backup state, disable virtualization --- makefu/1systems/wbob/config.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/makefu/1systems/wbob/config.nix b/makefu/1systems/wbob/config.nix index ab77f16dd..8b01de4d0 100644 --- a/makefu/1systems/wbob/config.nix +++ b/makefu/1systems/wbob/config.nix @@ -16,15 +16,16 @@ in { - + # + # - # # # # + # Services # @@ -33,7 +34,7 @@ in { # Sensors - + # @@ -53,6 +54,7 @@ in { + (let collectd-port = 25826; @@ -85,6 +87,7 @@ in { ''; }) + # temporary # ]; @@ -106,6 +109,7 @@ in { LoadPlugin curl + Interval 300 TotalTime true NamelookupTime true ConnectTime true -- cgit v1.2.3 From 6245b549c66df46a92d76f5d146e545401619258 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 17 Jun 2019 08:00:46 +0200 Subject: ma cake.r: remove dangling config --- makefu/1systems/cake/config.nix | 7 +++---- makefu/2configs/Reaktor/bgt.nix | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 makefu/2configs/Reaktor/bgt.nix diff --git a/makefu/1systems/cake/config.nix b/makefu/1systems/cake/config.nix index 8617578f0..eaaac8f41 100644 --- a/makefu/1systems/cake/config.nix +++ b/makefu/1systems/cake/config.nix @@ -5,14 +5,14 @@ in { imports = [ ./hardware-config.nix + { environment.systemPackages = with pkgs;[ rsync screen curl git tmux picocom mosh ];} # - { environment.systemPackages = with pkgs;[ rsync screen curl git ];} # -# configure your hw: -# + # configure your hw: + # ]; krebs = { enable = true; @@ -24,5 +24,4 @@ in { documentation.man.enable = false; services.nixosManual.enable = false; sound.enable = false; - } diff --git a/makefu/2configs/Reaktor/bgt.nix b/makefu/2configs/Reaktor/bgt.nix new file mode 100644 index 000000000..42325bcd6 --- /dev/null +++ b/makefu/2configs/Reaktor/bgt.nix @@ -0,0 +1,15 @@ +{ pkgs, ... }: +{ + krebs.Reaktor.reaktor-bgt = { + nickname = "Reaktor|bgt"; + workdir = "/var/lib/Reaktor/bgt"; + channels = [ "#binaergewitter" ]; + plugins = with pkgs.ReaktorPlugins; + [ titlebot + # stockholm-issue + nixos-version + # shack-correct + # sed-plugin + random-emoji ]; + }; +} -- cgit v1.2.3 From 0e4035475a359d5015babd46e6d5b1e5ebc84183 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 17 Jun 2019 08:01:42 +0200 Subject: ma firecracker: add config for rk3399 --- makefu/1systems/firecracker/config.nix | 25 ++++++++++++++++ makefu/1systems/firecracker/hardware-config.nix | 30 +++++++++++++++++++ makefu/1systems/firecracker/source.nix | 4 +++ makefu/1systems/sdcard/config.nix | 40 +++++++++++++++++++++++++ makefu/1systems/sdcard/kernel.nix | 15 ++++++++++ makefu/1systems/sdcard/source.nix | 3 ++ 6 files changed, 117 insertions(+) create mode 100644 makefu/1systems/firecracker/config.nix create mode 100644 makefu/1systems/firecracker/hardware-config.nix create mode 100644 makefu/1systems/firecracker/source.nix create mode 100644 makefu/1systems/sdcard/config.nix create mode 100644 makefu/1systems/sdcard/kernel.nix create mode 100644 makefu/1systems/sdcard/source.nix diff --git a/makefu/1systems/firecracker/config.nix b/makefu/1systems/firecracker/config.nix new file mode 100644 index 000000000..87f500287 --- /dev/null +++ b/makefu/1systems/firecracker/config.nix @@ -0,0 +1,25 @@ +{ config, lib, pkgs, ... }: +let + primaryInterface = "eth0"; +in { + imports = [ + + ./hardware-config.nix + # + { environment.systemPackages = with pkgs;[ rsync screen curl git ];} + + # +# configure your hw: +# + ]; + krebs = { + enable = true; + tinc.retiolum.enable = true; + build.host = config.krebs.hosts.firecracker; + }; + networking.firewall.trustedInterfaces = [ primaryInterface ]; + documentation.info.enable = false; + documentation.man.enable = false; + services.nixosManual.enable = false; + sound.enable = false; +} diff --git a/makefu/1systems/firecracker/hardware-config.nix b/makefu/1systems/firecracker/hardware-config.nix new file mode 100644 index 000000000..b821a3375 --- /dev/null +++ b/makefu/1systems/firecracker/hardware-config.nix @@ -0,0 +1,30 @@ +{ pkgs, lib, ... }: +{ + boot.kernelParams = lib.mkForce ["console=ttyS2,1500000n8" "earlycon=uart8250,mmio32,0xff1a0000" "earlyprintk"]; + boot.loader.grub.enable = false; + boot.loader.generic-extlinux-compatible.enable = true; + boot.loader.generic-extlinux-compatible.configurationLimit = 1; + boot.loader.generationsDir.enable = lib.mkDefault false; + boot.supportedFilesystems = lib.mkForce [ "vfat" ]; + + boot.tmpOnTmpfs = lib.mkForce false; + boot.cleanTmpDir = true; + hardware.enableRedistributableFirmware = true; + + ## wifi not working, will be fixed with https://github.com/NixOS/nixpkgs/pull/53747 + boot.kernelPackages = pkgs.linuxPackages_latest; + networking.wireless.enable = true; + # File systems configuration for using the installer's partition layout + swapDevices = [ { device = "/var/swap"; size = 4096; } ]; + fileSystems = { + "/boot" = { + device = "/dev/disk/by-label/NIXOS_BOOT"; + fsType = "vfat"; + }; + "/" = { + device = "/dev/disk/by-label/NIXOS_SD"; + fsType = "ext4"; + }; + }; + +} diff --git a/makefu/1systems/firecracker/source.nix b/makefu/1systems/firecracker/source.nix new file mode 100644 index 000000000..22c40039e --- /dev/null +++ b/makefu/1systems/firecracker/source.nix @@ -0,0 +1,4 @@ +{ + name="cake"; + full = true; +} diff --git a/makefu/1systems/sdcard/config.nix b/makefu/1systems/sdcard/config.nix new file mode 100644 index 000000000..4e3c22a30 --- /dev/null +++ b/makefu/1systems/sdcard/config.nix @@ -0,0 +1,40 @@ +{ config, pkgs, lib, ... }: +let + kernel = pkgs.callPackage ./kernel.nix { + kernelPatches = with pkgs.kernelPatches; [ + # kernelPatches.bridge_stp_helper + # kernelPatches.modinst_arg_list_too_long + ]; + }; +in +{ + imports = [ + + # + ]; + # TODO: NIX_PATH and nix.nixPath are being set by default.nix right now + # cd ~/stockholm ; nix build config.system.build.sdImage -I nixos-config=makefu/1systems/sdcard/config.nix -f /home/makefu/nixpkgs/nixos + + boot.kernelParams = ["console=ttyS2,1500000" "earlycon=uart8250,mmio32,0xff1a0000"]; + # boot.kernelPackages = pkgs.linuxPackages_latest; + boot.kernelPackages = pkgs.linuxPackagesFor kernel; + boot.supportedFilesystems = lib.mkForce [ "vfat" "f2fs" "xfs" "ntfs" "cifs" ]; + + # krebs.hidden-ssh.enable = true; + environment.systemPackages = with pkgs; [ + aria2 + ddrescue + ]; + environment.extraInit = '' + EDITOR=vim + ''; + # iso-specific + services.openssh = { + enable = true; + hostKeys = [ + { bits = 8192; type = "ed25519"; path = "/etc/ssh/ssh_host_ed25519_key"; } + ]; + }; + # enable ssh in the iso boot process + systemd.services.sshd.wantedBy = lib.mkForce [ "multi-user.target" ]; +} diff --git a/makefu/1systems/sdcard/kernel.nix b/makefu/1systems/sdcard/kernel.nix new file mode 100644 index 000000000..df5e7ada9 --- /dev/null +++ b/makefu/1systems/sdcard/kernel.nix @@ -0,0 +1,15 @@ +{ fetchFromGitLab, buildLinux, ... } @ args: +buildLinux (args // rec { + version = "4.4.55"; + modDirVersion = "4.4.55"; + extraMeta.branch = "4.4"; + defconfig = "firefly_linux_defconfig"; + + src = fetchFromGitLab { + owner = "TeeFirefly"; + repo = "linux-kernel"; + rev = "firefly_0821_release"; + sha256 = "1fwj9cm5ysz286znrr3fyrhfn903m84i7py4rv3y3h9avxb3zl1r"; + }; + extraMeta.platforms = [ "aarch64-linux" ]; +} // (args.argsOverride or {})) diff --git a/makefu/1systems/sdcard/source.nix b/makefu/1systems/sdcard/source.nix new file mode 100644 index 000000000..6bef8ada9 --- /dev/null +++ b/makefu/1systems/sdcard/source.nix @@ -0,0 +1,3 @@ +{ + name="iso"; +} -- cgit v1.2.3 From 405d9555e4cf2fc171900f03621acfd523641dee Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 18 Jun 2019 07:47:49 +0200 Subject: ma mail: pin tarball --- makefu/2configs/mail/mail.euer.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/makefu/2configs/mail/mail.euer.nix b/makefu/2configs/mail/mail.euer.nix index d27b888a7..f51e54b80 100644 --- a/makefu/2configs/mail/mail.euer.nix +++ b/makefu/2configs/mail/mail.euer.nix @@ -1,7 +1,11 @@ { config, pkgs, ... }: { imports = [ - (builtins.fetchTarball "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/v2.2.1/nixos-mailserver-v2.2.1.tar.gz") + (builtins.fetchTarball { + url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/v2.2.1/nixos-mailserver-v2.2.1.tar.gz"; + sha256 = "03d49v8qnid9g9rha0wg2z6vic06mhp0b049s3whccn1axvs2zzx"; + } + ) ]; mailserver = { -- cgit v1.2.3 From 335d15d4ecd6111105e3f3db87846bd52577cb80 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 15 Jun 2019 00:53:35 +0200 Subject: external: add rilke.w --- krebs/3modules/external/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/krebs/3modules/external/default.nix b/krebs/3modules/external/default.nix index 70c49cfcf..bdbfd1cb8 100644 --- a/krebs/3modules/external/default.nix +++ b/krebs/3modules/external/default.nix @@ -241,6 +241,13 @@ in { }; }; }; + rilke = { + owner = config.krebs.users.kmein; + nets.wiregrill = { + aliases = [ "rilke.w" ]; + wireguard.pubkey = "09yVPHL/ucvqc6V5n7vFQ2Oi1LBMdwQZDL+7jBwy+iQ="; + }; + }; rock = { owner = config.krebs.users.Mic92; nets = { @@ -497,4 +504,3 @@ in { }; }; } - -- cgit v1.2.3 From f7134008f1f401fee7b21ed844232aa37daa5b38 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 15 Jun 2019 12:20:18 +0200 Subject: nixpkgs: e2883c3 -> 1601f55 --- krebs/nixpkgs.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/krebs/nixpkgs.json b/krebs/nixpkgs.json index 340b926ce..d294ca6d1 100644 --- a/krebs/nixpkgs.json +++ b/krebs/nixpkgs.json @@ -1,7 +1,7 @@ { "url": "https://github.com/NixOS/nixpkgs-channels", - "rev": "e2883c31628ea0f3e00f899062327468a20d1aa1", - "date": "2019-05-27T17:09:30-04:00", - "sha256": "1xrpd8ykr8g3h4b33z69vngh6hfayi51jajbnfm6phhpwgd6mmld", + "rev": "1601f559e89ba71091faa26888711d4dd24c2d4d", + "date": "2019-06-14T16:14:30-04:00", + "sha256": "0iayyz9617mz6424spwbi9qvmcl8hiql42czxg8mi4ycq4p1k0dx", "fetchSubmodules": false } -- cgit v1.2.3 From 5eaa8844e38a83cefb171042d7528bb8496dcb1e Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 15 Jun 2019 18:24:06 +0200 Subject: external: add wilde.r (kmein) --- krebs/3modules/external/default.nix | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/krebs/3modules/external/default.nix b/krebs/3modules/external/default.nix index bdbfd1cb8..ac656f463 100644 --- a/krebs/3modules/external/default.nix +++ b/krebs/3modules/external/default.nix @@ -43,6 +43,31 @@ in { }; }; }; + wilde = { + owner = config.krebs.users.kmein; + nets = { + retiolum = { + ip4.addr = "10.243.2.4"; + aliases = [ "wilde.r" ]; + tinc.pubkey = '' + -----BEGIN PUBLIC KEY----- + MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtz/MY5OSxJqrEMv6Iwjk + g/V58MATljj+2bmOuOuPui/AUYHEZX759lHW4MgLjYdNbZEoVq8UgkxNk0KPGlSg + 2lsJ7FneCU7jBSE2iLT1aHuNFFa56KzSThFUl6Nj6Vyg5ghSmDF2tikurtG2q+Ay + uxf5/yEhFUPc1ZxmvJDqVHMeW5RZkuKXH00C7yN+gdcPuuFEFq+OtHNkBVmaxu7L + a8Q6b/QbrwQJAR9FAcm5WSQIj2brv50qnD8pZrU4loVu8dseQIicWkRowC0bzjAo + IHZTbF/S+CK0u0/q395sWRQJISkD+WAZKz5qOGHc4djJHBR3PWgHWBnRdkYqlQYM + C9zA/n4I+Y2BEfTWtgkD2g0dDssNGP5dlgFScGmRclR9pJ/7dsIbIeo9C72c6q3q + sg0EIWggQ8xyWrUTXIMoDXt37htlTSnTgjGsuwRzjotAEMJmgynWRf3br3yYChrq + 10Exq8Lej+iOuKbdAXlwjKEk0qwN7JWft3OzVc2DMtKf7rcZQkBoLfWKzaCTQ4xo + 1Y7d4OlcjbgrkLwHltTaShyosm8kbttdeinyBG1xqQcK11pMO43GFj8om+uKrz57 + lQUVipu6H3WIVGnvLmr0e9MQfThpC1em/7Aq2exn1JNUHhCdEho/mK2x/doiiI+0 + QAD64zPmuo9wsHnSMR2oKs0CAwEAAQ== + -----END PUBLIC KEY----- + ''; + }; + }; + }; dpdkm = { owner = config.krebs.users.Mic92; nets = rec { -- cgit v1.2.3 From 743ee8dade0c8057235346dd0852645cd83ac8c6 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 19 Jun 2019 10:33:30 +0200 Subject: ma 0tests/secrets: add voicerss.apikey --- makefu/0tests/data/secrets/hass/voicerss.apikey | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 makefu/0tests/data/secrets/hass/voicerss.apikey diff --git a/makefu/0tests/data/secrets/hass/voicerss.apikey b/makefu/0tests/data/secrets/hass/voicerss.apikey new file mode 100644 index 000000000..e69de29bb -- cgit v1.2.3 From f880fb21ca540506ba27e49c6ba92aa83923cd43 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 19 Jun 2019 19:19:39 +0200 Subject: ma extra-gui: no more rambox --- krebs/1systems/puyak/config.nix | 7 ++----- makefu/2configs/tools/extra-gui.nix | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/krebs/1systems/puyak/config.nix b/krebs/1systems/puyak/config.nix index af11c6944..f9b83ef21 100644 --- a/krebs/1systems/puyak/config.nix +++ b/krebs/1systems/puyak/config.nix @@ -7,13 +7,13 @@ - + ]; krebs.build.host = config.krebs.hosts.puyak; @@ -59,10 +59,7 @@ }; }; - services.logind.extraConfig = '' - HandleLidSwitch=ignore - ''; - + services.logind.lidSwitch = "ignore"; services.udev.extraRules = '' SUBSYSTEM=="net", ATTR{address}=="8c:70:5a:b2:84:58", NAME="wl0" SUBSYSTEM=="net", ATTR{address}=="3c:97:0e:07:b9:14", NAME="et0" diff --git a/makefu/2configs/tools/extra-gui.nix b/makefu/2configs/tools/extra-gui.nix index dfb4183df..5f8614719 100644 --- a/makefu/2configs/tools/extra-gui.nix +++ b/makefu/2configs/tools/extra-gui.nix @@ -14,6 +14,6 @@ saleae-logic gitAndTools.gitFull signal-desktop - rambox + # rambox ]; } -- cgit v1.2.3 From 0897d8619a2846377bb5843ad432552d99b12cfc Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 19 Jun 2019 11:36:55 +0200 Subject: nixpkgs: 1601f55 -> f01ed7b --- krebs/nixpkgs.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/krebs/nixpkgs.json b/krebs/nixpkgs.json index d294ca6d1..53340de9e 100644 --- a/krebs/nixpkgs.json +++ b/krebs/nixpkgs.json @@ -1,7 +1,7 @@ { "url": "https://github.com/NixOS/nixpkgs-channels", - "rev": "1601f559e89ba71091faa26888711d4dd24c2d4d", - "date": "2019-06-14T16:14:30-04:00", - "sha256": "0iayyz9617mz6424spwbi9qvmcl8hiql42czxg8mi4ycq4p1k0dx", + "rev": "f01ed7b38aaa1d5e52951ecf92d06b600eb9e3c8", + "date": "2019-06-18T11:50:10+02:00", + "sha256": "0pnnzss0pig7xh9x9jyyphrnir7smln71ig3h6asv2y3jl6xs9p6", "fetchSubmodules": false } -- cgit v1.2.3 From 61d5ce157fa82782ef3e8651b3ceb2f798dbe6e4 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 19 Jun 2019 15:22:37 +0200 Subject: nixpkgs: f01ed7b -> d77e3bd --- krebs/nixpkgs.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/krebs/nixpkgs.json b/krebs/nixpkgs.json index 53340de9e..4118a1dd6 100644 --- a/krebs/nixpkgs.json +++ b/krebs/nixpkgs.json @@ -1,7 +1,7 @@ { "url": "https://github.com/NixOS/nixpkgs-channels", - "rev": "f01ed7b38aaa1d5e52951ecf92d06b600eb9e3c8", - "date": "2019-06-18T11:50:10+02:00", - "sha256": "0pnnzss0pig7xh9x9jyyphrnir7smln71ig3h6asv2y3jl6xs9p6", + "rev": "d77e3bd661354ea775a8cacc97bb59ddde513c09", + "date": "2019-06-18T23:08:17+02:00", + "sha256": "1m82zs00n6nc0pkdpmd9amm013qxwksjfhzcm6gck3p469q7n866", "fetchSubmodules": false } -- cgit v1.2.3 From 75f8b34296a237f350c47147e3a4cb313862e7f5 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 28 Apr 2019 14:35:10 +0200 Subject: krops: 1.11.1 -> 1.14.0 --- submodules/krops | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/krops b/submodules/krops index 5b8fb8dc0..ee41207df 160000 --- a/submodules/krops +++ b/submodules/krops @@ -1 +1 @@ -Subproject commit 5b8fb8dc0ee14672d7fd533bd98635b8725dbb29 +Subproject commit ee41207df1ce718e0b154ed8047384118a0133a4 -- cgit v1.2.3 From 8225afec5b2e853d2e4eeae27adc5a39efcdae17 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 20 Jun 2019 22:21:56 +0200 Subject: wolf.r: init shack/prometheus config --- krebs/1systems/wolf/config.nix | 9 +- krebs/2configs/shack/prometheus/node.nix | 27 ++++ krebs/2configs/shack/prometheus/server.nix | 195 +++++++++++++++++++++++++++++ krebs/2configs/shack/prometheus/unifi.nix | 10 ++ 4 files changed, 239 insertions(+), 2 deletions(-) create mode 100644 krebs/2configs/shack/prometheus/node.nix create mode 100644 krebs/2configs/shack/prometheus/server.nix create mode 100644 krebs/2configs/shack/prometheus/unifi.nix diff --git a/krebs/1systems/wolf/config.nix b/krebs/1systems/wolf/config.nix index 7ca0f0ec1..d684dcd1c 100644 --- a/krebs/1systems/wolf/config.nix +++ b/krebs/1systems/wolf/config.nix @@ -40,11 +40,16 @@ in ## Collect local statistics via collectd and send to collectd - ## write collectd statistics to wolf.shack - + { services.influxdb.enable = true; } + + + + # home-assistant + { services.influxdb.enable = true; } + ]; # use your own binary cache, fallback use cache.nixos.org (which is used by # apt-cacher-ng in first place) diff --git a/krebs/2configs/shack/prometheus/node.nix b/krebs/2configs/shack/prometheus/node.nix new file mode 100644 index 000000000..5462464d5 --- /dev/null +++ b/krebs/2configs/shack/prometheus/node.nix @@ -0,0 +1,27 @@ +{ config, lib, pkgs, ... }: +{ + networking.firewall.allowedTCPPorts = [ 9100 ]; + + services.prometheus.exporters.node = { + enable = true; + enabledCollectors = [ + "conntrack" + "diskstats" + "entropy" + "filefd" + "filesystem" + "loadavg" + "mdadm" + "meminfo" + "netdev" + "netstat" + "stat" + "time" + "vmstat" + "systemd" + "logind" + "interrupts" + "ksmd" + ]; + }; +} diff --git a/krebs/2configs/shack/prometheus/server.nix b/krebs/2configs/shack/prometheus/server.nix new file mode 100644 index 000000000..c936f2531 --- /dev/null +++ b/krebs/2configs/shack/prometheus/server.nix @@ -0,0 +1,195 @@ +{ pkgs, lib, config, ... }: +# from https://gist.github.com/globin/02496fd10a96a36f092a8e7ea0e6c7dd +{ + networking = { + firewall.allowedTCPPorts = [ + 3000 # grafana + 9090 # prometheus + 9093 # alertmanager + ]; + useDHCP = true; + }; + + services = { + prometheus = { + enable = true; + extraFlags = [ + "-storage.local.retention 8760h" + "-storage.local.series-file-shrink-ratio 0.3" + "-storage.local.memory-chunks 2097152" + "-storage.local.max-chunks-to-persist 1048576" + "-storage.local.index-cache-size.fingerprint-to-metric 2097152" + "-storage.local.index-cache-size.fingerprint-to-timerange 1048576" + "-storage.local.index-cache-size.label-name-to-label-values 2097152" + "-storage.local.index-cache-size.label-pair-to-fingerprints 41943040" + ]; + alertmanagerURL = [ "http://localhost:9093" ]; + rules = [ + '' + ALERT node_down + IF up == 0 + FOR 5m + LABELS { + severity="page" + } + ANNOTATIONS { + summary = "{{$labels.alias}}: Node is down.", + description = "{{$labels.alias}} has been down for more than 5 minutes." + } + ALERT node_systemd_service_failed + IF node_systemd_unit_state{state="failed"} == 1 + FOR 4m + LABELS { + severity="page" + } + ANNOTATIONS { + summary = "{{$labels.alias}}: Service {{$labels.name}} failed to start.", + description = "{{$labels.alias}} failed to (re)start service {{$labels.name}}." + } + ALERT node_filesystem_full_90percent + IF sort(node_filesystem_free{device!="ramfs"} < node_filesystem_size{device!="ramfs"} * 0.1) / 1024^3 + FOR 5m + LABELS { + severity="page" + } + ANNOTATIONS { + summary = "{{$labels.alias}}: Filesystem is running out of space soon.", + description = "{{$labels.alias}} device {{$labels.device}} on {{$labels.mountpoint}} got less than 10% space left on its filesystem." + } + ALERT node_filesystem_full_in_4h + IF predict_linear(node_filesystem_free{device!="ramfs"}[1h], 4*3600) <= 0 + FOR 5m + LABELS { + severity="page" + } + ANNOTATIONS { + summary = "{{$labels.alias}}: Filesystem is running out of space in 4 hours.", + description = "{{$labels.alias}} device {{$labels.device}} on {{$labels.mountpoint}} is running out of space of in approx. 4 hours" + } + ALERT node_filedescriptors_full_in_3h + IF predict_linear(node_filefd_allocated[1h], 3*3600) >= node_filefd_maximum + FOR 20m + LABELS { + severity="page" + } + ANNOTATIONS { + summary = "{{$labels.alias}} is running out of available file descriptors in 3 hours.", + description = "{{$labels.alias}} is running out of available file descriptors in approx. 3 hours" + } + ALERT node_load1_90percent + IF node_load1 / on(alias) count(node_cpu{mode="system"}) by (alias) >= 0.9 + FOR 1h + LABELS { + severity="page" + } + ANNOTATIONS { + summary = "{{$labels.alias}}: Running on high load.", + description = "{{$labels.alias}} is running with > 90% total load for at least 1h." + } + ALERT node_cpu_util_90percent + IF 100 - (avg by (alias) (irate(node_cpu{mode="idle"}[5m])) * 100) >= 90 + FOR 1h + LABELS { + severity="page" + } + ANNOTATIONS { + summary = "{{$labels.alias}}: High CPU utilization.", + description = "{{$labels.alias}} has total CPU utilization over 90% for at least 1h." + } + ALERT node_ram_using_90percent + IF node_memory_MemFree + node_memory_Buffers + node_memory_Cached < node_memory_MemTotal * 0.1 + FOR 30m + LABELS { + severity="page" + } + ANNOTATIONS { + summary="{{$labels.alias}}: Using lots of RAM.", + description="{{$labels.alias}} is using at least 90% of its RAM for at least 30 minutes now.", + } + '' + ]; + scrapeConfigs = [ + { + job_name = "node"; + scrape_interval = "10s"; + static_configs = [ + { + targets = [ + "localhost:9100" + ]; + labels = { + alias = "wolf.shack"; + }; + } + { + targets = [ + "localhost:9130" + ]; + labels = { + alias = "unifi.shack"; + }; + } + { + targets = [ + "10.42.22.184:9100" # puyak.shack + ]; + labels = { + alias = "puyak.shack"; + }; + } + { + targets = [ + "phenylbutazon.shack:9100" + ]; + labels = { + alias = "phenylbutazon.shack"; + }; + } + { + targets = [ + "ibuprofen.shack:9100" + ]; + labels = { + alias = "ibuprofen.shack"; + }; + } + ]; + } + ]; + alertmanager = { + enable = true; + listenAddress = "0.0.0.0"; + configuration = { + "global" = { + "smtp_smarthost" = "smtp.example.com:587"; + "smtp_from" = "alertmanager@example.com"; + }; + "route" = { + "group_by" = [ "alertname" "alias" ]; + "group_wait" = "30s"; + "group_interval" = "2m"; + "repeat_interval" = "4h"; + "receiver" = "team-admins"; + }; + "receivers" = [ + { + "name" = "team-admins"; + "email_configs" = [ + { + "to" = "devnull@example.com"; + "send_resolved" = true; + } + ]; + "webhook_configs" = [ + { + "url" = "https://example.com/prometheus-alerts"; + "send_resolved" = true; + } + ]; + } + ]; + }; + }; + }; + }; +} diff --git a/krebs/2configs/shack/prometheus/unifi.nix b/krebs/2configs/shack/prometheus/unifi.nix new file mode 100644 index 000000000..401ecb024 --- /dev/null +++ b/krebs/2configs/shack/prometheus/unifi.nix @@ -0,0 +1,10 @@ +{lib, ... }: +{ + services.prometheus.exporters.unifi = { + enable = true; + unifiAddress = "https://unifi.shack:8443/"; + unifiInsecure = true; + unifiUsername = "prometheus"; # needed manual login after setup to confirm the password + unifiPassword = lib.replaceChars ["\n"] [""] (builtins.readFile ); + }; +} -- cgit v1.2.3 From 32a808f9ebfb02877e71f75b38541533c8ea1bdd Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 20 Jun 2019 22:46:58 +0200 Subject: 0tests: add shack/unifi-prometheus-pw --- krebs/0tests/data/secrets/shack/unifi-prometheus-pw | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 krebs/0tests/data/secrets/shack/unifi-prometheus-pw diff --git a/krebs/0tests/data/secrets/shack/unifi-prometheus-pw b/krebs/0tests/data/secrets/shack/unifi-prometheus-pw new file mode 100644 index 000000000..e69de29bb -- cgit v1.2.3 From 4ecfee1606645c14dc258c34e087342306f698b5 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 28 Jun 2019 22:01:27 +0200 Subject: ma bureautomation: add 10h timers for all participants move into combination folders, fix mittagessen, add working tts with random output --- .../bureautomation/automation/10h_timer.nix | 154 --------- .../bureautomation/automation/bureau-shutdown.nix | 4 +- .../bureautomation/combination/10h_timers.nix | 383 +++++++++++++++++++++ .../2configs/bureautomation/combination/README.md | 3 + .../bureautomation/combination/mittagessen.nix | 89 +++++ makefu/2configs/bureautomation/hass.nix | 56 +-- .../2configs/bureautomation/script/multi_blink.nix | 8 + 7 files changed, 516 insertions(+), 181 deletions(-) delete mode 100644 makefu/2configs/bureautomation/automation/10h_timer.nix create mode 100644 makefu/2configs/bureautomation/combination/10h_timers.nix create mode 100644 makefu/2configs/bureautomation/combination/README.md create mode 100644 makefu/2configs/bureautomation/combination/mittagessen.nix diff --git a/makefu/2configs/bureautomation/automation/10h_timer.nix b/makefu/2configs/bureautomation/automation/10h_timer.nix deleted file mode 100644 index dd747114e..000000000 --- a/makefu/2configs/bureautomation/automation/10h_timer.nix +++ /dev/null @@ -1,154 +0,0 @@ -[ - { alias = "start Felix 10h"; - trigger = { - platform = "state"; - entity_id = [ "device_tracker.felix_phone" "device_tracker.felix_laptop" ]; - from = "not_home"; - to = "home"; - }; - condition = { - condition = "and"; - conditions = [ - { - condition = "state"; - entity_id = "timer.felix_10h"; - state = "idle"; - } - { - condition = "time"; - after = "06:00:00"; - before = "12:00:00"; - } - ]; - }; - action = [ - { service = "timer.start"; - entity_id = [ "timer.felix_10h" "timer.felix_8_30h" "timer.felix_7h" ] ; - } - { service = "homeassistant.turn_on"; - entity_id = [ - "script.buzz_red_led_fast" - "script.blitz_10s" - ]; - } - { service = "light.turn_on"; - data = { - effect = "2"; - entity_id = [ "light.status_felix" ]; - }; - } - ]; - } - - { alias = "Disable Felix timer at button press"; - trigger = { - platform = "state"; - entity_id = "binary_sensor.redbutton"; - to = "on"; - }; - condition = { - condition = "and"; - conditions = [ - { - condition = "state"; - entity_id = "timer.felix_10h"; - state = "active"; - } - { - condition = "time"; - after = "12:00:00"; - before = "22:00:00"; - } - ]; - }; - action = - [ - { - service = "timer.cancel"; - entity_id = [ "timer.felix_10h" "timer.felix_8_30h" "timer.felix_7h" ]; - } - { - service = "homeassistant.turn_on"; - entity_id = [ "script.buzz_red_led_fast" ]; - } - { - service = "homeassistant.turn_off"; - entity_id = [ "light.status_felix" ]; - } - ]; - } - - { - alias = "Genug gearbeitet Felix"; - trigger = - { - platform = "event"; - event_type = "timer.finished"; - event_data.entity_id = "timer.felix_7h"; - }; - action = - [ - { service = "light.turn_on"; - data = { - rgb_color= [0 255 0]; - # effect = "0"; - entity_id = [ "light.status_felix" ]; - }; - } - ]; - } - - { - alias = "nun aber nach hause"; - trigger = - { - platform = "event"; - event_type = "timer.finished"; - event_data.entity_id = "timer.felix_8_30h"; - }; - action = - [ - { service = "light.turn_on"; - data = { - rgb_color= [255 255 0]; - # effect = "0"; - entity_id = [ "light.status_felix" ]; - }; - } - ]; - } - - { - alias = "Zu lange Felix!"; - trigger = - { - platform = "event"; - event_type = "timer.finished"; - event_data.entity_id = "timer.felix_10h"; - }; - action = - [ - { - service = "notify.telegrambot"; - data = { - title = "Zu lange Felix!"; - message = "Du bist schon 10 Stunden auf Arbeit, geh jetzt gefälligst nach Hause!"; - }; - } - { - service = "homeassistant.turn_on"; - entity_id = [ - "script.buzz_red_led" - "script.blitz_10s" - ]; - } - { service = "light.turn_on"; - data = { - rgb_color= [255 0 0]; - effect = "0"; - entity_id = [ "light.status_felix" ]; - }; - } - ]; - } -] diff --git a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix index d54d9762a..3fa23a837 100644 --- a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix +++ b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix @@ -25,7 +25,7 @@ } { service = "tts.google_say"; - entity_id = "media_player.kodi"; + entity_id = "media_player.mpd"; data = { message = "Willkommen in deinem Lieblingsbüro"; language = "de"; @@ -35,7 +35,7 @@ service = "notify.telegrambot"; data = { title = "Bureau Startup"; - message = "Willkommen {{ trigger.platform }}"; + message = "Das Büro wurde eröffnet"; }; } ]; diff --git a/makefu/2configs/bureautomation/combination/10h_timers.nix b/makefu/2configs/bureautomation/combination/10h_timers.nix new file mode 100644 index 000000000..d398e8a34 --- /dev/null +++ b/makefu/2configs/bureautomation/combination/10h_timers.nix @@ -0,0 +1,383 @@ +{lib, ... }: +let + persons = [ "frank" "daniel" "thorsten" "carsten" "thierry" "ecki" + # "felix" # custom actions + ]; + random_zu_lange = name: ''{{ [ + "Du musst jetzt endlich nach Hause gehen ${name}!", + "10 Stunden sind rum, bald schenkst du den Franzosen deine Lebenszeit", + "Nur eine Minute über 10 Stunden kann zu einer Stunde Arbeit für Thorsten werden, ${name}.", + "In 10 Minuten kommt dich der Security Mann holen, ${name}", + "Zu lange, ${name}!" ] | random }}'' ; + + + random_announce = name: ''{{ [ + "Guten Tag ${name}!", + "${name} is in da House", + "Ahoi ${name}", + "Moinsen ${name}", + "Moin Moin ${name}", + "Palim, Palim ${name}", + "Vorwärts Genosse ${name}", + "Gemeinsame Grüße, Genosse ${name}", + "Sozialistische Grüße, Genosse ${name}", + "Konzentrierte Grüße, Genosse ${name}", + "Ach, der ${name} ist auch wieder da...", + "Nicht ${name} schon wieder", + "Tri tra tralala, der ${name} ist wieder da.", + "Na sieh mal einer an, ${name} hat es auch her geschafft", + "Wer ist im Büro eingetroffen? ${name} ist es!", + "Willkommen in deinem Lieblingsbüro, ${name}.", + "Klopf, Klopf, wer ist da? ${name} ist da!", + "Messer, Gabel, Schere, Licht sind für kleinen ${name} nicht.", + "Ich kenne ein Geheimnis, ${name} ist abgekommen", + "Wir sind ${name}. Sie werden assimiliert werden", + "Achtung, es erfolgt eine Durchsage. ${name} ist eingetroffen", + "Die Scanner haben eine dem System bekannte Lebensform mit dem Namen ${name} detektiert", + "Das Büro sieht dich, ${name}", + "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 Punkte verschlechtert, bitte alle Fenster öffnen.", + "${name} arbeitet gern für seinen Konzern", + "${name} ist nur froh im Großraumbüro", + "Für ${name} ist die schönste Zeit ... die Arbeit", + "Ein Fleißbienchen für ${name} zum rechtzeitigen Erscheinen im Büro", + "${name} ist heute wohl doch nicht im Office Home", + "${name} ist bereit für einen Tag voller Meetings", + "Trotz schwerer Männergrippe ist ${name} heute im Büro erschienen.", + "${name} kenne keine Parteien mehr, ${name} kenne nur noch Arbeitsplätze", + "${name}, Frage nicht, was dein Arbeitsplatz für dich tun kann. Frage, was du für deinen Arbeitsplatz tun kannst", + "${name} läuft bis in den Jemen - für sein Unternehmen. ${name} schwimmt bis nach Birma - für meine Firma", + "Der Cyberian ${name} ist gekommen um die Bahnwelt vor Cyber-Angriffen zu schützen", + "Alles paletto im Ghetto, ${name}?", + "Hach, ${name}, wenn du hier rein kommst fühlt es sich gleich wieder an wie Montag.", + "Oh nein, nicht schon wieder ${name}", + "Wer wohnt in der Ananas ganz tief im Meer? ${name} Schwammkopf!", + "Arbeit ist Freizeit! Wachstum ist Fortschritt! Sicherheit ist Freiheit!", + "Willkommen ${name}"] | random }}'' ; + patterns = [ + [1000 500 250] # TODO: maybe even play a short audio announcement? + [150 150 150] + [255 255] + [500 500 100] + [100 1000 100] + # [125 250 500] + ]; + tmr_10h = name: { + "${name}_10h" = { + name = "${name} 10h Timer"; + duration = "10:00:00"; + }; + }; + 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); + }; + + buzz_user = name: delays: { "buzz_${name}" = (multi_flash { + entity = "light.redbutton_buzzer"; + inherit delays; + alias = "Red Button Buzz ${name}"; + }); + }; + + zu_lange_user = name: + { "announce_${name}" = { + alias = "Random Zu Lange ${name}"; + sequence = [ + { service = "media_player.play_media"; + data = { + entity_id = "media_player.mpd"; + media_content_type = "playlist"; + media_content_id = "ansage"; + }; + } + { delay.seconds = 5; } + { service = "tts.google_say"; + entity_id = "media_player.mpd"; + data_template = { + message = random_zu_lange name; + language = "de"; + }; + } + ]; + }; + }; + announce_user = name: + { "announce_${name}" = { + alias = "Random Announce ${name}"; + sequence = [ + { delay.seconds = 10; } + { service = "media_player.play_media"; + data = { + entity_id = "media_player.mpd"; + media_content_type = "playlist"; + media_content_id = "ansage"; + }; + } + { delay.seconds = 5; } + { service = "tts.google_say"; + entity_id = "media_player.mpd"; + data_template = { + message = random_announce name; + language = "de"; + }; + } + ]; + }; + }; + automation_10h = name: [ + { alias = "start ${name} 10h"; + trigger = { + platform = "state"; + # TODO: ecki + entity_id = [ "device_tracker.${name}_phone"]; + from = "not_home"; + to = "home"; + }; + condition = { + condition = "and"; + conditions = [ + { + condition = "state"; + entity_id = "timer.${name}_10h"; + state = "idle"; + } + { + condition = "time"; + after = "06:00:00"; + before = "12:00:00"; + } + ]; + }; + action = [ + { service = "timer.start"; + entity_id = [ "timer.${name}_10h" ] ; + } + { service = "homeassistant.turn_on"; + entity_id = [ + # "script.buzz_${name}" + "script.blitz_10s" + "script.announce_${name}" + ]; + } + ]; + } + + { + alias = "Zu lange ${name}!"; + trigger = + { + platform = "event"; + event_type = "timer.finished"; + event_data.entity_id = "timer.${name}_10h"; + }; + action = + [ + { service = "homeassistant.turn_on"; + entity_id = [ + "script.blitz_10s" + "script.zu_lange_${name}" + ]; + } + ]; + } + ]; +in +{ + timer =lib.fold lib.recursiveUpdate {} + ([ + (tmr_10h "felix") + { felix_8_30h = { + name = "Felix 8_30h Timer"; + duration = "08:30:00"; + }; + felix_7h = { + name = "Felix 7h Timer"; + duration = "07:00:00"; + }; + } + ] ++ (map tmr_10h persons)); + automation = lib.flatten (map automation_10h persons) ++ + [ + { alias = "start Felix 10h"; + trigger = { + platform = "state"; + entity_id = [ "device_tracker.felix_phone" "device_tracker.felix_laptop" ]; + from = "not_home"; + to = "home"; + }; + condition = { + condition = "and"; + conditions = [ + { + condition = "state"; + entity_id = "timer.felix_10h"; + state = "idle"; + } + { + condition = "time"; + after = "06:00:00"; + before = "12:00:00"; + } + ]; + }; + action = [ + { service = "timer.start"; + entity_id = [ "timer.felix_10h" "timer.felix_8_30h" "timer.felix_7h" ] ; + } + { service = "homeassistant.turn_on"; + entity_id = [ + # "script.buzz_felix" + "script.blitz_10s" + ]; + } + { + service = "tts.google_say"; + entity_id = "media_player.mpd"; + data_template = { + message = "Willkommen, Felix!"; + language = "de"; + }; + } + { service = "light.turn_on"; + data = { + effect = "2"; + entity_id = [ "light.status_felix" ]; + }; + } + ]; + } + + { alias = "Disable Felix timer at button press"; + trigger = { + platform = "state"; + entity_id = "binary_sensor.redbutton"; + to = "on"; + }; + condition = { + condition = "and"; + conditions = [ + { + condition = "state"; + entity_id = "timer.felix_10h"; + state = "active"; + } + { + condition = "time"; + after = "12:00:00"; + before = "22:00:00"; + } + ]; + }; + action = + [ + { + service = "timer.cancel"; + entity_id = [ "timer.felix_10h" "timer.felix_8_30h" "timer.felix_7h" ]; + } + { + service = "homeassistant.turn_on"; + entity_id = [ "script.buzz_red_led_fast" ]; + } + { + service = "homeassistant.turn_off"; + entity_id = [ "light.status_felix" ]; + } + ]; + } + + { + alias = "Genug gearbeitet Felix"; + trigger = + { + platform = "event"; + event_type = "timer.finished"; + event_data.entity_id = "timer.felix_7h"; + }; + action = + [ + { service = "light.turn_on"; + data = { + rgb_color= [0 255 0]; + # effect = "0"; + entity_id = [ "light.status_felix" ]; + }; + } + ]; + } + + { + alias = "nun aber nach hause"; + trigger = + { + platform = "event"; + event_type = "timer.finished"; + event_data.entity_id = "timer.felix_8_30h"; + }; + action = + [ + { service = "light.turn_on"; + data = { + rgb_color= [255 255 0]; + # effect = "0"; + entity_id = [ "light.status_felix" ]; + }; + } + ]; + } + + { + alias = "Zu lange Felix!"; + trigger = + { + platform = "event"; + event_type = "timer.finished"; + event_data.entity_id = "timer.felix_10h"; + }; + action = + [ + { + service = "notify.telegrambot"; + data = { + title = "Zu lange Felix!"; + message = "Du bist schon 10 Stunden auf Arbeit, geh jetzt gefälligst nach Hause!"; + }; + } + { + service = "homeassistant.turn_on"; + entity_id = [ + # "script.buzz_felix" + "script.blitz_10s" + ]; + } + { service = "light.turn_on"; + data = { + rgb_color= [255 0 0]; + effect = "0"; + entity_id = [ "light.status_felix" ]; + }; + } + ]; + } + ] + ; + script = lib.fold lib.recursiveUpdate {} ( + (map (ab: buzz_user ab.fst ab.snd) (lib.zipLists persons patterns)) ++ + (map (p: announce_user p) persons) ++ + (map (p: zu_lange_user p) persons) ++ + [ (announce_user "felix" ) (buzz_user "felix" [125 250 500] ) ] + ); +} diff --git a/makefu/2configs/bureautomation/combination/README.md b/makefu/2configs/bureautomation/combination/README.md new file mode 100644 index 000000000..baad87fda --- /dev/null +++ b/makefu/2configs/bureautomation/combination/README.md @@ -0,0 +1,3 @@ +# Combination Folder +files return a dictionary of different types used in home-assistant instead of +a single thing. diff --git a/makefu/2configs/bureautomation/combination/mittagessen.nix b/makefu/2configs/bureautomation/combination/mittagessen.nix new file mode 100644 index 000000000..3ec70998d --- /dev/null +++ b/makefu/2configs/bureautomation/combination/mittagessen.nix @@ -0,0 +1,89 @@ +{ lib, ... }: +let + # TODO: remove redundant code (from multi_blink) via lib + flash_entity = { entity, delay ? 500, count ? 4, alias ? "${entity}_blink_${toString count}_${toString delay}" }: + { + inherit alias; + sequence = lib.flatten (builtins.genList (i: [ + { service = "homeassistant.turn_on"; + data.entity_id = entity; + } + { delay.milliseconds = delay; } + { service = "homeassistant.turn_off"; + data.entity_id = entity; + } + { delay.milliseconds = delay; } + ] + ) count); + }; + # TODO: use influxdb and check if pommes + random_mittagessen = '' {{ [ + "Es ist 12 uhr 30. Der Aramark Gourmettempel hat, wie jeden Tag, wieder die feinsten Köstlichkeiten für euch Vorbereitet", + "Heute bei Aramark: Rezepte aus Ländern, von denen Ihr noch nie gehört habt, Deutsch zubereitet", + "Heute bei Aramark im Angebot: Scheiss mit Reis oder Reste von Freitag", + "MHHHH es ist wieder mal so weit, lecker Bayerisch Kraut mit asiatischen Nudeln", + "Es ist 12 Uhr 30 und Heute gibt es Pommes - vielleicht", + "Heute gibt es Pommes - leider nicht einzeln zu verkaufen, da die Schälchen alle sind", + "Heute gibt es Pommes - verarscht! Natürlich gibt es nur salzlosen Reis, oder salzlose Nudeln.", + "Heute auf dem Speiseplan: Sushi vom Vortag", + "Aramark Kantinenessen: Der Hunger treibt es rein, der Geiz hält es drin.", + "Das Essen in der Snackeria sieht heute wie die bessere Alternative aus", + "Heute ist wohl wieder ein Beilagen-Tag", + "Lunch time! Good luck, you will need it!", + "Heute vielleicht lieber doch nur einen Salat?", + "Im Büro ist es eh gerade viel zu warm, also ab zur Kantine", + "Im Büro ist es eh gerade viel zu kalt, also ab zur Kantine", + "Heute scheint die Auswahl wieder sehr schwierig zu sein. Vielleicht doch lieber ein Brötchen mit Fleischkäse vom Bäcker beim Baumarkt?", + "Wer hat hier schon wieder ein Meeting auf 12 Uhr gelegt? Skandal!", + "Jetzt nur noch kurz die Mail fertig schreiben und schon kann es los gehen.", + "Es ist 13 Uhr und die Mittagspause ist bald vorbei .... Kleiner Scherz, es ist erst 12:30, aber Ihr hättet auch nicht wirklich etwas verpasst.", + "Hallo, es ist nun 12 Uhr 30! Dies entspricht der Essenszeit aller Büroinsassen. Bitte begebt euch zur Aramark Essensausgabe um euren menschlichen Bedürfnissen nachzukommen."] | random }}''; +in { + automation = [ + { alias = "Mittagessen"; + trigger = { + platform = "time"; + at = "12:30:00"; + }; + action = [ + { service = "homeassistant.turn_on"; + entity_id = [ + "script.mittagessen_announce" + "script.blitz_10s" + "script.mittagessenlicht" + ]; + } + ]; + } + ]; + script = { + mittagessenlicht = (flash_entity { + entity = "switch.bauarbeiterlampe"; + alias = "Bauarbeiterlampe Mittagessenlicht"; + delay = 1000; + count = 5; + }); + mittagessen_announce = { + alias = "Random Mittagessen announce"; + sequence = [ + { + service = "media_player.play_media"; + data = { + entity_id = "media_player.mpd"; + media_content_type = "playlist"; + media_content_id = "ansage"; + }; + } + { delay.seconds = 5; } + { + service = "tts.google_say"; + entity_id = "media_player.mpd"; + data_template = { + message = random_mittagessen; + language = "de"; + }; + } + ]; + }; + }; +} diff --git a/makefu/2configs/bureautomation/hass.nix b/makefu/2configs/bureautomation/hass.nix index ed9cb0905..05b98243d 100644 --- a/makefu/2configs/bureautomation/hass.nix +++ b/makefu/2configs/bureautomation/hass.nix @@ -1,7 +1,8 @@ { 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 in { networking.firewall.allowedTCPPorts = [ 8123 ]; state = [ "/var/lib/hass/known_devices.yaml" ]; @@ -22,7 +23,7 @@ in { })).override { extraPackages = ps: with ps; [ pkgs.pico2wave - python-forecastio jsonrpc-async jsonrpc-websocket + python-forecastio jsonrpc-async jsonrpc-websocket mpd2 (callPackage ./gtts-token.nix { }) ]; }; @@ -42,6 +43,14 @@ in { } ]; }; + # https://www.home-assistant.io/components/influxdb/ + influxdb = { + database = "hass"; + tags = { + instance = "wbob"; + source = "hass"; + }; + }; mqtt = { broker = "localhost"; port = 1883; @@ -62,23 +71,10 @@ in { }; }; switch = (import ./switch/tasmota_switch.nix) ++ - (import ./switch/rfbridge.nix); + (import ./switch/rfbridge.nix); light = (import ./light/statuslight.nix) ++ - (import ./light/buzzer.nix); - timer = { - felix_10h = { - name = "Felix 10h Timer"; - duration = "10:00:00"; - }; - felix_8_30h = { - name = "Felix 8_30h Timer"; - duration = "08:30:00"; - }; - felix_7h = { - name = "Felix 7h Timer"; - duration = "07:00:00"; - }; - }; + (import ./light/buzzer.nix); + timer = ten_hours.timer; notify = [ { platform = "kodi"; @@ -97,8 +93,15 @@ in { { platform = "kodi"; host = kodi-host; } + { platform = "mpd"; + host = "127.0.0.1"; + } + ]; + script = lib.fold lib.recursiveUpdate {} [ + ((import ./script/multi_blink.nix) {inherit lib;}) + ten_hours.script + mittagessen.script ]; - script = (import ./script/multi_blink.nix) {inherit lib;}; binary_sensor = (import ./binary_sensor/buttons.nix) ++ (import ./binary_sensor/motion.nix); @@ -134,7 +137,7 @@ in { logbook = {}; tts = [ { platform = "google"; - language = "de"; + language = "de"; } { platform = "voicerss"; api_key = builtins.readFile ; @@ -162,8 +165,8 @@ in { "group.switches" ]; }; - automation = [ - ]; + automation = []; + switches = [ "switch.bauarbeiterlampe" "switch.blitzdings" @@ -181,6 +184,7 @@ in { "device_tracker.carsten_phone" "device_tracker.thierry_phone" "device_tracker.frank_phone" + "device_tracker.anthony_phone" # "person.thorsten" # "person.felix" # "person.ecki" @@ -202,6 +206,7 @@ in { "script.blitz_10s" "script.buzz_red_led_fast" "timer.felix_10h" + "timer.frank_10h" "sensor.easy2_dht22_humidity" "sensor.easy2_dht22_temperature" # "binary_sensor.redbutton" @@ -222,9 +227,10 @@ in { # we don't use imports because the expressions do not merge in # home-assistant automation = (import ./automation/bureau-shutdown.nix) ++ - (import ./automation/nachtlicht.nix) ++ - (import ./automation/hass-restart.nix) ++ - (import ./automation/10h_timer.nix); + (import ./automation/nachtlicht.nix) ++ + (import ./automation/hass-restart.nix) ++ + ten_hours.automation ++ + mittagessen.automation; device_tracker = (import ./device_tracker/openwrt.nix ); }; }; diff --git a/makefu/2configs/bureautomation/script/multi_blink.nix b/makefu/2configs/bureautomation/script/multi_blink.nix index bb28dd46f..5076111ac 100644 --- a/makefu/2configs/bureautomation/script/multi_blink.nix +++ b/makefu/2configs/bureautomation/script/multi_blink.nix @@ -1,5 +1,7 @@ {lib, ... }: let + # TODO: flash with different delay + # let an entity blink for X times with a delay of Y milliseconds flash_entity = { entity, delay ? 500, count ? 4, alias ? "${entity}_blink_${toString count}_${toString delay}" }: { @@ -34,4 +36,10 @@ in { count = 1; alias = "blitz for 10 seconds"; }); + schlechteluft = (flash_entity { + entity = "switch.bauarbeiterlampe"; + alias = "Schlechte Luft Lampe 5 secs"; + delay = 5000; + count = 1; + }); } -- cgit v1.2.3 From 828e8bcf463c57793b69ee0f3b03a6bdda8afbda Mon Sep 17 00:00:00 2001 From: jeschli Date: Sun, 30 Jun 2019 17:34:59 +0200 Subject: j krops: add unstable channel --- jeschli/krops.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jeschli/krops.nix b/jeschli/krops.nix index f3964a553..30b06c1e6 100644 --- a/jeschli/krops.nix +++ b/jeschli/krops.nix @@ -9,6 +9,10 @@ (krebs-source { test = test; }) { nixos-config.symlink = "stockholm/jeschli/1systems/${name}/config.nix"; + nixpkgs-unstable.git = { + url = "https://github.com/nixos/nixpkgs-channels"; + ref = "nixos-unstable"; + }; secrets = if test then { file = toString ./2configs/tests/dummy-secrets; } else { -- cgit v1.2.3 From 59a24a1ad53c1a24b1ed8c7455466b66ef16d42b Mon Sep 17 00:00:00 2001 From: jeschli Date: Sun, 30 Jun 2019 17:37:04 +0200 Subject: j brauerei: add unstable as source --- jeschli/1systems/brauerei/config.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/jeschli/1systems/brauerei/config.nix b/jeschli/1systems/brauerei/config.nix index f536801ba..358230117 100644 --- a/jeschli/1systems/brauerei/config.nix +++ b/jeschli/1systems/brauerei/config.nix @@ -2,6 +2,7 @@ let xmonad-jeschli = pkgs.callPackage { inherit config; }; mainUser = config.krebs.build.user.name; + unstable = import { config = { allowUnfree = true; }; }; in { imports = [ -- cgit v1.2.3 From 39e9b99e3f6ac51db5a3004a7fffd25c9122864b Mon Sep 17 00:00:00 2001 From: jeschli Date: Sun, 30 Jun 2019 17:37:42 +0200 Subject: j brauerei: add c++ toolchain for nygma --- jeschli/1systems/brauerei/config.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jeschli/1systems/brauerei/config.nix b/jeschli/1systems/brauerei/config.nix index 358230117..969ae0a4e 100644 --- a/jeschli/1systems/brauerei/config.nix +++ b/jeschli/1systems/brauerei/config.nix @@ -76,7 +76,9 @@ in elixir elmPackages.elm exercism - gcc + gcc9 + ccls + unstable.clang_8 ghc go python37 -- cgit v1.2.3 From 314637bbcc531d9ffd59022e0f29713f60d8649a Mon Sep 17 00:00:00 2001 From: jeschli Date: Sun, 30 Jun 2019 17:38:21 +0200 Subject: j brauerei: add aspell, ispell for spacemacs --- jeschli/1systems/brauerei/config.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jeschli/1systems/brauerei/config.nix b/jeschli/1systems/brauerei/config.nix index 969ae0a4e..aabb4b7ba 100644 --- a/jeschli/1systems/brauerei/config.nix +++ b/jeschli/1systems/brauerei/config.nix @@ -53,6 +53,8 @@ in copyq curl dmenu + aspell + ispell rofi xdotool git -- cgit v1.2.3 From ece7099c3efcc3d1fdcb46d2fd0ca5180371aec3 Mon Sep 17 00:00:00 2001 From: jeschli Date: Sun, 30 Jun 2019 15:55:33 +0000 Subject: j bolide: enable broadcom drivers for wifi --- jeschli/1systems/bolide/config.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/jeschli/1systems/bolide/config.nix b/jeschli/1systems/bolide/config.nix index a9f564f75..b25b29305 100644 --- a/jeschli/1systems/bolide/config.nix +++ b/jeschli/1systems/bolide/config.nix @@ -31,6 +31,7 @@ # networking.hostName = "bolide"; # Define your hostname. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. networking.networkmanager.enable = true; + networking.enableB43Firmware = true; #new # Select internationalisation properties. # i18n = { -- cgit v1.2.3 From 75f168afc854dec821b32db27e2327df2b6652bb Mon Sep 17 00:00:00 2001 From: jeschli Date: Sun, 30 Jun 2019 17:32:29 +0000 Subject: j bolide: remove home-manager --- jeschli/1systems/bolide/config.nix | 22 +---- jeschli/1systems/bolide/home.nix | 171 ------------------------------------- 2 files changed, 3 insertions(+), 190 deletions(-) delete mode 100644 jeschli/1systems/bolide/home.nix diff --git a/jeschli/1systems/bolide/config.nix b/jeschli/1systems/bolide/config.nix index b25b29305..f13a2f8b0 100644 --- a/jeschli/1systems/bolide/config.nix +++ b/jeschli/1systems/bolide/config.nix @@ -3,12 +3,14 @@ # and in the NixOS manual (accessible by running ‘nixos-help’). { config, pkgs, lib, ... }: +let + unstable = import { config = { allowUnfree = true; }; }; +in { imports = [ ./hardware-configuration.nix - # ]; @@ -54,8 +56,6 @@ }; nixpkgs.config.allowUnfree = true; environment.systemPackages = with pkgs; [ - home-manager - wget vim # system helper ag @@ -96,22 +96,6 @@ zathura ]; - home-manager.useUserPackages = true; - home-manager.users.jeschli = { - home.stateVersion = "19.03"; - }; - - home-manager.users.jeschli.home.file = { - ".emacs.d" = { - source = pkgs.fetchFromGitHub { - owner = "jeschli"; - repo = "emacs.d"; - rev = "8ed6c40"; - sha256 = "1q2y478srwp9f58l8cixnd2wj51909gp1z68k8pjlbjy2mrvibs0"; - }; - recursive = true; - }; - }; # Some programs need SUID wrappers, can be configured further or are # started in user sessions. # programs.bash.enableCompletion = true; diff --git a/jeschli/1systems/bolide/home.nix b/jeschli/1systems/bolide/home.nix deleted file mode 100644 index 60fee8b67..000000000 --- a/jeschli/1systems/bolide/home.nix +++ /dev/null @@ -1,171 +0,0 @@ -{ pkgs, ... }: - -{ - home.file = { - ".emacs.d" = { - source = pkgs.fetchFromGitHub { - owner = "jeschli"; - repo = "emacs.d"; - rev = "8ed6c40"; - sha256 = "1q2y478srwp9f58l8cixnd2wj51909gp1z68k8pjlbjy2mrvibs0"; - }; - recursive = true; - }; - ".config/i3/config".text = '' - -set $mod Mod4 - -font pango:monospace 8 - -floating_modifier $mod - -bindsym $mod+Return exec i3-sensible-terminal - -bindsym $mod+Shift+q kill - -bindsym $mod+d exec rofi -modi drun#run -combi-modi drun#run -show combi -show-icons -display-combi run - -bindsym $mod+x exec rofi -modi window -show window -auto-select - -# switch to last used window -bindsym $mod+Tab exec rofi -show window& sleep 0.15 && xdotool key Down - -# change focus -bindsym $mod+j focus left -bindsym $mod+k focus down -bindsym $mod+l focus up -bindsym $mod+semicolon focus right - -# alternatively, you can use the cursor keys: -bindsym $mod+Left focus left -bindsym $mod+Down focus down -bindsym $mod+Up focus up -bindsym $mod+Right focus right - -# Resizing windows by 10 in i3 using keyboard only -bindsym $mod+Ctrl+Shift+Right resize shrink width 10 px or 10 ppt -bindsym $mod+Ctrl+Shift+Up resize grow height 10 px or 10 ppt -bindsym $mod+Ctrl+Shift+Down resize shrink height 10 px or 10 ppt -bindsym $mod+Ctrl+Shift+Left resize grow width 10 px or 10 ppt - -# move focused window -bindsym $mod+Shift+j move left -bindsym $mod+Shift+k move down -bindsym $mod+Shift+l move up -bindsym $mod+Shift+semicolon move right - -# alternatively, you can use the cursor keys: -bindsym $mod+Shift+Left move left -bindsym $mod+Shift+Down move down -bindsym $mod+Shift+Up move up -bindsym $mod+Shift+Right move right - -# split in horizontal orientation -bindsym $mod+h split h - -# split in vertical orientation -bindsym $mod+v split v - -# enter fullscreen mode for the focused container -bindsym $mod+f fullscreen toggle - -# change container layout (stacked, tabbed, toggle split) -bindsym $mod+s layout stacking -bindsym $mod+w layout tabbed -bindsym $mod+e layout toggle split - -# toggle tiling / floating -bindsym $mod+Shift+space floating toggle - -# change focus between tiling / floating windows -bindsym $mod+space focus mode_toggle - -# focus the parent container -bindsym $mod+a focus parent - -# focus the child container -#bindsym $mod+d focus child - -# Define names for default workspaces for which we configure key bindings later on. -# We use variables to avoid repeating the names in multiple places. -set $ws1 "1" -set $ws2 "2" -set $ws3 "3" -set $ws4 "4" -set $ws5 "5" -set $ws6 "6" -set $ws7 "7" -set $ws8 "8" -set $ws9 "9" -set $ws10 "10" - -# switch to workspace -bindsym $mod+1 workspace $ws1 -bindsym $mod+2 workspace $ws2 -bindsym $mod+3 workspace $ws3 -bindsym $mod+4 workspace $ws4 -bindsym $mod+5 workspace $ws5 -bindsym $mod+6 workspace $ws6 -bindsym $mod+7 workspace $ws7 -bindsym $mod+8 workspace $ws8 -bindsym $mod+9 workspace $ws9 -bindsym $mod+0 workspace $ws10 - -# move focused container to workspace -bindsym $mod+Shift+1 move container to workspace $ws1 -bindsym $mod+Shift+2 move container to workspace $ws2 -bindsym $mod+Shift+3 move container to workspace $ws3 -bindsym $mod+Shift+4 move container to workspace $ws4 -bindsym $mod+Shift+5 move container to workspace $ws5 -bindsym $mod+Shift+6 move container to workspace $ws6 -bindsym $mod+Shift+7 move container to workspace $ws7 -bindsym $mod+Shift+8 move container to workspace $ws8 -bindsym $mod+Shift+9 move container to workspace $ws9 -bindsym $mod+Shift+0 move container to workspace $ws10 - -# reload the configuration file -bindsym $mod+Shift+c reload -# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) -bindsym $mod+Shift+r restart -# exit i3 (logs you out of your X session) -bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" - -bindsym $mod+p exec i3-sensible-pager - -# resize window (you can also use the mouse for that) -mode "resize" { - # These bindings trigger as soon as you enter the resize mode - - # Pressing left will shrink the window’s width. - # Pressing right will grow the window’s width. - # Pressing up will shrink the window’s height. - # Pressing down will grow the window’s height. - bindsym j resize shrink width 10 px or 10 ppt - bindsym k resize grow height 10 px or 10 ppt - bindsym l resize shrink height 10 px or 10 ppt - bindsym semicolon resize grow width 10 px or 10 ppt - - # same bindings, but for the arrow keys - bindsym Left resize shrink width 10 px or 10 ppt - bindsym Down resize grow height 10 px or 10 ppt - bindsym Up resize shrink height 10 px or 10 ppt - bindsym Right resize grow width 10 px or 10 ppt - - # back to normal: Enter or Escape or $mod+r - bindsym Return mode "default" - bindsym Escape mode "default" - bindsym $mod+r mode "default" -} - -bindsym $mod+r mode "resize" - -# Start i3bar to display a workspace bar (plus the system information i3status -# finds out, if available) -bar { - position top - status_command i3status -} - ''; - }; - -} -- cgit v1.2.3 From ecb6c5fe8784de4aeceef437368cb501e1d659ce Mon Sep 17 00:00:00 2001 From: jeschli Date: Sun, 30 Jun 2019 17:34:00 +0000 Subject: j bolide: add nygma toolchain --- jeschli/1systems/bolide/config.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jeschli/1systems/bolide/config.nix b/jeschli/1systems/bolide/config.nix index f13a2f8b0..5cb6ef568 100644 --- a/jeschli/1systems/bolide/config.nix +++ b/jeschli/1systems/bolide/config.nix @@ -79,7 +79,9 @@ in google-chrome # programming languages go - gcc + gcc9 + ccls + unstable.clang_8 ghc python35 python35Packages.pip -- cgit v1.2.3 From 72d614cf2a266478be71eca34d75a5ab387b8b89 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 3 Jul 2019 23:03:33 +0200 Subject: ma bureautomation: refactor air quality alarm --- .../bureautomation/automation/schlechteluft.nix | 40 +++ makefu/2configs/bureautomation/default.nix | 276 ++++++++++++++++++--- makefu/2configs/bureautomation/dwd_pollen.nix | 32 --- makefu/2configs/bureautomation/gtts-token.nix | 27 -- makefu/2configs/bureautomation/hass.nix | 237 ------------------ .../2configs/bureautomation/sensor/airquality.nix | 9 + 6 files changed, 287 insertions(+), 334 deletions(-) create mode 100644 makefu/2configs/bureautomation/automation/schlechteluft.nix delete mode 100644 makefu/2configs/bureautomation/dwd_pollen.nix delete mode 100644 makefu/2configs/bureautomation/gtts-token.nix delete mode 100644 makefu/2configs/bureautomation/hass.nix create mode 100644 makefu/2configs/bureautomation/sensor/airquality.nix diff --git a/makefu/2configs/bureautomation/automation/schlechteluft.nix b/makefu/2configs/bureautomation/automation/schlechteluft.nix new file mode 100644 index 000000000..9a5c4c5c8 --- /dev/null +++ b/makefu/2configs/bureautomation/automation/schlechteluft.nix @@ -0,0 +1,40 @@ +let +secs = 60; +in [ + # TODO: trigger if it is before dusk and somebody arives but nachtlichter are + # off from last day + # TODO: do not have nachtlicht turned on at night + { + alias = "Turn on Nachtlicht at dusk"; # when it gets dim + trigger = + { platform = "numeric_state"; + entity_id = "sensor.air_quality"; + above = 1523; + for.seconds = secs; + }; + condition = { + condition = "and"; + conditions = [ + { condition = "state"; + entity_id = "group.team"; + state = "home"; + } + { condition = "time"; + after = "06:00:00"; + before = "20:00:00"; + } + ]; + }; + + action = [ + { service = "homeassistant.turn_on"; + entity_id = [ + "script.schlechteluft" + ]; + } + { service = "notify.matrix_notify"; + data_template.message = "Bad Air Alarm! VOC above threshold for ${toString secs} seconds ({{state.sensor.air_quality.state_with_unit}})"; + } + ]; + } +] diff --git a/makefu/2configs/bureautomation/default.nix b/makefu/2configs/bureautomation/default.nix index 56c845744..564c0c455 100644 --- a/makefu/2configs/bureautomation/default.nix +++ b/makefu/2configs/bureautomation/default.nix @@ -1,43 +1,243 @@ -{ pkgs, lib, ... }: - -with lib; +{ config, pkgs, lib, ... }: let - port = 3001; - runit = pkgs.writeDash "runit" '' - set -xeuf - PATH=${pkgs.mosquitto}/bin:${pkgs.coreutils}/bin - name=''${1?must provide name as first arg} - state=''${2?must provide state as second arg} - # val=''${3?must provide val as third arg} - - # we ignore non-alerting events - test $state = alerting || exit 0 - - echo $name - $state - topic=plug - mosquitto_pub -t /bam/$topic/cmnd/POWER -m ON - sleep 5 - mosquitto_pub -t /bam/$topic/cmnd/POWER -m OFF - ''; + 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 in { - imports = [ - ./ota.nix - ]; - services.logstash = { - package = pkgs.logstash7; - plugins = [ pkgs.logstash-output-exec ]; + networking.firewall.allowedTCPPorts = [ 8123 ]; + state = [ "/var/lib/hass/known_devices.yaml" ]; + services.home-assistant = let + dwd_pollen = pkgs.fetchFromGitHub { + owner = "marcschumacher"; + repo = "dwd_pollen"; + rev = "0.1"; + sha256 = "1af2mx99gv2hk1ad53g21fwkdfdbymqcdl3jvzd1yg7dgxlkhbj1"; + }; + in { enable = true; - inputConfig = '' - http { - port => ${toString port} - host => "127.0.0.1" - type => "schlechteluft" - } - ''; - outputConfig = '' - if [type] == "schlechteluft" { - exec { command => "${runit} '%{ruleName}' '%{state}'" } - } - ''; + package = (pkgs.home-assistant.overrideAttrs (old: { + # TODO: find correct python package + postInstall = '' + cp -r ${dwd_pollen} $out/lib/python3.7/site-packages/homeassistant/components/dwd_pollen + ''; + })).override { + extraPackages = ps: with ps; [ + pkgs.pico2wave + python-forecastio jsonrpc-async jsonrpc-websocket mpd2 + (callPackage ./deps/gtts-token.nix { }) + (callPackage ./deps/pyhaversion.nix { }) + ]; + }; + autoExtraComponents = true; + config = { + homeassistant = { + name = "Bureautomation"; + time_zone = "Europe/Berlin"; + latitude = "48.8265"; + longitude = "9.0676"; + elevation = 303; + auth_providers = [ + { type = "homeassistant";} + { type = "legacy_api_password";} + { type = "trusted_networks"; + # allow_bypass_login = true; + } + ]; + }; + # https://www.home-assistant.io/components/influxdb/ + influxdb = { + database = "hass"; + tags = { + instance = "wbob"; + source = "hass"; + }; + }; + matrix = matrix.matrix; + mqtt = { + broker = "localhost"; + port = 1883; + client_id = "home-assistant"; + keepalive = 60; + protocol = 3.1; + birth_message = { + topic = "/bam/hass/tele/LWT"; + payload = "Online"; + qos = 1; + retain = true; + }; + will_message = { + topic = "/bam/hass/tele/LWT"; + payload = "Offline"; + qos = 1; + retain = true; + }; + }; + switch = (import ./switch/tasmota_switch.nix) ++ + (import ./switch/rfbridge.nix); + light = (import ./light/statuslight.nix) ++ + (import ./light/buzzer.nix); + timer = ten_hours.timer; + notify = [ + { + platform = "kodi"; + name = "wbob-kodi"; + host = kodi-host; + } + { + platform = "telegram"; + name = "telegrambot"; + chat_id = builtins.elemAt + (builtins.fromJSON (builtins.readFile + )).allowed_chat_ids 0; + } + ] ++ matrix.notify; + media_player = [ + { platform = "kodi"; + host = kodi-host; + } + { platform = "mpd"; + host = "127.0.0.1"; + } + ]; + script = lib.fold lib.recursiveUpdate {} [ + ((import ./script/multi_blink.nix) {inherit lib;}) + ten_hours.script + mittagessen.script + ]; + binary_sensor = + (import ./binary_sensor/buttons.nix) ++ + (import ./binary_sensor/motion.nix); + + sensor = + [{ platform = "version"; }] ++ + (import ./sensor/pollen.nix) ++ + (import ./sensor/espeasy.nix) ++ + (import ./sensor/airquality.nix) ++ + ((import ./sensor/outside.nix) {inherit lib;}) ++ + (import ./sensor/influxdb.nix) ++ + (import ./sensor/tasmota_firmware.nix); + + camera = + (import ./camera/verkehrskamera.nix); + + # not yet released + #person = + # (import ./person/team.nix ); + + frontend = { }; + http = { + # TODO: https://github.com/home-assistant/home-assistant/issues/16149 + base_url = "http://192.168.8.11:8123"; + api_password = "sistemas"; + trusted_networks = [ + "127.0.0.1/32" + "192.168.8.0/24" + "::1/128" + "fd00::/8" + ]; + }; + conversation = {}; + history = {}; + logbook = {}; + tts = [ + { platform = "google"; + language = "de"; + } + { platform = "voicerss"; + api_key = builtins.readFile ; + language = "de-de"; + } + { platform = "picotts"; + language = "de-DE"; + } + ]; + recorder = {}; + sun = {}; + telegram_bot = [ + (builtins.fromJSON + (builtins.readFile )) + ]; + group = + { default_view = + { view = "yes"; + entities = [ + "group.sensors" + "group.camera" + "group.outside" + "group.team" + "group.nachtlicht" + "group.switches" + ]; + }; + automation = []; + + switches = [ + "switch.bauarbeiterlampe" + "switch.blitzdings" + "switch.fernseher" + "switch.feuer" + "light.status_felix" + "light.status_daniel" + "light.buslicht" + ]; + team = [ + "device_tracker.thorsten_phone" + "device_tracker.felix_phone" + "device_tracker.ecki_tablet" + "device_tracker.daniel_phone" + "device_tracker.carsten_phone" + "device_tracker.thierry_phone" + "device_tracker.frank_phone" + "device_tracker.anthony_phone" + # "person.thorsten" + # "person.felix" + # "person.ecki" + # "person.daniel" + ]; + camera = [ + "camera.Baumarkt" + "camera.Autobahn_Heilbronn" + "camera.Autobahn_Singen" + ]; + nachtlicht = [ + "switch.nachtlicht_a" + "switch.nachtlicht_b" + "switch.nachtlicht_c" + "switch.nachtlicht_d" + ]; + sensors = [ + "media_player.kodi" + "script.blitz_10s" + "script.buzz_red_led_fast" + "timer.felix_10h" + "timer.frank_10h" + "sensor.easy2_dht22_humidity" + "sensor.easy2_dht22_temperature" + # "binary_sensor.redbutton" + ]; + outside = [ + # "sensor.ditzingen_pm10" + # "sensor.ditzingen_pm25" + "sensor.dark_sky_icon" + "sensor.dark_sky_temperature" + "sensor.dark_sky_humidity" + "sensor.dark_sky_uv_index" + # "sensor.dark_sky_pressure" + "sensor.dark_sky_hourly_summary" + ]; + }; + # only for automation + # feedreader.urls = [ "http://www.heise.de/security/rss/news-atom.xml" ]; + # we don't use imports because the expressions do not merge in + # home-assistant + automation = (import ./automation/bureau-shutdown.nix) ++ + (import ./automation/nachtlicht.nix) ++ + (import ./automation/hass-restart.nix) ++ + ten_hours.automation ++ + matrix.automation ++ + mittagessen.automation; + device_tracker = (import ./device_tracker/openwrt.nix ); + }; }; } diff --git a/makefu/2configs/bureautomation/dwd_pollen.nix b/makefu/2configs/bureautomation/dwd_pollen.nix deleted file mode 100644 index 39d9c3069..000000000 --- a/makefu/2configs/bureautomation/dwd_pollen.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ lib -, buildPythonPackage -, fetchFromGitHub -, python -, voluptuous -}: - -buildPythonPackage rec { - format = "other"; - pname = "dwd_pollen"; - version = "0.1"; - - src = fetchFromGitHub { - owner = "marcschumacher"; - repo = "dwd_pollen"; - rev = version; - sha256 = "1af2mx99gv2hk1ad53g21fwkdfdbymqcdl3jvzd1yg7dgxlkhbj1"; - }; - propagatedBuildInputs = [ - voluptuous - ]; - installPhase = '' - install -D -t $out/${python.sitePackages}/homeassistant/components/sensor/dwd_pollen * - ''; - - meta = with lib; { - description = "Home Assistant component to retrieve Pollen data from DWD (Germany)"; - homepage = https://github.com/marcschumacher/dwd_pollen; - license = licenses.mit; - maintainers = [ maintainers.makefu ]; - }; -} diff --git a/makefu/2configs/bureautomation/gtts-token.nix b/makefu/2configs/bureautomation/gtts-token.nix deleted file mode 100644 index 69640f03d..000000000 --- a/makefu/2configs/bureautomation/gtts-token.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ lib -, buildPythonPackage -, fetchPypi -, requests -}: - -buildPythonPackage rec { - pname = "gtts-token"; - version = "1.1.3"; - - src = fetchPypi { - pname = "gTTS-token"; - inherit version; - sha256 = "9d6819a85b813f235397ef931ad4b680f03d843c9b2a9e74dd95175a4bc012c5"; - }; - - propagatedBuildInputs = [ - requests - ]; - - meta = with lib; { - description = "Calculates a token to run the Google Translate text to speech"; - homepage = https://github.com/boudewijn26/gTTS-token; - license = licenses.mit; - # maintainers = [ maintainers. ]; - }; -} diff --git a/makefu/2configs/bureautomation/hass.nix b/makefu/2configs/bureautomation/hass.nix deleted file mode 100644 index 05b98243d..000000000 --- a/makefu/2configs/bureautomation/hass.nix +++ /dev/null @@ -1,237 +0,0 @@ -{ 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 -in { - networking.firewall.allowedTCPPorts = [ 8123 ]; - state = [ "/var/lib/hass/known_devices.yaml" ]; - services.home-assistant = let - dwd_pollen = pkgs.fetchFromGitHub { - owner = "marcschumacher"; - repo = "dwd_pollen"; - rev = "0.1"; - sha256 = "1af2mx99gv2hk1ad53g21fwkdfdbymqcdl3jvzd1yg7dgxlkhbj1"; - }; - in { - enable = true; - package = (pkgs.home-assistant.overrideAttrs (old: { - # TODO: find correct python package - postInstall = '' - cp -r ${dwd_pollen} $out/lib/python3.7/site-packages/homeassistant/components/dwd_pollen - ''; - })).override { - extraPackages = ps: with ps; [ - pkgs.pico2wave - python-forecastio jsonrpc-async jsonrpc-websocket mpd2 - (callPackage ./gtts-token.nix { }) - ]; - }; - autoExtraComponents = true; - config = { - homeassistant = { - name = "Bureautomation"; - time_zone = "Europe/Berlin"; - latitude = "48.8265"; - longitude = "9.0676"; - elevation = 303; - auth_providers = [ - { type = "homeassistant";} - { type = "legacy_api_password";} - { type = "trusted_networks"; - # allow_bypass_login = true; - } - ]; - }; - # https://www.home-assistant.io/components/influxdb/ - influxdb = { - database = "hass"; - tags = { - instance = "wbob"; - source = "hass"; - }; - }; - mqtt = { - broker = "localhost"; - port = 1883; - client_id = "home-assistant"; - keepalive = 60; - protocol = 3.1; - birth_message = { - topic = "/bam/hass/tele/LWT"; - payload = "Online"; - qos = 1; - retain = true; - }; - will_message = { - topic = "/bam/hass/tele/LWT"; - payload = "Offline"; - qos = 1; - retain = true; - }; - }; - switch = (import ./switch/tasmota_switch.nix) ++ - (import ./switch/rfbridge.nix); - light = (import ./light/statuslight.nix) ++ - (import ./light/buzzer.nix); - timer = ten_hours.timer; - notify = [ - { - platform = "kodi"; - name = "wbob-kodi"; - host = kodi-host; - } - { - platform = "telegram"; - name = "telegrambot"; - chat_id = builtins.elemAt - (builtins.fromJSON (builtins.readFile - )).allowed_chat_ids 0; - } - ]; - media_player = [ - { platform = "kodi"; - host = kodi-host; - } - { platform = "mpd"; - host = "127.0.0.1"; - } - ]; - script = lib.fold lib.recursiveUpdate {} [ - ((import ./script/multi_blink.nix) {inherit lib;}) - ten_hours.script - mittagessen.script - ]; - binary_sensor = - (import ./binary_sensor/buttons.nix) ++ - (import ./binary_sensor/motion.nix); - - sensor = - (import ./sensor/pollen.nix) ++ - (import ./sensor/espeasy.nix) ++ - ((import ./sensor/outside.nix) {inherit lib;}) ++ - (import ./sensor/influxdb.nix) ++ - (import ./sensor/tasmota_firmware.nix); - - camera = - (import ./camera/verkehrskamera.nix); - - # not yet released - #person = - # (import ./person/team.nix ); - - frontend = { }; - http = { - # TODO: https://github.com/home-assistant/home-assistant/issues/16149 - base_url = "http://192.168.8.11:8123"; - api_password = "sistemas"; - trusted_networks = [ - "127.0.0.1/32" - "192.168.8.0/24" - "::1/128" - "fd00::/8" - ]; - }; - conversation = {}; - history = {}; - logbook = {}; - tts = [ - { platform = "google"; - language = "de"; - } - { platform = "voicerss"; - api_key = builtins.readFile ; - language = "de-de"; - } - { platform = "picotts"; - language = "de-DE"; - } - ]; - recorder = {}; - sun = {}; - telegram_bot = [ - (builtins.fromJSON - (builtins.readFile )) - ]; - group = - { default_view = - { view = "yes"; - entities = [ - "group.sensors" - "group.camera" - "group.outside" - "group.team" - "group.nachtlicht" - "group.switches" - ]; - }; - automation = []; - - switches = [ - "switch.bauarbeiterlampe" - "switch.blitzdings" - "switch.fernseher" - "switch.feuer" - "light.status_felix" - "light.status_daniel" - "light.buslicht" - ]; - team = [ - "device_tracker.thorsten_phone" - "device_tracker.felix_phone" - "device_tracker.ecki_tablet" - "device_tracker.daniel_phone" - "device_tracker.carsten_phone" - "device_tracker.thierry_phone" - "device_tracker.frank_phone" - "device_tracker.anthony_phone" - # "person.thorsten" - # "person.felix" - # "person.ecki" - # "person.daniel" - ]; - camera = [ - "camera.Baumarkt" - "camera.Autobahn_Heilbronn" - "camera.Autobahn_Singen" - ]; - nachtlicht = [ - "switch.nachtlicht_a" - "switch.nachtlicht_b" - "switch.nachtlicht_c" - "switch.nachtlicht_d" - ]; - sensors = [ - "media_player.kodi" - "script.blitz_10s" - "script.buzz_red_led_fast" - "timer.felix_10h" - "timer.frank_10h" - "sensor.easy2_dht22_humidity" - "sensor.easy2_dht22_temperature" - # "binary_sensor.redbutton" - ]; - outside = [ - # "sensor.ditzingen_pm10" - # "sensor.ditzingen_pm25" - "sensor.dark_sky_icon" - "sensor.dark_sky_temperature" - "sensor.dark_sky_humidity" - "sensor.dark_sky_uv_index" - # "sensor.dark_sky_pressure" - "sensor.dark_sky_hourly_summary" - ]; - }; - # only for automation - # feedreader.urls = [ "http://www.heise.de/security/rss/news-atom.xml" ]; - # we don't use imports because the expressions do not merge in - # home-assistant - automation = (import ./automation/bureau-shutdown.nix) ++ - (import ./automation/nachtlicht.nix) ++ - (import ./automation/hass-restart.nix) ++ - ten_hours.automation ++ - mittagessen.automation; - device_tracker = (import ./device_tracker/openwrt.nix ); - }; - }; -} diff --git a/makefu/2configs/bureautomation/sensor/airquality.nix b/makefu/2configs/bureautomation/sensor/airquality.nix new file mode 100644 index 000000000..217fa9595 --- /dev/null +++ b/makefu/2configs/bureautomation/sensor/airquality.nix @@ -0,0 +1,9 @@ +[ + # coming from 2configs/stats/telegraf/ + { platform = "mqtt"; + name = "Air Quality"; + state_topic = "/telegraf/wbob/airquality"; + value_template = "{{ value_json.fields.value }}"; + unit_of_measurement = "VOC"; + } +] -- cgit v1.2.3 From c2230d30c5d75622eb25f3e0df977691cbf01058 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 4 Jul 2019 08:03:50 +0200 Subject: ma bureautomation: remove announcement, fix schlechteluft --- makefu/2configs/bureautomation/automation/bureau-shutdown.nix | 8 -------- makefu/2configs/bureautomation/automation/schlechteluft.nix | 7 ++----- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix index 3fa23a837..007f6064a 100644 --- a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix +++ b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix @@ -23,14 +23,6 @@ item.partymode = "music"; }; } - { - service = "tts.google_say"; - entity_id = "media_player.mpd"; - data = { - message = "Willkommen in deinem Lieblingsbüro"; - language = "de"; - }; - } { service = "notify.telegrambot"; data = { diff --git a/makefu/2configs/bureautomation/automation/schlechteluft.nix b/makefu/2configs/bureautomation/automation/schlechteluft.nix index 9a5c4c5c8..4a5fb17c2 100644 --- a/makefu/2configs/bureautomation/automation/schlechteluft.nix +++ b/makefu/2configs/bureautomation/automation/schlechteluft.nix @@ -1,11 +1,8 @@ let secs = 60; in [ - # TODO: trigger if it is before dusk and somebody arives but nachtlichter are - # off from last day - # TODO: do not have nachtlicht turned on at night { - alias = "Turn on Nachtlicht at dusk"; # when it gets dim + alias = "Bad Air Alarm"; trigger = { platform = "numeric_state"; entity_id = "sensor.air_quality"; @@ -33,7 +30,7 @@ in [ ]; } { service = "notify.matrix_notify"; - data_template.message = "Bad Air Alarm! VOC above threshold for ${toString secs} seconds ({{state.sensor.air_quality.state_with_unit}})"; + data_template.message = "Bad Air Alarm! VOC above threshold for ${toString secs} seconds ({{states.sensor.air_quality.state_with_unit}})"; } ]; } -- cgit v1.2.3 From b3b2dd65211fa7bcdb2f5e507895ce5edde45160 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 4 Jul 2019 08:05:54 +0200 Subject: ma bureautomation: stream-line 10h timers --- .../bureautomation/combination/10h_timers.nix | 202 ++------------------- 1 file changed, 18 insertions(+), 184 deletions(-) diff --git a/makefu/2configs/bureautomation/combination/10h_timers.nix b/makefu/2configs/bureautomation/combination/10h_timers.nix index d398e8a34..4bbae0dda 100644 --- a/makefu/2configs/bureautomation/combination/10h_timers.nix +++ b/makefu/2configs/bureautomation/combination/10h_timers.nix @@ -1,14 +1,15 @@ {lib, ... }: let - persons = [ "frank" "daniel" "thorsten" "carsten" "thierry" "ecki" - # "felix" # custom actions + persons = [ "frank" "daniel" "thorsten" "carsten" "thierry" "ecki" "felix" + "anthony" # antony + "thierry" # tjeri ]; random_zu_lange = name: ''{{ [ "Du musst jetzt endlich nach Hause gehen ${name}!", "10 Stunden sind rum, bald schenkst du den Franzosen deine Lebenszeit", "Nur eine Minute über 10 Stunden kann zu einer Stunde Arbeit für Thorsten werden, ${name}.", "In 10 Minuten kommt dich der Security Mann holen, ${name}", - "Zu lange, ${name}!" ] | random }}'' ; + "Zu lange, ${name}!" ] | random }}'' ; random_announce = name: ''{{ [ @@ -94,8 +95,9 @@ let }; zu_lange_user = name: - { "announce_${name}" = { + { "zu_lange_${name}" = { alias = "Random Zu Lange ${name}"; + sequence = [ { service = "media_player.play_media"; data = { @@ -176,14 +178,21 @@ let ]; } - { - alias = "Zu lange ${name}!"; + { alias = "Zu lange ${name}!"; trigger = { platform = "event"; event_type = "timer.finished"; event_data.entity_id = "timer.${name}_10h"; }; + + condition = + { + condition = "state"; + entity_id = "device_tracker.${name}_phone"; + state = "home"; + }; + action = [ { service = "homeassistant.turn_on"; @@ -198,186 +207,11 @@ let in { timer =lib.fold lib.recursiveUpdate {} - ([ - (tmr_10h "felix") - { felix_8_30h = { - name = "Felix 8_30h Timer"; - duration = "08:30:00"; - }; - felix_7h = { - name = "Felix 7h Timer"; - duration = "07:00:00"; - }; - } - ] ++ (map tmr_10h persons)); - automation = lib.flatten (map automation_10h persons) ++ - [ - { alias = "start Felix 10h"; - trigger = { - platform = "state"; - entity_id = [ "device_tracker.felix_phone" "device_tracker.felix_laptop" ]; - from = "not_home"; - to = "home"; - }; - condition = { - condition = "and"; - conditions = [ - { - condition = "state"; - entity_id = "timer.felix_10h"; - state = "idle"; - } - { - condition = "time"; - after = "06:00:00"; - before = "12:00:00"; - } - ]; - }; - action = [ - { service = "timer.start"; - entity_id = [ "timer.felix_10h" "timer.felix_8_30h" "timer.felix_7h" ] ; - } - { service = "homeassistant.turn_on"; - entity_id = [ - # "script.buzz_felix" - "script.blitz_10s" - ]; - } - { - service = "tts.google_say"; - entity_id = "media_player.mpd"; - data_template = { - message = "Willkommen, Felix!"; - language = "de"; - }; - } - { service = "light.turn_on"; - data = { - effect = "2"; - entity_id = [ "light.status_felix" ]; - }; - } - ]; - } - - { alias = "Disable Felix timer at button press"; - trigger = { - platform = "state"; - entity_id = "binary_sensor.redbutton"; - to = "on"; - }; - condition = { - condition = "and"; - conditions = [ - { - condition = "state"; - entity_id = "timer.felix_10h"; - state = "active"; - } - { - condition = "time"; - after = "12:00:00"; - before = "22:00:00"; - } - ]; - }; - action = - [ - { - service = "timer.cancel"; - entity_id = [ "timer.felix_10h" "timer.felix_8_30h" "timer.felix_7h" ]; - } - { - service = "homeassistant.turn_on"; - entity_id = [ "script.buzz_red_led_fast" ]; - } - { - service = "homeassistant.turn_off"; - entity_id = [ "light.status_felix" ]; - } - ]; - } - - { - alias = "Genug gearbeitet Felix"; - trigger = - { - platform = "event"; - event_type = "timer.finished"; - event_data.entity_id = "timer.felix_7h"; - }; - action = - [ - { service = "light.turn_on"; - data = { - rgb_color= [0 255 0]; - # effect = "0"; - entity_id = [ "light.status_felix" ]; - }; - } - ]; - } - - { - alias = "nun aber nach hause"; - trigger = - { - platform = "event"; - event_type = "timer.finished"; - event_data.entity_id = "timer.felix_8_30h"; - }; - action = - [ - { service = "light.turn_on"; - data = { - rgb_color= [255 255 0]; - # effect = "0"; - entity_id = [ "light.status_felix" ]; - }; - } - ]; - } - - { - alias = "Zu lange Felix!"; - trigger = - { - platform = "event"; - event_type = "timer.finished"; - event_data.entity_id = "timer.felix_10h"; - }; - action = - [ - { - service = "notify.telegrambot"; - data = { - title = "Zu lange Felix!"; - message = "Du bist schon 10 Stunden auf Arbeit, geh jetzt gefälligst nach Hause!"; - }; - } - { - service = "homeassistant.turn_on"; - entity_id = [ - # "script.buzz_felix" - "script.blitz_10s" - ]; - } - { service = "light.turn_on"; - data = { - rgb_color= [255 0 0]; - effect = "0"; - entity_id = [ "light.status_felix" ]; - }; - } - ]; - } - ] - ; + (map tmr_10h persons); + automation = (lib.flatten (map automation_10h persons)); script = lib.fold lib.recursiveUpdate {} ( (map (ab: buzz_user ab.fst ab.snd) (lib.zipLists persons patterns)) ++ (map (p: announce_user p) persons) ++ - (map (p: zu_lange_user p) persons) ++ - [ (announce_user "felix" ) (buzz_user "felix" [125 250 500] ) ] + (map (p: zu_lange_user p) persons) ); } -- cgit v1.2.3 From d0189deacb43a4d34364ff8612769ddba151fb53 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 4 Jul 2019 08:06:35 +0200 Subject: ma bureautomation: enable schlechteluft, matrix publisher --- .../2configs/bureautomation/combination/matrix.nix | 65 ++++++++++++++++++++++ makefu/2configs/bureautomation/default.nix | 5 ++ 2 files changed, 70 insertions(+) create mode 100644 makefu/2configs/bureautomation/combination/matrix.nix diff --git a/makefu/2configs/bureautomation/combination/matrix.nix b/makefu/2configs/bureautomation/combination/matrix.nix new file mode 100644 index 000000000..85ba31986 --- /dev/null +++ b/makefu/2configs/bureautomation/combination/matrix.nix @@ -0,0 +1,65 @@ +{ lib, ... }: +#matrix: +# password: supersecurepassword +# rooms: +# - "#hasstest:matrix.org" +# commands: +# - word: my_command +# name: my_command +let + mom_room = "!kTQjvTQvfVsvfEtmth:thales.citadel.team"; +in { + matrix = + { + # secrets: + # homeserver, username, password + homeserver = "https://ext01.citadel.team"; + rooms = [ + mom_room + ]; + commands = [ + { + # alternative: expression for regexp + word = "version"; + name = "version"; + } + { + word = "luftqualität"; + name = "luftqualitaet"; + } + ]; + } // (builtins.fromJSON (builtins.readFile + )); + automation = [ + { + alias = "React to !version"; + trigger = { + platform = "event"; + event_type = "matrix_command"; + event_data.command = "version"; + }; + action = { + service = "notify.matrix_notify"; + data_template.message = "Running home-assistant {{states.sensor.current_version.state}}"; + }; + } + { + alias = "React to !luftqualität"; + trigger = { + platform = "event"; + event_type = "matrix_command"; + event_data.command = "luftqualitaet"; + }; + action = { + service = "notify.matrix_notify"; + data_template.message = "Temp: {{states.sensor.easy2_dht22_temperature.state_with_unit}} Hum:{{states.sensor.easy2_dht22_humidity.state_with_unit}} airquality:{{states.sensor.air_quality.state_with_unit}}"; + }; + } + + ]; + notify = [{ + name = "matrix_notify"; + platform = "matrix"; + default_room = mom_room; + }]; +} diff --git a/makefu/2configs/bureautomation/default.nix b/makefu/2configs/bureautomation/default.nix index 564c0c455..b783d8e01 100644 --- a/makefu/2configs/bureautomation/default.nix +++ b/makefu/2configs/bureautomation/default.nix @@ -5,6 +5,9 @@ let mittagessen = import ./combination/mittagessen.nix { inherit lib; }; # provides: automation script matrix = import ./combination/matrix.nix { inherit lib; }; # provides: matrix automation in { + imports = [ + ./ota.nix + ]; networking.firewall.allowedTCPPorts = [ 8123 ]; state = [ "/var/lib/hass/known_devices.yaml" ]; services.home-assistant = let @@ -214,6 +217,7 @@ in { "timer.frank_10h" "sensor.easy2_dht22_humidity" "sensor.easy2_dht22_temperature" + "sensor.air_quality" # "binary_sensor.redbutton" ]; outside = [ @@ -233,6 +237,7 @@ in { # home-assistant automation = (import ./automation/bureau-shutdown.nix) ++ (import ./automation/nachtlicht.nix) ++ + (import ./automation/schlechteluft.nix) ++ (import ./automation/hass-restart.nix) ++ ten_hours.automation ++ matrix.automation ++ -- cgit v1.2.3 From 06a220ca1c0e368163b02a28b21796a6e2dded29 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 4 Jul 2019 08:23:18 +0200 Subject: ma wbob.r: follow changes in bureautomation refactoring --- makefu/1systems/wbob/config.nix | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/makefu/1systems/wbob/config.nix b/makefu/1systems/wbob/config.nix index 8b01de4d0..ad7fc825c 100644 --- a/makefu/1systems/wbob/config.nix +++ b/makefu/1systems/wbob/config.nix @@ -45,17 +45,10 @@ in { # { environment.systemPackages = [ pkgs.vlc ]; } - { - # Risikoübernahme - nixpkgs.config.permittedInsecurePackages = [ - "homeassistant-0.77.2" - ]; - } - + # new hass entry point - + # #mpd is only used for TTS - (let collectd-port = 25826; influx-port = 8086; -- cgit v1.2.3 From c78dcd58cc0fa7a992b6bc7a5aca96319217415c Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 4 Jul 2019 08:42:39 +0200 Subject: ma secrets: add citadel-bot.json --- makefu/0tests/data/secrets/hass/citadel-bot.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 makefu/0tests/data/secrets/hass/citadel-bot.json diff --git a/makefu/0tests/data/secrets/hass/citadel-bot.json b/makefu/0tests/data/secrets/hass/citadel-bot.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/makefu/0tests/data/secrets/hass/citadel-bot.json @@ -0,0 +1 @@ +{} -- cgit v1.2.3 From 9d50bfa569e072001a97d22e6c4375b264e5cff7 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 4 Jul 2019 11:15:01 +0200 Subject: ma bureautomation: move deps --- makefu/2configs/bureautomation/deps/dwd_pollen.nix | 32 +++++++++++++++++++++ makefu/2configs/bureautomation/deps/gtts-token.nix | 27 ++++++++++++++++++ .../2configs/bureautomation/deps/pyhaversion.nix | 33 ++++++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 makefu/2configs/bureautomation/deps/dwd_pollen.nix create mode 100644 makefu/2configs/bureautomation/deps/gtts-token.nix create mode 100644 makefu/2configs/bureautomation/deps/pyhaversion.nix diff --git a/makefu/2configs/bureautomation/deps/dwd_pollen.nix b/makefu/2configs/bureautomation/deps/dwd_pollen.nix new file mode 100644 index 000000000..39d9c3069 --- /dev/null +++ b/makefu/2configs/bureautomation/deps/dwd_pollen.nix @@ -0,0 +1,32 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, python +, voluptuous +}: + +buildPythonPackage rec { + format = "other"; + pname = "dwd_pollen"; + version = "0.1"; + + src = fetchFromGitHub { + owner = "marcschumacher"; + repo = "dwd_pollen"; + rev = version; + sha256 = "1af2mx99gv2hk1ad53g21fwkdfdbymqcdl3jvzd1yg7dgxlkhbj1"; + }; + propagatedBuildInputs = [ + voluptuous + ]; + installPhase = '' + install -D -t $out/${python.sitePackages}/homeassistant/components/sensor/dwd_pollen * + ''; + + meta = with lib; { + description = "Home Assistant component to retrieve Pollen data from DWD (Germany)"; + homepage = https://github.com/marcschumacher/dwd_pollen; + license = licenses.mit; + maintainers = [ maintainers.makefu ]; + }; +} diff --git a/makefu/2configs/bureautomation/deps/gtts-token.nix b/makefu/2configs/bureautomation/deps/gtts-token.nix new file mode 100644 index 000000000..69640f03d --- /dev/null +++ b/makefu/2configs/bureautomation/deps/gtts-token.nix @@ -0,0 +1,27 @@ +{ lib +, buildPythonPackage +, fetchPypi +, requests +}: + +buildPythonPackage rec { + pname = "gtts-token"; + version = "1.1.3"; + + src = fetchPypi { + pname = "gTTS-token"; + inherit version; + sha256 = "9d6819a85b813f235397ef931ad4b680f03d843c9b2a9e74dd95175a4bc012c5"; + }; + + propagatedBuildInputs = [ + requests + ]; + + meta = with lib; { + description = "Calculates a token to run the Google Translate text to speech"; + homepage = https://github.com/boudewijn26/gTTS-token; + license = licenses.mit; + # maintainers = [ maintainers. ]; + }; +} diff --git a/makefu/2configs/bureautomation/deps/pyhaversion.nix b/makefu/2configs/bureautomation/deps/pyhaversion.nix new file mode 100644 index 000000000..a75c6a976 --- /dev/null +++ b/makefu/2configs/bureautomation/deps/pyhaversion.nix @@ -0,0 +1,33 @@ +{ lib +, buildPythonPackage +, fetchpatch +, fetchPypi +, aiohttp +, async-timeout +}: + +buildPythonPackage rec { + pname = "pyhaversion"; + version = "2.2.1"; + + src = fetchPypi { + inherit pname version; + sha256 = "72b65aa25d7b2dbb839a4d0218df2005c2335e93526035904d365bb668030b9f"; + }; + patches = [ + (fetchpatch { url = "https://github.com/makefu/pyhaversion/commit/f3bdc38970272cd345c2cfbde3037ea492ca27c4.patch"; + sha256 = + "1rhq4z7mdgnwhwpf5fmarnbc1ba3qysk1wqjdr0hvbzi8vmvbfcc";}) + ]; + doCheck = false; + propagatedBuildInputs = [ + aiohttp + async-timeout + ]; + + meta = with lib; { + description = ""; + homepage = https://github.com/ludeeus/pyhaversion; + # maintainers = [ maintainers. ]; + }; +} -- cgit v1.2.3 From 158f65a97eaac7020d3020320687aaf84ae4f6de Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 4 Jul 2019 11:23:41 +0200 Subject: ma bureautomation: remove buzzing --- .../bureautomation/combination/10h_timers.nix | 31 ---------------------- 1 file changed, 31 deletions(-) diff --git a/makefu/2configs/bureautomation/combination/10h_timers.nix b/makefu/2configs/bureautomation/combination/10h_timers.nix index 4bbae0dda..79a608cd7 100644 --- a/makefu/2configs/bureautomation/combination/10h_timers.nix +++ b/makefu/2configs/bureautomation/combination/10h_timers.nix @@ -57,42 +57,12 @@ let "Wer wohnt in der Ananas ganz tief im Meer? ${name} Schwammkopf!", "Arbeit ist Freizeit! Wachstum ist Fortschritt! Sicherheit ist Freiheit!", "Willkommen ${name}"] | random }}'' ; - patterns = [ - [1000 500 250] # TODO: maybe even play a short audio announcement? - [150 150 150] - [255 255] - [500 500 100] - [100 1000 100] - # [125 250 500] - ]; tmr_10h = name: { "${name}_10h" = { name = "${name} 10h Timer"; duration = "10:00:00"; }; }; - 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); - }; - - buzz_user = name: delays: { "buzz_${name}" = (multi_flash { - entity = "light.redbutton_buzzer"; - inherit delays; - alias = "Red Button Buzz ${name}"; - }); - }; zu_lange_user = name: { "zu_lange_${name}" = { @@ -210,7 +180,6 @@ in (map tmr_10h persons); automation = (lib.flatten (map automation_10h persons)); script = lib.fold lib.recursiveUpdate {} ( - (map (ab: buzz_user ab.fst ab.snd) (lib.zipLists persons patterns)) ++ (map (p: announce_user p) persons) ++ (map (p: zu_lange_user p) persons) ); -- cgit v1.2.3 From d6c59731dd979bf4b5e20d85ab518e98b8d8c8ed Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 7 Jul 2019 10:31:19 +0200 Subject: gitlab-ci: use docker builder --- .gitlab-ci.yml | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6d2f15063..f6f59f0e7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,20 +1,35 @@ before_script: - - mkdir -p ~/.ssh - - echo "$deploy_privkey" > deploy.key - - export GIT_SSH_COMMAND="ssh -i $PWD/deploy.key" - - chmod 600 deploy.key - - ssh-keyscan -H 'github.com' >> ~/.ssh/known_hosts + - nix-env -iA nixpkgs.openssh nixpkgs.gnupg nixpkgs.curl nixpkgs.git || true + # prepare github deployment for NUR + - mkdir -p ~/.ssh + - echo "$github_deploy_privkey" > ~/.ssh/github_deploy.key + - chmod 600 ~/.ssh/github_deploy.key + - ssh-keyscan -H 'github.com' >> ~/.ssh/known_hosts + # prepare git fetching of secrets + - ssh-keyscan -H 'git.shackspace.de' >> ~/.ssh/known_hosts + # import secret key for secrets + - echo "$secrets_gpg_key" | gpg --import +wolf deployment test: + stage: test + script: + - GIT_SSH_COMMAND="ssh -i ~/.ssh/gitlab_deploy.key" git clone git@ssh.git.shackspace.de:rz/secrets.git ~/brain + - test $(PASSWORD_STORE_DIR=~/brain pass smoke) == 1337 nix-shell test: + stage: test script: - - env - nix-shell --pure --command 'true' -p stdenv && echo success - nix-shell --pure --command 'false' -p stdenv || echo success + - git --version + - ssh -V + - gpg --version + - curl --version nur-packages makefu: + stage: deploy script: - git reset --hard origin/master - git filter-branch -f --prune-empty --subdirectory-filter makefu/5pkgs HEAD - git remote add deploy git@github.com:makefu/nur-packages.git || git remote set-url deploy git@github.com:makefu/nur-packages.git - - git push --force deploy HEAD:master + - GIT_SSH_COMMAND="ssh -i ~/.ssh/github_deploy.key" git push --force deploy HEAD:master - curl -XPOST http://nur-update.herokuapp.com/update?repo=makefu after_script: - - rm -f deploy.key + - rm -rf .ssh/ -- cgit v1.2.3 From 0caf7f5b4f93518f874603fc433a9a681fb8b46d Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 7 Jul 2019 13:45:53 +0200 Subject: gitlab-ci: add gitlab_deploy key --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f6f59f0e7..acbfd3beb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,6 +6,8 @@ before_script: - chmod 600 ~/.ssh/github_deploy.key - ssh-keyscan -H 'github.com' >> ~/.ssh/known_hosts # prepare git fetching of secrets + - echo "$gitlab_deploy_privkey" > ~/.ssh/gitlab_deploy.key + - chmod 600 ~/.ssh/gitlab_deploy.key - ssh-keyscan -H 'git.shackspace.de' >> ~/.ssh/known_hosts # import secret key for secrets - echo "$secrets_gpg_key" | gpg --import -- cgit v1.2.3 From 29c8f7eeba7ab1ae5923bde74f6261d04cd16c6f Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 7 Jul 2019 13:49:18 +0200 Subject: gitlab-ci: key-scan the correct host --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index acbfd3beb..308304c7a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,7 +8,7 @@ before_script: # prepare git fetching of secrets - echo "$gitlab_deploy_privkey" > ~/.ssh/gitlab_deploy.key - chmod 600 ~/.ssh/gitlab_deploy.key - - ssh-keyscan -H 'git.shackspace.de' >> ~/.ssh/known_hosts + - ssh-keyscan -H 'ssh.git.shackspace.de' >> ~/.ssh/known_hosts # import secret key for secrets - echo "$secrets_gpg_key" | gpg --import wolf deployment test: -- cgit v1.2.3 From 200d46e0e9e2bf420e046212a9b9f2f144e6ac4b Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 7 Jul 2019 14:02:04 +0200 Subject: gitlab-ci: add pass as dependency --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 308304c7a..f099c53d4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,5 @@ before_script: - - nix-env -iA nixpkgs.openssh nixpkgs.gnupg nixpkgs.curl nixpkgs.git || true + - nix-env -iA nixpkgs.openssh nixpkgs.gnupg nixpkgs.curl nixpkgs.git nixpkgs.pass || true # prepare github deployment for NUR - mkdir -p ~/.ssh - echo "$github_deploy_privkey" > ~/.ssh/github_deploy.key -- cgit v1.2.3 From 73b327e58832a92fa42d575a73a7e44085a7e5f9 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 7 Jul 2019 19:27:16 +0200 Subject: gitlab-ci: test and deploy wolf --- .gitlab-ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f099c53d4..dc7c5bb74 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,6 +16,7 @@ wolf deployment test: script: - GIT_SSH_COMMAND="ssh -i ~/.ssh/gitlab_deploy.key" git clone git@ssh.git.shackspace.de:rz/secrets.git ~/brain - test $(PASSWORD_STORE_DIR=~/brain pass smoke) == 1337 + - $(nix-build ~/stockholm/krebs/krops.nix --no-out-link --argstr name wolf --argstr target /tmp -A test) nix-shell test: stage: test script: @@ -25,6 +26,11 @@ nix-shell test: - ssh -V - gpg --version - curl --version +wolf deployment: + stage: deploy + script: + - GIT_SSH_COMMAND="ssh -i ~/.ssh/gitlab_deploy.key" git clone git@ssh.git.shackspace.de:rz/secrets.git ~/brain + - $(nix-build krebs/krops.nix --no-out-link --argstr name wolf -A deploy) nur-packages makefu: stage: deploy script: -- cgit v1.2.3 From a4aafafd717a9437766486490a5ce6d4cdd86c16 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 7 Jul 2019 19:33:17 +0200 Subject: gitlab-ci: use correct directory for test --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dc7c5bb74..b1f62789c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,7 +16,7 @@ wolf deployment test: script: - GIT_SSH_COMMAND="ssh -i ~/.ssh/gitlab_deploy.key" git clone git@ssh.git.shackspace.de:rz/secrets.git ~/brain - test $(PASSWORD_STORE_DIR=~/brain pass smoke) == 1337 - - $(nix-build ~/stockholm/krebs/krops.nix --no-out-link --argstr name wolf --argstr target /tmp -A test) + - $(nix-build krebs/krops.nix --no-out-link --argstr name wolf --argstr target /tmp -A test) nix-shell test: stage: test script: -- cgit v1.2.3 From 497eecef31c9e41848c4bb5a0c80ca7308607846 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 7 Jul 2019 21:04:11 +0200 Subject: gitlab-ci: add git submodule checkout --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b1f62789c..6afbfe08c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,6 +16,7 @@ wolf deployment test: script: - GIT_SSH_COMMAND="ssh -i ~/.ssh/gitlab_deploy.key" git clone git@ssh.git.shackspace.de:rz/secrets.git ~/brain - test $(PASSWORD_STORE_DIR=~/brain pass smoke) == 1337 + - git submodule update --init - $(nix-build krebs/krops.nix --no-out-link --argstr name wolf --argstr target /tmp -A test) nix-shell test: stage: test @@ -30,6 +31,7 @@ wolf deployment: stage: deploy script: - GIT_SSH_COMMAND="ssh -i ~/.ssh/gitlab_deploy.key" git clone git@ssh.git.shackspace.de:rz/secrets.git ~/brain + - git submodule update --init - $(nix-build krebs/krops.nix --no-out-link --argstr name wolf -A deploy) nur-packages makefu: stage: deploy -- cgit v1.2.3 From 19e25f58566866b7c5182ab0d26ff66cba2eeffd Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 7 Jul 2019 21:18:32 +0200 Subject: shack/gitlab-ci: enable graceful shutdown --- krebs/2configs/shack/gitlab-runner.nix | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/krebs/2configs/shack/gitlab-runner.nix b/krebs/2configs/shack/gitlab-runner.nix index 0fd06426a..f1bb94f37 100644 --- a/krebs/2configs/shack/gitlab-runner.nix +++ b/krebs/2configs/shack/gitlab-runner.nix @@ -13,9 +13,12 @@ in imports = [ "${runner-src}/gitlab-runner.nix" ]; - services.gitlab-runner2.enable = true; - ## registrationConfigurationFile contains: - # CI_SERVER_URL= - # REGISTRATION_TOKEN= - services.gitlab-runner2.registrationConfigFile = ; + services.gitlab-runner2 = { + enable = true; + ## registrationConfigurationFile contains: + # CI_SERVER_URL= + # REGISTRATION_TOKEN= + registrationConfigFile = ; + gracefulTermination = true; + }; } -- cgit v1.2.3 From 053a74ebbf1448382262d2f51c5073472e616b12 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 7 Jul 2019 23:15:55 +0200 Subject: puyak.r: enable gitlab-runner --- krebs/1systems/puyak/config.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/krebs/1systems/puyak/config.nix b/krebs/1systems/puyak/config.nix index f9b83ef21..ea73e4bd2 100644 --- a/krebs/1systems/puyak/config.nix +++ b/krebs/1systems/puyak/config.nix @@ -14,6 +14,7 @@ + ]; krebs.build.host = config.krebs.hosts.puyak; @@ -60,6 +61,9 @@ }; services.logind.lidSwitch = "ignore"; + services.logind.lidSwitchExternalPower = "ignore"; + + services.udev.extraRules = '' SUBSYSTEM=="net", ATTR{address}=="8c:70:5a:b2:84:58", NAME="wl0" SUBSYSTEM=="net", ATTR{address}=="3c:97:0e:07:b9:14", NAME="et0" -- cgit v1.2.3 From f4ec0418f2ed9a513a9056af8f7458d760760a44 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 8 Jul 2019 00:55:47 +0200 Subject: gitlab-ci: use wolf.shack as target --- .gitlab-ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6afbfe08c..f893331b4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -32,7 +32,9 @@ wolf deployment: script: - GIT_SSH_COMMAND="ssh -i ~/.ssh/gitlab_deploy.key" git clone git@ssh.git.shackspace.de:rz/secrets.git ~/brain - git submodule update --init - - $(nix-build krebs/krops.nix --no-out-link --argstr name wolf -A deploy) + - ssh-keyscan -H 'wolf.shack' >> ~/.ssh/known_hosts + # TODO, hostname wolf cannot be resolved + - $(nix-build krebs/krops.nix --no-out-link --argstr name wolf --argstr target wolf.shack -A deploy) nur-packages makefu: stage: deploy script: -- cgit v1.2.3 From 7ca133e90b565e0cd97fe447b3bd4872d11a22a8 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 8 Jul 2019 00:58:38 +0200 Subject: shack/gitlab-runner: do not restart service on change --- .gitlab-ci.yml | 5 ++++- krebs/2configs/shack/gitlab-runner.nix | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f893331b4..b5e92d084 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,9 +30,12 @@ nix-shell test: wolf deployment: stage: deploy script: - - GIT_SSH_COMMAND="ssh -i ~/.ssh/gitlab_deploy.key" git clone git@ssh.git.shackspace.de:rz/secrets.git ~/brain + - cp ~/.ssh/gitlab_deploy.key ~/.ssh/id_rsa + - git clone git@ssh.git.shackspace.de:rz/secrets.git ~/brain - git submodule update --init - ssh-keyscan -H 'wolf.shack' >> ~/.ssh/known_hosts + - ssh-keyscan -H 'wolf' >> ~/.ssh/known_hosts + - ssh wolf uname -a # TODO, hostname wolf cannot be resolved - $(nix-build krebs/krops.nix --no-out-link --argstr name wolf --argstr target wolf.shack -A deploy) nur-packages makefu: diff --git a/krebs/2configs/shack/gitlab-runner.nix b/krebs/2configs/shack/gitlab-runner.nix index f1bb94f37..501dc47ea 100644 --- a/krebs/2configs/shack/gitlab-runner.nix +++ b/krebs/2configs/shack/gitlab-runner.nix @@ -19,6 +19,7 @@ in # CI_SERVER_URL= # REGISTRATION_TOKEN= registrationConfigFile = ; - gracefulTermination = true; + #gracefulTermination = true; }; + systemd.services.gitlab-runner2.restartIfChanged = false; } -- cgit v1.2.3 From 0a8475344aafdfb623173c7586c3539337b9574e Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 8 Jul 2019 01:10:56 +0200 Subject: krebs/krops.nix: add target --- krebs/krops.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/krebs/krops.nix b/krebs/krops.nix index 8d38ed5b0..1f439f622 100644 --- a/krebs/krops.nix +++ b/krebs/krops.nix @@ -1,4 +1,4 @@ -{ name }: rec { +{ name, target ? name }: rec { krops = ../submodules/krops; @@ -63,7 +63,7 @@ # usage: $(nix-build --no-out-link --argstr name HOSTNAME -A deploy) deploy = pkgs.krops.writeDeploy "${name}-deploy" { source = source { test = false; }; - target = "root@${name}/var/src"; + target = "root@${target}/var/src"; }; # usage: $(nix-build --no-out-link --argstr name HOSTNAME --argstr target PATH -A test) -- cgit v1.2.3 From 172f53379283914542b794e7c917197e8ce017b3 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 8 Jul 2019 01:18:52 +0200 Subject: gitlab-ci: remove test code --- .gitlab-ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b5e92d084..bd0b32edc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,8 +34,6 @@ wolf deployment: - git clone git@ssh.git.shackspace.de:rz/secrets.git ~/brain - git submodule update --init - ssh-keyscan -H 'wolf.shack' >> ~/.ssh/known_hosts - - ssh-keyscan -H 'wolf' >> ~/.ssh/known_hosts - - ssh wolf uname -a # TODO, hostname wolf cannot be resolved - $(nix-build krebs/krops.nix --no-out-link --argstr name wolf --argstr target wolf.shack -A deploy) nur-packages makefu: -- cgit v1.2.3 From e5d7d6eee253ab9a33a72ea0452f3b92083e759f Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 8 Jul 2019 08:04:50 +0200 Subject: wolf.r: enable remote deployment --- krebs/1systems/wolf/config.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/krebs/1systems/wolf/config.nix b/krebs/1systems/wolf/config.nix index d684dcd1c..ed3a4c51d 100644 --- a/krebs/1systems/wolf/config.nix +++ b/krebs/1systems/wolf/config.nix @@ -130,6 +130,7 @@ in config.krebs.users.raute.pubkey config.krebs.users.makefu-omo.pubkey "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAEAQDb9NPa2Hf51afcG1H13UPbE5E02J8aC9a1sGCRls592wAVlQbmojYR1jWDPA2m32Bsyv0ztqi81zDyndWWZPQVJVBk00VjYBcgk6D5ifqoAuWLzfuHJPWZGOvBf/U74/LNFNUkj1ywjneK7HYTRPXrRBBfBSQNmQzkvue7s599L2vdueZKyjNsMpx2m6nm2SchaMuDskSQut/168JgU1l4M8BeT68Bo4WdelhBYnhSI1a59FGkgdu2SCjyighLQRy2sOH3ksnkHWENPkA+wwQOlKl7R3DsEybrNd4NU9FSwFDyDmdhfv5gJp8UGSFdjAwx43+8zM5t5ruZ25J0LnVb0PuTuRA00UsW83MkLxFpDQLrQV08tlsY6iGrqxP67C3VJ6t4v6oTp7/vaRLhEFc1PhOLh+sZ18o8MLO+e2rGmHGHQnSKfBOLUvDMGa4jb01XBGjdnIXLOkVo79YR5jZn7jJb2gTZ95OD6bWSDADoURSuwuLa7kh4ti1ItAKuhkIvbuky3rRVvQEc92kJ6aNUswIUXJa0K2ibbIY6ycKAA3Ljksl3Mm9KzOn6yc/i/lSF+SOrTGhabPJigKkIoqKIwnV5IU3gkfsxPQJOBMPqHDGAOeYQe3WpWedEPYuhQEczw4exMb9TkNE96F71PzuQPJDl5sPAWyPLeMKpy5XbfRiF2by4nxN3ZIQvjtoyVkjNV+qM0q0yKBzLxuRAEQOZ2yCEaBudZQkQiwHD97H2vu4SRQ/2aOie1XiOnmdbQRDZSO3BsoDK569K1w+gDfSnqY7zVUMj6tw+uKx6Gstck5lbvYMtdWKsfPv/pDM8eyIVFLL93dKTX+ertcQj6xDwLfOiNubE5ayFXhYkjwImV6NgfBuq+3hLK0URP2rPlOZbbZTQ0WlKD6CCRZPMSZCU9oD2zYfqpvRArBUcdkAwGePezORkfJQLE6mYEJp6pdFkJ/IeFLbO6M0lZVlfnpzAC9kjjkMCRofZUETcFSppyTImCbgo3+ok59/PkNU5oavBXyW80ue2tWHr08HX/QALNte3UITmIIlU6SFMCPMWJqadK1eDPWfJ4H4iDXRNn3D5wqN++iMloKvpaj0wieqXLY4+YfvNTNr177OU48GEWW8DnoEkbpwsCbjPxznGDQhdDqdYyMY/fDgRQReKITvKYGHRzesGysw5cKsp9LEfXD0R6WE2TeiiENla5AWzTgXJB0AyZEcOiIfqOgT9Nr9S8q5gc/BdA7P+jhGGJgEHhV3dVlfIZ7pmZc27Yu7UTQ0lbAKWqcMSTOdne+QL6ILzbvLrQwdvax4tQdm5opfU16SrOox1AMwAbkdq84z6uJqYVx3cUXfMJgTyDNrVv3or root@plattenschwein" # for backup + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC1Lx5MKtVjB/Ef6LpEiIAgVwY5xKQFdHuLQR+odQO4cAgxj1QaIXGN0moixY52DebVQhAtiCNiFZ83uJyOj8kmu30yuXwtSOQeqziA859qMJKZ4ZcYdKvbXwnf2Chm5Ck/0FvtpjTWHIZAogwP1wQto/lcqHOjrTAnZeJfQuHTswYUSnmUU5zdsEZ9HidDPUc2Gv0wkBNd+KMQyOZl0HkaxHWvn0h4KK4hYZisOpeTfXJxD87bo+Eg4LL2vvnHW6dF6Ygrbd/0XRMsRRI8OAReVBUoJn7IE1wwAl/FpblNmhaF9hlL7g7hR1ADvaWMMw0e8SSzW6Y+oIa8qFQL6wR1 gitlab-builder" # for being deployed by gitlab ci ]; services.udev.extraRules = '' SUBSYSTEM=="net", ATTR{address}=="${external-mac}", NAME="${ext-if}" -- cgit v1.2.3 From 1c3286eca34c67d5411bcedb666cb2aa62c9ae9e Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 8 Jul 2019 11:53:46 +0200 Subject: gitlab-ci: only run deploy on changes in krebs --- .gitlab-ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bd0b32edc..fb273c932 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -36,6 +36,12 @@ wolf deployment: - ssh-keyscan -H 'wolf.shack' >> ~/.ssh/known_hosts # TODO, hostname wolf cannot be resolved - $(nix-build krebs/krops.nix --no-out-link --argstr name wolf --argstr target wolf.shack -A deploy) + only: + changes: + - .gitlab-ci.yml + - krebs/**/* + - lib/**/* + - .gitmodules nur-packages makefu: stage: deploy script: @@ -44,5 +50,8 @@ nur-packages makefu: - git remote add deploy git@github.com:makefu/nur-packages.git || git remote set-url deploy git@github.com:makefu/nur-packages.git - GIT_SSH_COMMAND="ssh -i ~/.ssh/github_deploy.key" git push --force deploy HEAD:master - curl -XPOST http://nur-update.herokuapp.com/update?repo=makefu + only: + changes: + - makefu/**/* after_script: - rm -rf .ssh/ -- cgit v1.2.3 From 4ce32d170826360f577624323d94a4c5432764f7 Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 9 Jul 2019 13:35:47 +0200 Subject: ma bureautomation: split schlechteluft in 2 automations (long and short) --- .../bureautomation/automation/schlechteluft.nix | 45 ++++++++++++++++++++-- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/makefu/2configs/bureautomation/automation/schlechteluft.nix b/makefu/2configs/bureautomation/automation/schlechteluft.nix index 4a5fb17c2..8787ee280 100644 --- a/makefu/2configs/bureautomation/automation/schlechteluft.nix +++ b/makefu/2configs/bureautomation/automation/schlechteluft.nix @@ -1,13 +1,13 @@ let -secs = 60; + long_threshold = 30; in [ { - alias = "Bad Air Alarm"; + alias = "Bad Air Alarm 60 seconds"; trigger = { platform = "numeric_state"; entity_id = "sensor.air_quality"; above = 1523; - for.seconds = secs; + for.seconds = 60; }; condition = { condition = "and"; @@ -29,8 +29,45 @@ in [ "script.schlechteluft" ]; } + ]; + } + { + alias = "Bad Air Alarm ${toString long_threshold} Minutes"; + trigger = + { platform = "numeric_state"; + entity_id = "sensor.air_quality"; + above = 1523; + for.minutes = long_threshold; + }; + condition = { + condition = "and"; + conditions = [ + { condition = "state"; + entity_id = "group.team"; + state = "home"; + } + { condition = "time"; + after = "06:00:00"; + before = "20:00:00"; + } + ]; + }; + + action = [ + { service = "homeassistant.turn_on"; + entity_id = [ + "script.schlechteluft" + ]; + } + { service = "tts.google_say"; + entity_id = "media_player.mpd"; + data_template = { + message = "BEEP BEEP - Die luft ist schon ${toString long_threshold} Minuten schlecht! Student Nummer {{ range(1,500) | random }}, öffne ein Fenster."; + language = "de"; + }; + } { service = "notify.matrix_notify"; - data_template.message = "Bad Air Alarm! VOC above threshold for ${toString secs} seconds ({{states.sensor.air_quality.state_with_unit}})"; + data_template.message = "Schlechte Luft Alarm seit ${toString long_threshold} Minuten ({{states.sensor.air_quality.state_with_unit}})!"; } ]; } -- cgit v1.2.3 From bb0bd75d7854b4612b9843729ab93a2c90cd69f5 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 11 Jul 2019 09:35:36 +0200 Subject: shack/muellshack: init --- krebs/2configs/shack/muellshack.nix | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 krebs/2configs/shack/muellshack.nix diff --git a/krebs/2configs/shack/muellshack.nix b/krebs/2configs/shack/muellshack.nix new file mode 100644 index 000000000..3a8d1cd88 --- /dev/null +++ b/krebs/2configs/shack/muellshack.nix @@ -0,0 +1,42 @@ +{ config, lib, pkgs, ... }: + +let + pkg = pkgs.callPackage ( + pkgs.fetchgit { + url = "https://git.shackspace.de/rz/muellshack"; + rev = "d8a5e2d4c0a22804838675ac42b468299dcd9a76"; + sha256 = "0ff6q64dgdxmpszp94z100fdic175b1vvxn4crg8p0jcabzxsv0m"; + }) {}; + home = "/var/lib/muellshack"; + port = "8081"; +in { + users.users.muellshack = { + inherit home; + createHome = true; + }; + services.nginx.virtualHosts."muell.shack" = { + locations."/" = { + proxyPass = "http://localhost:${port}/muellshack/"; + }; + }; + services.nginx.virtualHosts."openhab.shack" = { + locations."/muellshack".proxyPass = "http://localhost:${port}"; + }; + systemd.services.muellshack = { + description = "muellshack"; + wantedBy = [ "multi-user.target" ]; + environment.PORT = port; + serviceConfig = { + User = "muellshack"; + # do not override the current storage fil + ExecStartPre = pkgs.writeDash "call-muell-pre" '' + cp -vf ${pkg}/share/static_muelldata.json ${home} + cp -vn ${pkg}/share/storage.json ${home} + ''; + WorkingDirectory = home; + ExecStart = "${pkg}/bin/muellshack"; + Restart = "always"; + PrivateTmp = true; + }; + }; +} -- cgit v1.2.3 From 9f27ddabacb1f163751d5ce45de0b972bb22aab3 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 11 Jul 2019 09:37:23 +0200 Subject: shack/gitlab-runner: docker.restartIfChanged = false --- krebs/2configs/shack/gitlab-runner.nix | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/krebs/2configs/shack/gitlab-runner.nix b/krebs/2configs/shack/gitlab-runner.nix index 501dc47ea..5f2ca02d9 100644 --- a/krebs/2configs/shack/gitlab-runner.nix +++ b/krebs/2configs/shack/gitlab-runner.nix @@ -6,10 +6,6 @@ let }; in { - systemd.services.gitlab-runner.path = [ - "/run/wrappers" # /run/wrappers/bin/su - "/" # /bin/sh - ]; imports = [ "${runner-src}/gitlab-runner.nix" ]; @@ -22,4 +18,5 @@ in #gracefulTermination = true; }; systemd.services.gitlab-runner2.restartIfChanged = false; + systemd.services.docker.restartIfChanged = false; } -- cgit v1.2.3 From bfff5c1a92af27cf01d52c24bb7e15f8f559b499 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 11 Jul 2019 09:37:46 +0200 Subject: wolf.r: enable muellshack --- krebs/1systems/wolf/config.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/krebs/1systems/wolf/config.nix b/krebs/1systems/wolf/config.nix index ed3a4c51d..a1d2b8260 100644 --- a/krebs/1systems/wolf/config.nix +++ b/krebs/1systems/wolf/config.nix @@ -23,6 +23,8 @@ in # # Say if muell will be collected + # provide muellshack api + # create samba share for anonymous usage with the laser and 3d printer pc -- cgit v1.2.3 From 4dad3683f9acfa243b195e498af422b25bb9056e Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 11 Jul 2019 18:11:22 +0200 Subject: shack/muellshack: make storage.json writeable --- krebs/2configs/shack/muellshack.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/krebs/2configs/shack/muellshack.nix b/krebs/2configs/shack/muellshack.nix index 3a8d1cd88..928972140 100644 --- a/krebs/2configs/shack/muellshack.nix +++ b/krebs/2configs/shack/muellshack.nix @@ -32,6 +32,7 @@ in { ExecStartPre = pkgs.writeDash "call-muell-pre" '' cp -vf ${pkg}/share/static_muelldata.json ${home} cp -vn ${pkg}/share/storage.json ${home} + chmod 700 ${home}/storage.json ''; WorkingDirectory = home; ExecStart = "${pkg}/bin/muellshack"; -- cgit v1.2.3 From 31960101a75796c184d44264744da73d27f8cd78 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 11 Jul 2019 18:11:50 +0200 Subject: shack/node-light: init --- krebs/2configs/shack/node-light.nix | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 krebs/2configs/shack/node-light.nix diff --git a/krebs/2configs/shack/node-light.nix b/krebs/2configs/shack/node-light.nix new file mode 100644 index 000000000..d7e9e90bb --- /dev/null +++ b/krebs/2configs/shack/node-light.nix @@ -0,0 +1,53 @@ +{ config, lib, pkgs, ... }: + +let + pkg = pkgs.callPackage ( + pkgs.fetchgit { + url = "https://git.shackspace.de/rz/node-light.git"; + rev = "a32c782650c4cc0adf51250fe249167d7246c59b"; + sha256 = "0clvcp1m2ay0a9ibh7s21q7d9a6nam3497bysvc6mdygblks22qy"; + }) {}; + home = "/var/lib/node-light"; + port = "8082"; +in { + # receive response from light.shack / standby.shack + networking.firewall.allowedUDPPorts = [ 2342 ]; + users.users.node-light = { + inherit home; + createHome = true; + }; + services.nginx.virtualHosts."lounge.light.shack" = { + locations."/" = { + proxyPass = "http://localhost:${port}/lounge/"; + }; + }; + services.nginx.virtualHosts."power.light.shack" = { + locations."/" = { + proxyPass = "http://localhost:${port}/power/"; + }; + }; + + services.nginx.virtualHosts."openhab.shack" = { + serverAliases = [ "lightapi.shack" ]; + locations."/power".proxyPass = "http://localhost:${port}"; + locations."/lounge".proxyPass = "http://localhost:${port}"; + }; + systemd.services.node-light= { + description = "node-light"; + wantedBy = [ "multi-user.target" ]; + environment.PORT = port; + serviceConfig = { + User = "node-light"; + # do not override the current storage file + ExecStartPre = pkgs.writeDash "call-light-pre" '' + cp -vn ${pkg}/share/storage.json ${home} + chmod 700 ${home}/storage.json + + ''; + WorkingDirectory = home; + ExecStart = "${pkg}/bin/node-light"; + Restart = "always"; + PrivateTmp = true; + }; + }; +} -- cgit v1.2.3 From cf81f41a900edea9aab968c7c52e53ab04a311f3 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 11 Jul 2019 18:12:09 +0200 Subject: wolf.r: deploy node-light --- krebs/1systems/wolf/config.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/krebs/1systems/wolf/config.nix b/krebs/1systems/wolf/config.nix index a1d2b8260..4c73198ca 100644 --- a/krebs/1systems/wolf/config.nix +++ b/krebs/1systems/wolf/config.nix @@ -25,6 +25,8 @@ in # provide muellshack api + # provide light control api + # create samba share for anonymous usage with the laser and 3d printer pc -- cgit v1.2.3 From 80ed71e9b85ae06dea54ec1de7637ac9abd2a4aa Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 12 Jul 2019 17:20:54 +0200 Subject: shack/muell_mail: init --- krebs/0tests/data/secrets/shack/muell_mail.js | 0 krebs/2configs/shack/muell_mail.nix | 33 +++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 krebs/0tests/data/secrets/shack/muell_mail.js create mode 100644 krebs/2configs/shack/muell_mail.nix diff --git a/krebs/0tests/data/secrets/shack/muell_mail.js b/krebs/0tests/data/secrets/shack/muell_mail.js new file mode 100644 index 000000000..e69de29bb diff --git a/krebs/2configs/shack/muell_mail.nix b/krebs/2configs/shack/muell_mail.nix new file mode 100644 index 000000000..732269c88 --- /dev/null +++ b/krebs/2configs/shack/muell_mail.nix @@ -0,0 +1,33 @@ +{ config, lib, pkgs, ... }: + +let + pkg = pkgs.callPackage ( + pkgs.fetchgit { + url = "https://git.shackspace.de/rz/muell_mail"; + rev = "317370e3e98ce34da4ee615af7a80df7b519ab89"; + sha256 = "sha256:02mywm37n0v4icgy474wwkavb7vad93bvkigvz1cqn7fbg4ldc8k"; + }) {}; + home = "/var/lib/muell_mail"; + cfg = toString ; +in { + users.users.muell_mail = { + inherit home; + createHome = true; + }; + systemd.services.muell_mail = { + description = "muell_mail"; + wantedBy = [ "multi-user.target" ]; + environment.CONFIG = "${home}/muell_mail.js"; + serviceConfig = { + User = "muell_mail"; + ExecStartPre = pkgs.writeDash "muell_mail-pre" '' + install -D -omuell_mail -m700 ${cfg} ${home}/muell_mail.js + ''; + WorkingDirectory = home; + PermissionsStartOnly = true; + ExecStart = "${pkg}/bin/muell_mail"; + Restart = "always"; + PrivateTmp = true; + }; + }; +} -- cgit v1.2.3 From 13773d684c4c7c9802307e4968e21c70989769fe Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 12 Jul 2019 17:22:03 +0200 Subject: wolf.r: configure muell_mail --- krebs/1systems/wolf/config.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/krebs/1systems/wolf/config.nix b/krebs/1systems/wolf/config.nix index 4c73198ca..5a9a481bf 100644 --- a/krebs/1systems/wolf/config.nix +++ b/krebs/1systems/wolf/config.nix @@ -27,6 +27,8 @@ in # provide light control api + # send mail if muell was not handled + # create samba share for anonymous usage with the laser and 3d printer pc -- cgit v1.2.3 From e767afa039b7441bd9709cdb9f4ce993cb2830cb Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 15 Jul 2019 09:58:20 +0200 Subject: shack/muell_mail,s3-power: update commits --- krebs/2configs/shack/muell_mail.nix | 4 ++-- krebs/2configs/shack/s3-power.nix | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 krebs/2configs/shack/s3-power.nix diff --git a/krebs/2configs/shack/muell_mail.nix b/krebs/2configs/shack/muell_mail.nix index 732269c88..39d49918d 100644 --- a/krebs/2configs/shack/muell_mail.nix +++ b/krebs/2configs/shack/muell_mail.nix @@ -4,8 +4,8 @@ let pkg = pkgs.callPackage ( pkgs.fetchgit { url = "https://git.shackspace.de/rz/muell_mail"; - rev = "317370e3e98ce34da4ee615af7a80df7b519ab89"; - sha256 = "sha256:02mywm37n0v4icgy474wwkavb7vad93bvkigvz1cqn7fbg4ldc8k"; + rev = "861ec25ab22797d8961efb32e72d79e113aa9f0f"; + sha256 = "sha256:18cw95zbr7isv4cw80cbpd84n5z208fwh5390i6j10jkn398mjq2"; }) {}; home = "/var/lib/muell_mail"; cfg = toString ; diff --git a/krebs/2configs/shack/s3-power.nix b/krebs/2configs/shack/s3-power.nix new file mode 100644 index 000000000..f0648d00b --- /dev/null +++ b/krebs/2configs/shack/s3-power.nix @@ -0,0 +1,33 @@ +{ config, lib, pkgs, ... }: + +let + pkg = pkgs.callPackage ( + pkgs.fetchgit { + url = "https://git.shackspace.de/rz/s3-power"; + rev = "1a59f8e34924c8809d06895bd96c7f98d037026e"; + sha256 = "sha256:191625mg7n41852h1c0ay3492f29n7kxkab0kwczyp07xh5y25nn"; + }) {}; + home = "/var/lib/s3-power"; + cfg = toString ; +in { + users.users.s3_power = { + inherit home; + createHome = true; + }; + systemd.services.s3-power = { + description = "s3-power"; + wantedBy = [ "multi-user.target" ]; + environment.CONFIG = "${home}/s3-power.json"; + serviceConfig = { + User = "s3_power"; + ExecStartPre = pkgs.writeDash "s3-power-pre" '' + install -D -os3_power -m700 ${cfg} ${home}/s3-power.json + ''; + WorkingDirectory = home; + PermissionsStartOnly = true; + ExecStart = "${pkg}/bin/s3-power"; + Restart = "always"; + PrivateTmp = true; + }; + }; +} -- cgit v1.2.3 From 4325cce945781c93c04faf71705b0f19f723542a Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 16 Jul 2019 09:04:18 +0200 Subject: wolf.r: enable s3-power --- krebs/1systems/wolf/config.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/krebs/1systems/wolf/config.nix b/krebs/1systems/wolf/config.nix index 5a9a481bf..9a7371c13 100644 --- a/krebs/1systems/wolf/config.nix +++ b/krebs/1systems/wolf/config.nix @@ -29,6 +29,8 @@ in # send mail if muell was not handled + # send mail if muell was not handled + # create samba share for anonymous usage with the laser and 3d printer pc -- cgit v1.2.3 From cd1ab46c3b2069318c72dc56e7cfe7ae5a06f3e9 Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 16 Jul 2019 09:11:41 +0200 Subject: 0tests: add shack/s3-power.json --- krebs/0tests/data/secrets/shack/s3-power.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 krebs/0tests/data/secrets/shack/s3-power.json diff --git a/krebs/0tests/data/secrets/shack/s3-power.json b/krebs/0tests/data/secrets/shack/s3-power.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/krebs/0tests/data/secrets/shack/s3-power.json @@ -0,0 +1 @@ +{} -- cgit v1.2.3 From 570af0025a1ff0e1346b7efcacf6eb00ebc7d4d6 Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 16 Jul 2019 18:57:09 +0200 Subject: shack/muellshack,node-light: fix paths --- krebs/2configs/shack/muellshack.nix | 2 +- krebs/2configs/shack/node-light.nix | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/krebs/2configs/shack/muellshack.nix b/krebs/2configs/shack/muellshack.nix index 928972140..1e6843bdf 100644 --- a/krebs/2configs/shack/muellshack.nix +++ b/krebs/2configs/shack/muellshack.nix @@ -20,7 +20,7 @@ in { }; }; services.nginx.virtualHosts."openhab.shack" = { - locations."/muellshack".proxyPass = "http://localhost:${port}"; + locations."/muellshack/".proxyPass = "http://localhost:${port}/muellshack/"; }; systemd.services.muellshack = { description = "muellshack"; diff --git a/krebs/2configs/shack/node-light.nix b/krebs/2configs/shack/node-light.nix index d7e9e90bb..63772f182 100644 --- a/krebs/2configs/shack/node-light.nix +++ b/krebs/2configs/shack/node-light.nix @@ -29,8 +29,8 @@ in { services.nginx.virtualHosts."openhab.shack" = { serverAliases = [ "lightapi.shack" ]; - locations."/power".proxyPass = "http://localhost:${port}"; - locations."/lounge".proxyPass = "http://localhost:${port}"; + locations."/power/".proxyPass = "http://localhost:${port}/power/"; + locations."/lounge/".proxyPass = "http://localhost:${port}/lounge/"; }; systemd.services.node-light= { description = "node-light"; -- cgit v1.2.3 From 64c0ea71430e4aeb0bfe385439c631b3c4d6b8f3 Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 16 Jul 2019 19:47:49 +0200 Subject: shack/s3-power: use one-shot version --- krebs/2configs/shack/s3-power.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/krebs/2configs/shack/s3-power.nix b/krebs/2configs/shack/s3-power.nix index f0648d00b..2b136478d 100644 --- a/krebs/2configs/shack/s3-power.nix +++ b/krebs/2configs/shack/s3-power.nix @@ -4,8 +4,8 @@ let pkg = pkgs.callPackage ( pkgs.fetchgit { url = "https://git.shackspace.de/rz/s3-power"; - rev = "1a59f8e34924c8809d06895bd96c7f98d037026e"; - sha256 = "sha256:191625mg7n41852h1c0ay3492f29n7kxkab0kwczyp07xh5y25nn"; + rev = "36df203a8fc1af02b08f60ab8d49c849b01e711f"; + sha256 = "sha256:0i05vllnfwj02sfpmg2m8hy0zq27kww9ampiaix6dl5wbyjlp51j"; }) {}; home = "/var/lib/s3-power"; cfg = toString ; @@ -15,10 +15,11 @@ in { createHome = true; }; systemd.services.s3-power = { + startAt = "daily"; description = "s3-power"; - wantedBy = [ "multi-user.target" ]; environment.CONFIG = "${home}/s3-power.json"; serviceConfig = { + Type = "oneshot"; User = "s3_power"; ExecStartPre = pkgs.writeDash "s3-power-pre" '' install -D -os3_power -m700 ${cfg} ${home}/s3-power.json @@ -26,7 +27,6 @@ in { WorkingDirectory = home; PermissionsStartOnly = true; ExecStart = "${pkg}/bin/s3-power"; - Restart = "always"; PrivateTmp = true; }; }; -- cgit v1.2.3 From 31944ce77dfd63f0778952b6ae5a29f7ae8a0cab Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 16 Jul 2019 19:48:47 +0200 Subject: wolf.r: also use openhab ip address --- krebs/1systems/wolf/config.nix | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/krebs/1systems/wolf/config.nix b/krebs/1systems/wolf/config.nix index 9a7371c13..d2f0eaeb0 100644 --- a/krebs/1systems/wolf/config.nix +++ b/krebs/1systems/wolf/config.nix @@ -1,6 +1,7 @@ { config, pkgs, ... }: let shack-ip = config.krebs.build.host.nets.shack.ip4.addr; + openhab-ip = "10.42.2.139"; # powerraw contains the hardcoded ip of openhab.shack influx-host = "127.0.0.1"; ext-if = "et0"; external-mac = "52:54:b0:0b:af:fe"; @@ -89,10 +90,16 @@ in networking = { firewall.enable = false; firewall.allowedTCPPorts = [ 8088 8086 8083 ]; - interfaces."${ext-if}".ipv4.addresses = [{ - address = shack-ip; - prefixLength = 20; - }]; + interfaces."${ext-if}".ipv4.addresses = [ + { + address = shack-ip; + prefixLength = 20; + } + { + address = openhab-ip; + prefixLength = 20; + } + ]; defaultGateway = "10.42.0.1"; nameservers = [ "10.42.0.100" "10.42.0.200" ]; -- cgit v1.2.3 From da4ecbeccd174e1d519bafb15ad0935aa2cec1b2 Mon Sep 17 00:00:00 2001 From: ulrich Date: Wed, 17 Jul 2019 00:46:15 +0200 Subject: wolf.r: remove openhab-ip --- krebs/1systems/wolf/config.nix | 5 ----- 1 file changed, 5 deletions(-) diff --git a/krebs/1systems/wolf/config.nix b/krebs/1systems/wolf/config.nix index d2f0eaeb0..0b6824e28 100644 --- a/krebs/1systems/wolf/config.nix +++ b/krebs/1systems/wolf/config.nix @@ -1,7 +1,6 @@ { config, pkgs, ... }: let shack-ip = config.krebs.build.host.nets.shack.ip4.addr; - openhab-ip = "10.42.2.139"; # powerraw contains the hardcoded ip of openhab.shack influx-host = "127.0.0.1"; ext-if = "et0"; external-mac = "52:54:b0:0b:af:fe"; @@ -95,10 +94,6 @@ in address = shack-ip; prefixLength = 20; } - { - address = openhab-ip; - prefixLength = 20; - } ]; defaultGateway = "10.42.0.1"; -- cgit v1.2.3 From c38f02c4d7a09cd8a1fd50b68f08338ae54a82bb Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 17 Jul 2019 00:53:56 +0200 Subject: shack/s3-power: update revision --- krebs/1systems/wolf/config.nix | 2 ++ krebs/2configs/shack/mqtt.nix | 14 ++++++++++++++ krebs/2configs/shack/s3-power.nix | 4 ++-- 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 krebs/2configs/shack/mqtt.nix diff --git a/krebs/1systems/wolf/config.nix b/krebs/1systems/wolf/config.nix index d2f0eaeb0..270a0056d 100644 --- a/krebs/1systems/wolf/config.nix +++ b/krebs/1systems/wolf/config.nix @@ -47,6 +47,8 @@ in ## Collect radioactive data and put into graphite + ## mqtt.shack + ## Collect local statistics via collectd and send to collectd diff --git a/krebs/2configs/shack/mqtt.nix b/krebs/2configs/shack/mqtt.nix new file mode 100644 index 000000000..5e7a1af7c --- /dev/null +++ b/krebs/2configs/shack/mqtt.nix @@ -0,0 +1,14 @@ +{ + network.firewall.allowedTCPPorts = [ 1883 ]; + network.firewall.allowedUDPPorts = [ 1883 ]; + services.mosquitto = { + enable = true; + host = "0.0.0.0"; + users = {}; + # TODO: secure that shit + aclExtraConf = '' + pattern readwrite /# + ''; + allowAnonymous = true; + }; +} diff --git a/krebs/2configs/shack/s3-power.nix b/krebs/2configs/shack/s3-power.nix index 2b136478d..40c42260f 100644 --- a/krebs/2configs/shack/s3-power.nix +++ b/krebs/2configs/shack/s3-power.nix @@ -4,8 +4,8 @@ let pkg = pkgs.callPackage ( pkgs.fetchgit { url = "https://git.shackspace.de/rz/s3-power"; - rev = "36df203a8fc1af02b08f60ab8d49c849b01e711f"; - sha256 = "sha256:0i05vllnfwj02sfpmg2m8hy0zq27kww9ampiaix6dl5wbyjlp51j"; + rev = "b2b87b56bb40d714dbbecd1285566870b256aec4"; + sha256 = "sha256:02wikwf3rgkkggwbwqisdvhlwd38w5pw011xhwvhnj114s3rynan"; }) {}; home = "/var/lib/s3-power"; cfg = toString ; -- cgit v1.2.3 From 35837fd8d6df7d3fe4797fbc478fb2ccd0581bcb Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 17 Jul 2019 10:43:12 +0200 Subject: shack/powerraw: init --- krebs/2configs/shack/powerraw.nix | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 krebs/2configs/shack/powerraw.nix diff --git a/krebs/2configs/shack/powerraw.nix b/krebs/2configs/shack/powerraw.nix new file mode 100644 index 000000000..9b957b783 --- /dev/null +++ b/krebs/2configs/shack/powerraw.nix @@ -0,0 +1,41 @@ +{ config, lib, pkgs, ... }: +# Replacement for powerraw.shack pollin box +# Requires usb-serial device on host +# Requires mqtt available at mqtt.shack +# Requires hostname powerraw.shack +let + pkg = pkgs.python3.pkgs.callPackage ( + pkgs.fetchgit { + url = "https://git.shackspace.de/rz/powermeter.git"; + rev = "96609f0d632e0732afa768ddd7b3f8841ca37c1b"; + sha256 = "sha256:0wfpm3ik5r081qv2crmpjwylgg2v8ximq347qh0fzq1rwv0dqbnn"; + }) {}; +in { + # receive response from light.shack / standby.shack + networking.firewall.allowedUDPPorts = [ 11111 ]; + users.users.powermeter = { + extraGroups = [ "dialout" ]; + }; + + systemd.services.powermeter-serial2mqtt = { + description = "powerraw Serial -> mqtt"; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + User = "powermeter"; + ExecStart = "${pkg}/bin/powermeter-serial2mqtt"; + Restart = "always"; + PrivateTmp = true; + }; + }; + + systemd.services.powermeter-mqtt2socket = { + description = "powerraw mqtt -> raw socket 11111"; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + User = "powermeter"; + ExecStart = "${pkg}/bin/powermeter-mqtt2socket"; + Restart = "always"; + PrivateTmp = true; + }; + }; +} -- cgit v1.2.3 From 73a5143866b2853f11a251c828681f92fd3aa703 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 17 Jul 2019 10:43:27 +0200 Subject: wolf.r: enable powerraw --- krebs/1systems/wolf/config.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/krebs/1systems/wolf/config.nix b/krebs/1systems/wolf/config.nix index 270a0056d..c16b55c22 100644 --- a/krebs/1systems/wolf/config.nix +++ b/krebs/1systems/wolf/config.nix @@ -32,6 +32,8 @@ in # send mail if muell was not handled + # powerraw usb serial to mqtt and raw socket + # create samba share for anonymous usage with the laser and 3d printer pc -- cgit v1.2.3 From 828d2fd14ac2e1545088a734f918cf85071d0116 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 17 Jul 2019 10:50:27 +0200 Subject: nixpkgs: d77e3bd -> 973a270 --- krebs/nixpkgs.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/krebs/nixpkgs.json b/krebs/nixpkgs.json index 4118a1dd6..aff83847e 100644 --- a/krebs/nixpkgs.json +++ b/krebs/nixpkgs.json @@ -1,7 +1,7 @@ { "url": "https://github.com/NixOS/nixpkgs-channels", - "rev": "d77e3bd661354ea775a8cacc97bb59ddde513c09", - "date": "2019-06-18T23:08:17+02:00", - "sha256": "1m82zs00n6nc0pkdpmd9amm013qxwksjfhzcm6gck3p469q7n866", + "rev": "973a2705351605915bda866f01f65c8fae304985", + "date": "2019-07-16T21:39:25+03:00", + "sha256": "06sp132w8difm9kjz71gh9q6pbcy3k9l8cbzpab44m5mwsm0z8x9", "fetchSubmodules": false } -- cgit v1.2.3 From 8e0c6fc8c5a4d76f6485ee317dc91d5cfffe70f6 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 17 Jul 2019 10:55:36 +0200 Subject: shack/mqtt: update permissions --- krebs/2configs/default.nix | 7 +++++++ krebs/2configs/shack/mqtt.nix | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/krebs/2configs/default.nix b/krebs/2configs/default.nix index fafcd72c3..8771c0e1d 100644 --- a/krebs/2configs/default.nix +++ b/krebs/2configs/default.nix @@ -34,6 +34,13 @@ with import ; rxvt_unicode.terminfo ]; + i18n = { + consoleKeyMap = "us"; + defaultLocale = lib.mkForce "C"; + }; + + + programs.ssh.startAgent = false; services.openssh = { diff --git a/krebs/2configs/shack/mqtt.nix b/krebs/2configs/shack/mqtt.nix index 5e7a1af7c..8e5438db2 100644 --- a/krebs/2configs/shack/mqtt.nix +++ b/krebs/2configs/shack/mqtt.nix @@ -1,13 +1,13 @@ { - network.firewall.allowedTCPPorts = [ 1883 ]; - network.firewall.allowedUDPPorts = [ 1883 ]; + networking.firewall.allowedTCPPorts = [ 1883 ]; + networking.firewall.allowedUDPPorts = [ 1883 ]; services.mosquitto = { enable = true; host = "0.0.0.0"; users = {}; # TODO: secure that shit aclExtraConf = '' - pattern readwrite /# + pattern readwrite # ''; allowAnonymous = true; }; -- cgit v1.2.3 From a45066902735f72a945f7b2d8c76c6d35e4a69bd Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 17 Jul 2019 13:55:33 +0200 Subject: shack/powerraw: send stats to influx as well --- krebs/2configs/shack/powerraw.nix | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/krebs/2configs/shack/powerraw.nix b/krebs/2configs/shack/powerraw.nix index 9b957b783..af3f129c1 100644 --- a/krebs/2configs/shack/powerraw.nix +++ b/krebs/2configs/shack/powerraw.nix @@ -4,6 +4,7 @@ # Requires mqtt available at mqtt.shack # Requires hostname powerraw.shack let + influx-url = "http://influx.shack:8086"; pkg = pkgs.python3.pkgs.callPackage ( pkgs.fetchgit { url = "https://git.shackspace.de/rz/powermeter.git"; @@ -13,9 +14,7 @@ let in { # receive response from light.shack / standby.shack networking.firewall.allowedUDPPorts = [ 11111 ]; - users.users.powermeter = { - extraGroups = [ "dialout" ]; - }; + users.users.powermeter.extraGroups = [ "dialout" ]; systemd.services.powermeter-serial2mqtt = { description = "powerraw Serial -> mqtt"; @@ -38,4 +37,36 @@ in { PrivateTmp = true; }; }; + + services.telegraf = { + enable = true; + extraConfig = { + agent.debug = false; + outputs = { + influxdb = [{ + urls = [ influx-url ]; + database = "telegraf"; + }]; + }; + }; + }; + + services.telegraf.extraConfig.inputs.mqtt_consumer = let + genTopic = name: topic: tags: { + servers = [ "tcp://mqtt.shack:1883" ]; + qos = 0; + connection_timeout = "30s"; + topics = [ topic ]; + inherit tags; + persistent_session = false; + name_override = name; + data_format = "value"; + data_type = "float"; + }; + sensor = "total"; + types = [ "Voltage" "Current" "Power" ]; + phases = [ 1 2 3 ]; + in + [ (genTopic "Power consumed" "/power/${sensor}/consumed" { inherit sensor; }) ] ++ + (lib.flatten (map (type: (map (phase: (genTopic "Power" "/power/${sensor}/L${toString phase}/${type}" { inherit sensor phase type; }) ) phases)) types)); } -- cgit v1.2.3 From 52d3e264284bdaa5f18f2ec0c6029d0a48d21b2a Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 17 Jul 2019 14:37:34 +0200 Subject: ma bureautomation: home-assistant disable tests --- makefu/2configs/bureautomation/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/makefu/2configs/bureautomation/default.nix b/makefu/2configs/bureautomation/default.nix index b783d8e01..8ec9dacc2 100644 --- a/makefu/2configs/bureautomation/default.nix +++ b/makefu/2configs/bureautomation/default.nix @@ -21,6 +21,9 @@ in { enable = true; package = (pkgs.home-assistant.overrideAttrs (old: { # TODO: find correct python package + installCheckPhase = '' + echo LOLLLLLLLLLLLLLL + ''; postInstall = '' cp -r ${dwd_pollen} $out/lib/python3.7/site-packages/homeassistant/components/dwd_pollen ''; -- cgit v1.2.3 From 124b1d7639c404e5a58a9aef0f0bee1424f54a45 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 17 Jul 2019 18:24:53 +0200 Subject: ma bureautomation/10h timer: add hello and too-long quotes --- .../bureautomation/combination/10h_timers.nix | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/makefu/2configs/bureautomation/combination/10h_timers.nix b/makefu/2configs/bureautomation/combination/10h_timers.nix index 79a608cd7..dec5347a6 100644 --- a/makefu/2configs/bureautomation/combination/10h_timers.nix +++ b/makefu/2configs/bureautomation/combination/10h_timers.nix @@ -6,14 +6,19 @@ let ]; random_zu_lange = name: ''{{ [ "Du musst jetzt endlich nach Hause gehen ${name}!", - "10 Stunden sind rum, bald schenkst du den Franzosen deine Lebenszeit", + "${name} - 10 Stunden sind rum, bald schenkst du den Franzosen deine Lebenszeit", "Nur eine Minute über 10 Stunden kann zu einer Stunde Arbeit für Thorsten werden, ${name}.", "In 10 Minuten kommt dich der Security Mann holen, ${name}", + "Das Sandmännchen ist schon vorbei, gleich fallen dir die Augen zu ${name}.", + "Wenn ${name} sofort los geht, dann ist er noch rechtzeitig für den Tatort zu Hause.", + "${name} muss jetzt gehen, sonst verpasst er die Tagesschau!", + "Es ist spät ${name}. Ausstempeln hilft zwar kurzfristig, kann aber zu langfristigen Problemen führen.", + "${name}, wenn du nach zehn Stunden nach Hause gehst, muss dir dein Vorgesetzter ein Taxi bestellen", + "${name}, wenn du nach zehn Stunden nach Hause gehst, bist du auf dem Rückweg nicht mehr versichert!", "Zu lange, ${name}!" ] | random }}'' ; random_announce = name: ''{{ [ - "Guten Tag ${name}!", "${name} is in da House", "Ahoi ${name}", "Moinsen ${name}", @@ -31,21 +36,25 @@ let "Willkommen in deinem Lieblingsbüro, ${name}.", "Klopf, Klopf, wer ist da? ${name} ist da!", "Messer, Gabel, Schere, Licht sind für kleinen ${name} nicht.", - "Ich kenne ein Geheimnis, ${name} ist abgekommen", + "Ich kenne ein Geheimnis, ${name} ist angekommen", "Wir sind ${name}. Sie werden assimiliert werden", "Achtung, es erfolgt eine Durchsage. ${name} ist eingetroffen", "Die Scanner haben eine dem System bekannte Lebensform mit dem Namen ${name} detektiert", "Das Büro sieht dich, ${name}", + "Das Büro riecht dich, ${name}", "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 Punkte verschlechtert, bitte alle Fenster öffnen.", + "Die Tür geht auf, wer mag das sein? Schon schreitet hier der ${name} ein. Das Volk, es jubelt, Dirnen schmachten. Fürs Festmahl beginnt man schon zu schlachten. Er wird nur nach dem besten streben! Der ${name}, er soll lange leben!", "${name} arbeitet gern für seinen Konzern", "${name} ist nur froh im Großraumbüro", "Für ${name} ist die schönste Zeit ... die Arbeit", "Ein Fleißbienchen für ${name} zum rechtzeitigen Erscheinen im Büro", "${name} ist heute wohl doch nicht im Office Home", "${name} ist bereit für einen Tag voller Meetings", + "Und es startet für ${name} wieder ein Tag im Paradies", + "Lieber ${name}, Markus Keck hat dich bereits drei mal Versucht anzurufen!", "Trotz schwerer Männergrippe ist ${name} heute im Büro erschienen.", "${name} kenne keine Parteien mehr, ${name} kenne nur noch Arbeitsplätze", "${name}, Frage nicht, was dein Arbeitsplatz für dich tun kann. Frage, was du für deinen Arbeitsplatz tun kannst", @@ -55,8 +64,7 @@ let "Hach, ${name}, wenn du hier rein kommst fühlt es sich gleich wieder an wie Montag.", "Oh nein, nicht schon wieder ${name}", "Wer wohnt in der Ananas ganz tief im Meer? ${name} Schwammkopf!", - "Arbeit ist Freizeit! Wachstum ist Fortschritt! Sicherheit ist Freiheit!", - "Willkommen ${name}"] | random }}'' ; + "Arbeit ist Freizeit! Wachstum ist Fortschritt! Sicherheit ist Freiheit! Eine kleine Erinnerung für ${name}"] | random }}'' ; tmr_10h = name: { "${name}_10h" = { name = "${name} 10h Timer"; @@ -91,7 +99,7 @@ let { "announce_${name}" = { alias = "Random Announce ${name}"; sequence = [ - { delay.seconds = 10; } + { delay.seconds = 7; } { service = "media_player.play_media"; data = { entity_id = "media_player.mpd"; @@ -99,7 +107,7 @@ let media_content_id = "ansage"; }; } - { delay.seconds = 5; } + { delay.seconds = 4; } { service = "tts.google_say"; entity_id = "media_player.mpd"; data_template = { -- cgit v1.2.3 From d3d9f58badbcad548bb7c7ca98757cfbd4143f96 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 3 Aug 2019 13:19:59 +0200 Subject: nixpkgs: 754763f -> 4f2b76e --- krebs/nixpkgs.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/krebs/nixpkgs.json b/krebs/nixpkgs.json index 7363507ad..72afac981 100644 --- a/krebs/nixpkgs.json +++ b/krebs/nixpkgs.json @@ -1,7 +1,7 @@ { "url": "https://github.com/NixOS/nixpkgs-channels", - "rev": "754763ff4ba1dd03fe3fad3a0fea36d2e39f5860", - "date": "2019-07-05T14:34:03+02:00", - "sha256": "10752kda1rzljlpcchi826hmbc8853vnbg9rkh7s89mxq6yjnm15", + "rev": "4f2b76e45fcaf962137ae6a36a9cc60873be6ec2", + "date": "2019-08-02T21:36:54-04:00", + "sha256": "1c3h6a39cim2fdnwq6cp75dm46xfqc2mnsj0zgnrp412dqmaxkkc", "fetchSubmodules": false } -- cgit v1.2.3 From 0726c033b40c8f6aae715f3dbf5313304bbb4d44 Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 8 Aug 2019 17:34:24 +0200 Subject: hotdog.r: disable repo-sync --- krebs/1systems/hotdog/config.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/krebs/1systems/hotdog/config.nix b/krebs/1systems/hotdog/config.nix index 32e416831..60ec625f2 100644 --- a/krebs/1systems/hotdog/config.nix +++ b/krebs/1systems/hotdog/config.nix @@ -14,7 +14,6 @@ - ]; krebs.build.host = config.krebs.hosts.hotdog; -- cgit v1.2.3 From e754ced01e2d5ef84dabba391bba2f372694b7cb Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 8 Aug 2019 17:34:51 +0200 Subject: l phone.r: rotate secrets --- krebs/3modules/lass/default.nix | 4 ++-- krebs/3modules/lass/ssh/android.rsa | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/krebs/3modules/lass/default.nix b/krebs/3modules/lass/default.nix index 217edfdd1..a8314e11c 100644 --- a/krebs/3modules/lass/default.nix +++ b/krebs/3modules/lass/default.nix @@ -595,12 +595,12 @@ in { aliases = [ "phone.w" ]; - wireguard.pubkey = "MRicxap2VxPnzmXoOqqjQNGWJ54cQC8Tfy28+IXXsxM="; + wireguard.pubkey = "FY4PB8E/RC2JvtLgq/IDyMmZ9Ln6pz6eGyoytmUFMgk="; }; }; external = true; ci = false; - syncthing.id = "DUFMX7V-HNR6WXM-LZB5LJE-TM6QIOH-MTGHEUJ-QSD3XIY-YRFJLOR-G6Y3XQB"; + syncthing.id = "PWKVXPB-JCNO6E4-KVIQ7CK-6FSOWHM-AWORMDU-HVVYLKW-44DQTYW-XZT7DQJ"; }; morpheus = { cores = 1; diff --git a/krebs/3modules/lass/ssh/android.rsa b/krebs/3modules/lass/ssh/android.rsa index 675ba8df2..21b8e015e 100644 --- a/krebs/3modules/lass/ssh/android.rsa +++ b/krebs/3modules/lass/ssh/android.rsa @@ -1 +1 @@ -ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPF7RHU4q6w1f3xWcfeAD6u23jDs2fd/H3IuxdT5G1ZL +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEpP5YExkzwfmn7GpvnmZZRx1S+jmZyYrOf7b5cZZnbF -- cgit v1.2.3 From a1b467b849c6048e487d61c87ef8b2baacba5f3b Mon Sep 17 00:00:00 2001 From: lassulus Date: Sun, 25 Aug 2019 20:18:50 +0200 Subject: l xerxes.r: remove junk --- lass/1systems/xerxes/icarus/config.nix | 33 -------------------------------- lass/1systems/xerxes/icarus/physical.nix | 25 ------------------------ 2 files changed, 58 deletions(-) delete mode 100644 lass/1systems/xerxes/icarus/config.nix delete mode 100644 lass/1systems/xerxes/icarus/physical.nix diff --git a/lass/1systems/xerxes/icarus/config.nix b/lass/1systems/xerxes/icarus/config.nix deleted file mode 100644 index dada4949e..000000000 --- a/lass/1systems/xerxes/icarus/config.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - imports = [ - - - - - - - - # - - - - - - # - # - - - # - - ]; - - krebs.build.host = config.krebs.hosts.icarus; - - environment.systemPackages = with pkgs; [ - macchanger - nix-review - ]; - programs.adb.enable = true; -} diff --git a/lass/1systems/xerxes/icarus/physical.nix b/lass/1systems/xerxes/icarus/physical.nix deleted file mode 100644 index e9e09bc05..000000000 --- a/lass/1systems/xerxes/icarus/physical.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - imports = [ - ./config.nix - - - ]; - - fileSystems = { - "/bku" = { - device = "/dev/mapper/pool-bku"; - fsType = "btrfs"; - options = ["defaults" "noatime" "ssd" "compress=lzo"]; - }; - }; - - services.udev.extraRules = '' - SUBSYSTEM=="net", ATTR{address}=="00:24:d7:f0:a0:0c", NAME="wl0" - SUBSYSTEM=="net", ATTR{address}=="f0:de:f1:71:cb:35", NAME="et0" - ''; - - services.thinkfan.enable = true; - services.tlp.extraConfig = '' - START_CHARGE_THRESH_BAT0=80 - ''; -} -- cgit v1.2.3 From d93ed46e08d834029557379b182c9649cac175c0 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 27 Aug 2019 11:08:50 +0200 Subject: nixpkgs: 4f2b76e -> e021485 --- krebs/nixpkgs.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/krebs/nixpkgs.json b/krebs/nixpkgs.json index 72afac981..fd73bd142 100644 --- a/krebs/nixpkgs.json +++ b/krebs/nixpkgs.json @@ -1,7 +1,7 @@ { "url": "https://github.com/NixOS/nixpkgs-channels", - "rev": "4f2b76e45fcaf962137ae6a36a9cc60873be6ec2", - "date": "2019-08-02T21:36:54-04:00", - "sha256": "1c3h6a39cim2fdnwq6cp75dm46xfqc2mnsj0zgnrp412dqmaxkkc", + "rev": "e02148563af765625be323465fb7a1d22072d88c", + "date": "2019-08-26T07:58:15-04:00", + "sha256": "1fa84bf9gpd5n1lc0ifxda44hbdkg8ka720yxsg6h8plsqjjxzs8", "fetchSubmodules": false } -- cgit v1.2.3 From 247c4de76db2e367710543032276a4187d76906c Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 27 Aug 2019 16:55:20 +0200 Subject: l xerxes.r: add deploy alias --- lass/1systems/xerxes/config.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lass/1systems/xerxes/config.nix b/lass/1systems/xerxes/config.nix index c120c17d7..57871117c 100644 --- a/lass/1systems/xerxes/config.nix +++ b/lass/1systems/xerxes/config.nix @@ -22,6 +22,14 @@ krebs.build.host = config.krebs.hosts.xerxes; + environment.shellAliases = { + deploy = pkgs.writeDash "deploy" '' + set -eu + export SYSTEM="$1" + $(nix-build $HOME/sync/stockholm/lass/krops.nix --no-out-link --argstr name "$SYSTEM" -A deploy) + ''; + }; + services.xserver = { displayManager.lightdm.autoLogin.enable = true; displayManager.lightdm.autoLogin.user = "lass"; -- cgit v1.2.3 From b7daacf31efea112e2d845e5d2c49e4ded26b739 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 27 Aug 2019 16:55:49 +0200 Subject: l xerxes.r: enable screenlock again --- lass/1systems/xerxes/config.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/lass/1systems/xerxes/config.nix b/lass/1systems/xerxes/config.nix index 57871117c..b577b31b3 100644 --- a/lass/1systems/xerxes/config.nix +++ b/lass/1systems/xerxes/config.nix @@ -39,7 +39,6 @@ "xpad" ]; - lass.screenlock.enable = lib.mkForce false; krebs.syncthing = { folders = { the_playlist = { -- cgit v1.2.3 From c0e4269e6a6518b6a648d250c437b59460caa6e9 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 27 Aug 2019 16:56:19 +0200 Subject: l xerxes.r: support most of the hardware --- lass/1systems/xerxes/config.nix | 70 ++++++++++++++++++++++++++++++++++++--- lass/1systems/xerxes/physical.nix | 24 +++++++------- 2 files changed, 78 insertions(+), 16 deletions(-) diff --git a/lass/1systems/xerxes/config.nix b/lass/1systems/xerxes/config.nix index b577b31b3..2d25bc88a 100644 --- a/lass/1systems/xerxes/config.nix +++ b/lass/1systems/xerxes/config.nix @@ -35,10 +35,6 @@ displayManager.lightdm.autoLogin.user = "lass"; }; - boot.blacklistedKernelModules = [ - "xpad" - ]; - krebs.syncthing = { folders = { the_playlist = { @@ -54,4 +50,70 @@ umask = "0007"; }; }; + + boot.blacklistedKernelModules = [ "xpad" ]; + systemd.services.xboxdrv = { + wantedBy = [ "multi-user.target" ]; + script = '' + ${pkgs.xboxdrv.overrideAttrs(o: { + patches = [ (pkgs.fetchurl { + url = "https://patch-diff.githubusercontent.com/raw/xboxdrv/xboxdrv/pull/251.patch"; + sha256 = "17784y20mxqrlhgvwvszh8lprxrvgmb7ah9dknmbhj5jhkjl8wq5"; + }) ]; + })}/bin/xboxdrv --type xbox360 --dbus disabled -D + ''; + }; + + programs.adb.enable = true; + + services.logind.lidSwitch = "ignore"; + services.acpid = { + enable = true; + lidEventCommands = '' + export DISPLAY=:${toString config.services.xserver.display} + case "$1" in + "button/lid LID close") + ${pkgs.xorg.xinput}/bin/xinput disable 'pointer: Mouse for Windows' + ${pkgs.xorg.xinput}/bin/xinput disable 'keyboard: Mouse for Windows' + ${pkgs.acpilight}/bin/xbacklight -get > /tmp/pre_lid_brightness + ${pkgs.acpilight}/bin/xbacklight -set 0 + ;; + "button/lid LID open") + ${pkgs.xorg.xinput}/bin/xinput enable 'pointer: Mouse for Windows' + ${pkgs.xorg.xinput}/bin/xinput enable 'keyboard: Mouse for Windows' + ${pkgs.acpilight}/bin/xbacklight -set $(cat /tmp/pre_lid_brightness) + ;; + esac + ''; + }; + + systemd.services.suspend-again = { + after = [ "suspend.target" ]; + requiredBy = [ "suspend.target" ]; + # environment = { + # DISPLAY = ":${toString config.services.xserver.display}"; + # }; + serviceConfig = { + ExecStart = pkgs.writeDash "suspend-again" '' + ${pkgs.gnugrep}/bin/grep -q closed /proc/acpi/button/lid/LID0/state + if [ "$?" -eq 0 ]; then + echo 'wakeup with closed lid' + ${pkgs.systemd}/bin/systemctl suspend + fi + ''; + Type = "simple"; + }; + }; + + hardware.bluetooth.enable = true; + hardware.pulseaudio.package = pkgs.pulseaudioFull; + # hardware.pulseaudio.configFile = pkgs.writeText "default.pa" '' + # load-module module-bluetooth-policy + # load-module module-bluetooth-discover + # ## module fails to load with + # ## module-bluez5-device.c: Failed to get device path from module arguments + # ## module.c: Failed to load module "module-bluez5-device" (argument: ""): initialization failed. + # # load-module module-bluez5-device + # # load-module module-bluez5-discover + # ''; } diff --git a/lass/1systems/xerxes/physical.nix b/lass/1systems/xerxes/physical.nix index f88578e19..5d60dfc45 100644 --- a/lass/1systems/xerxes/physical.nix +++ b/lass/1systems/xerxes/physical.nix @@ -17,6 +17,7 @@ boot.blacklistedKernelModules = [ "goodix" ]; + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" ]; boot.initrd.kernelModules = [ ]; boot.initrd.luks.devices.crypted.device = "/dev/sda3"; @@ -27,11 +28,6 @@ "boot.shell_on_fail" ]; - services.xserver.displayManager.sessionCommands = '' - (sleep 2 && ${pkgs.xorg.xrandr}/bin/xrandr --output eDP-1 --rotate right) - (sleep 2 && ${pkgs.xorg.xinput}/bin/xinput set-prop 'Goodix Capacitive TouchScreen' 'Coordinate Transformation Matrix' 0 1 0 -1 0 1 0 0 1) - ''; - fileSystems."/" = { device = "rpool/root"; fsType = "zfs"; @@ -76,11 +72,15 @@ IdleActionSec=300 ''; - services.xserver.extraConfig = '' - Section "Device" - Identifier "Intel Graphics" - Driver "Intel" - Option "TearFree" "true" - EndSection - ''; + services.xserver = { + videoDrivers = [ "intel" ]; + deviceSection = '' + Option "TearFree" "true" + ''; + displayManager.sessionCommands = '' + echo nonono > /tmp/xxyy + (sleep 2 && ${pkgs.xorg.xrandr}/bin/xrandr --output eDP1 --rotate right) + (sleep 2 && ${pkgs.xorg.xinput}/bin/xinput set-prop 'Goodix Capacitive TouchScreen' 'Coordinate Transformation Matrix' 0 1 0 -1 0 1 0 0 1) + ''; + }; } -- cgit v1.2.3 From 3072db3795166d62961a4d2f73a54a03de5ff955 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 28 Aug 2019 23:02:53 +0200 Subject: l: add autowifi service --- lass/3modules/autowifi.nix | 111 +++++++++++++++++++++++++++++++++++++++++++++ lass/3modules/default.nix | 1 + 2 files changed, 112 insertions(+) create mode 100644 lass/3modules/autowifi.nix diff --git a/lass/3modules/autowifi.nix b/lass/3modules/autowifi.nix new file mode 100644 index 000000000..930d99727 --- /dev/null +++ b/lass/3modules/autowifi.nix @@ -0,0 +1,111 @@ +{ config, lib, pkgs, ... }: +with import ; +let + + cfg = config.lass.autowifi; + +in { + options.lass.autowifi = { + enable = mkEnableOption "automatic wifi connector"; + knownWifisFile = mkOption { + type = types.str; + default = "/etc/wifis"; + }; + }; + + config = { + systemd.services.autowifi = { + description = "Automatic wifi connector"; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Type = "simple"; + Restart = "always"; + RestartSec = "10s"; + ExecStart = pkgs.writers.writePython3 "autowifi" {} /* python3 */ '' + import subprocess + import time + import urllib.request + + + def connect(ssid, psk=None): + subprocess.run(["${pkgs.networkmanager}/bin/nmcli", "connection", "delete", "autowifi"]) + print("connecting to {}".format(ssid)) + if psk is None: + subprocess.run(["${pkgs.networkmanager}/bin/nmcli", "device", "wifi", "connect", ssid, "name", "autowifi"]) + else: + subprocess.run(["${pkgs.networkmanager}/bin/nmcli", "device", "wifi", "connect", ssid, "name", "autowifi", "password", psk]) + + + def scan(): + wifis_raw = subprocess.check_output(["${pkgs.networkmanager}/bin/nmcli", "-t", "device", "wifi", "list", "--rescan", "yes"]) + wifis_list = wifis_raw.split(b'\n') + wifis = [] + for line in wifis_list: + ls = line.split(b':') + if len(ls) == 8: + wifis.append({"ssid": ls[1], "signal": int(ls[5]), "crypto": ls[7]}) + return wifis + + + def get_known_wifis(): + wifis_lines = [] + with open('${cfg.knownWifisFile}') as f: + wifis_lines = f.read().splitlines() + wifis = [] + for line in wifis_lines: + ls = line.split(':') + wifis.append({"ssid": ls[0].encode(), "psk": ls[1].encode()}) + return wifis + + + def check_internet(): + try: + beacon = urllib.request.urlopen('http://krebsco.de/secret') + except: # noqa + print("no internet") + return False + if beacon.read() == b'1337\n': + return True + print("no internet") + return False + + + def is_wifi_open(wifi): + if wifi['crypto'] == ${"b''"}: + return True + else: + return False + + + def is_wifi_seen(wifi, seen_wifis): + for seen_wifi in seen_wifis: + if seen_wifi["ssid"] == wifi["ssid"]: + return True + return False + + + def bloop(): + while True: + if not check_internet(): + wifis = scan() + known_wifis = get_known_wifis() + known_seen_wifis = [wifi for wifi in known_wifis if is_wifi_seen(wifi, wifis)] + for wifi in known_seen_wifis: + connect(wifi['ssid'], wifi['psk']) + if check_internet(): + continue + open_wifis = filter(is_wifi_open, wifis) + for wifi in open_wifis: + connect(wifi['ssid']) + if check_internet(): + continue + time.sleep(10) + + + bloop() + ''; + }; + }; + }; +} + diff --git a/lass/3modules/default.nix b/lass/3modules/default.nix index 613c7c8ac..1195cd3d4 100644 --- a/lass/3modules/default.nix +++ b/lass/3modules/default.nix @@ -14,5 +14,6 @@ _: ./umts.nix ./usershadow.nix ./xjail.nix + ./autowifi.nix ]; } -- cgit v1.2.3 From 8d4adbf38ce7bffc8b1532c26c0b33dcb480c87d Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 4 Sep 2019 00:13:26 +0200 Subject: external: add crustacea.r (0x4A6F) --- krebs/1systems/wolf/config.nix | 2 +- krebs/3modules/external/default.nix | 32 ++++++++++++++++++++++++++++++-- krebs/3modules/external/ssh/0x4A6F.pub | 1 + krebs/3modules/external/ssh/0x4a6f.pub | 1 - 4 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 krebs/3modules/external/ssh/0x4A6F.pub delete mode 100644 krebs/3modules/external/ssh/0x4a6f.pub diff --git a/krebs/1systems/wolf/config.nix b/krebs/1systems/wolf/config.nix index 3cb358ca3..9ae65466c 100644 --- a/krebs/1systems/wolf/config.nix +++ b/krebs/1systems/wolf/config.nix @@ -139,7 +139,7 @@ in ''; users.extraUsers.root.openssh.authorizedKeys.keys = [ - config.krebs.users."0x4a6f".pubkey + config.krebs.users."0x4A6F".pubkey config.krebs.users.ulrich.pubkey config.krebs.users.raute.pubkey config.krebs.users.makefu-omo.pubkey diff --git a/krebs/3modules/external/default.nix b/krebs/3modules/external/default.nix index 66f9620c7..640adfc06 100644 --- a/krebs/3modules/external/default.nix +++ b/krebs/3modules/external/default.nix @@ -588,6 +588,34 @@ in { }; }; }; + crustacea = { + owner = config.krebs.users."0x4A6F"; + nets = { + retiolum = { + ip4.addr = "10.243.42.63"; + ip6.addr = "42:4a6f::4263"; + aliases = [ + "crustacea.r" + ]; + tinc.pubkey = '' + -----BEGIN RSA PUBLIC KEY----- + MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAuuQlpyE4+8NSwMLs4A7c + /sTNlZ6sIdlEQmyNwLZBPEW3GhwLKXdnKzF7lb2vaUXtTDfw+Ijo4c7zlXh0QKGq + VbAoEV7Sau0OEjbrPHzaZvhZoKEIYR0Tz/OBm0cOM0vwyPcbXo//uDVGi7ZkAKZU + 0OLkcagJcpJ6gep7OKSC6FRDtvUGKRQFfSOy3MhB05P7WwTREbf2J/YZwBFoSWGK + /ldrqdN9+olQ6TvMaOw4U5c6D0zCALPL9iOK6ADBub22E4SQOIzeUIg0KePoit/F + sNl10NCLMRjvM9JMzr61krJfeVZ1oRo63zU3dKQYuQ/7x+MYl/yIyZ9d7bkX21zZ + +2SloxbgGmeChd/20u0scsMUljtDdyQS9vU0xeyur8jpmrg26RSeWzvieJKXLJBD + EdRJ5kXQHhl1EGKdl5zG6bXBMb9ruU1xoUMy14+wDLSoUkCWdQFFv+nVrEtkoOaX + 7QWggGc12EEtFhvzM5E8iqcLAWe3j8za114IXTwGJETWWmKoh4QLBA77OZpGD3MK + JGkK4HcH0ZBmO4Cx5G27C/6+vqNMVWd8WUn3OD9qYLF+gsFMTAdRUabIrac8D8ft + qKxiBCNDJXOUiXP3Ge7tu4XJxvOPsWkUdmnKosIX2grsmbrVvtDcfVM8lXrqRzP/ + +TlkcsPVjEDtz/7i9NsXij8CAwEAAQ== + -----END RSA PUBLIC KEY----- + ''; + }; + }; + }; unnamed = { owner = config.krebs.users.pie_; nets = { @@ -678,9 +706,9 @@ in { mail = "shackspace.de@myvdr.de"; pubkey = ssh-for "ulrich"; }; - "0x4a6f" = { + "0x4A6F" = { mail = "0x4a6f@shackspace.de"; - pubkey = ssh-for "0x4a6f"; + pubkey = ssh-for "0x4A6F"; }; miaoski = { }; diff --git a/krebs/3modules/external/ssh/0x4A6F.pub b/krebs/3modules/external/ssh/0x4A6F.pub new file mode 100644 index 000000000..1ea084bad --- /dev/null +++ b/krebs/3modules/external/ssh/0x4A6F.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKMoQSUz0wcV8tnTKsYO3sO6XG6EHap8R63ihfMHkxPS diff --git a/krebs/3modules/external/ssh/0x4a6f.pub b/krebs/3modules/external/ssh/0x4a6f.pub deleted file mode 100644 index 1ea084bad..000000000 --- a/krebs/3modules/external/ssh/0x4a6f.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKMoQSUz0wcV8tnTKsYO3sO6XG6EHap8R63ihfMHkxPS -- cgit v1.2.3 From 5d24345ff430df38263c113041070a900c23131e Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 4 Sep 2019 13:35:33 +0200 Subject: external crustacea.r: use another key + ed25519 --- krebs/3modules/external/default.nix | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/krebs/3modules/external/default.nix b/krebs/3modules/external/default.nix index 640adfc06..aac67f2e3 100644 --- a/krebs/3modules/external/default.nix +++ b/krebs/3modules/external/default.nix @@ -599,19 +599,19 @@ in { ]; tinc.pubkey = '' -----BEGIN RSA PUBLIC KEY----- - MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAuuQlpyE4+8NSwMLs4A7c - /sTNlZ6sIdlEQmyNwLZBPEW3GhwLKXdnKzF7lb2vaUXtTDfw+Ijo4c7zlXh0QKGq - VbAoEV7Sau0OEjbrPHzaZvhZoKEIYR0Tz/OBm0cOM0vwyPcbXo//uDVGi7ZkAKZU - 0OLkcagJcpJ6gep7OKSC6FRDtvUGKRQFfSOy3MhB05P7WwTREbf2J/YZwBFoSWGK - /ldrqdN9+olQ6TvMaOw4U5c6D0zCALPL9iOK6ADBub22E4SQOIzeUIg0KePoit/F - sNl10NCLMRjvM9JMzr61krJfeVZ1oRo63zU3dKQYuQ/7x+MYl/yIyZ9d7bkX21zZ - +2SloxbgGmeChd/20u0scsMUljtDdyQS9vU0xeyur8jpmrg26RSeWzvieJKXLJBD - EdRJ5kXQHhl1EGKdl5zG6bXBMb9ruU1xoUMy14+wDLSoUkCWdQFFv+nVrEtkoOaX - 7QWggGc12EEtFhvzM5E8iqcLAWe3j8za114IXTwGJETWWmKoh4QLBA77OZpGD3MK - JGkK4HcH0ZBmO4Cx5G27C/6+vqNMVWd8WUn3OD9qYLF+gsFMTAdRUabIrac8D8ft - qKxiBCNDJXOUiXP3Ge7tu4XJxvOPsWkUdmnKosIX2grsmbrVvtDcfVM8lXrqRzP/ - +TlkcsPVjEDtz/7i9NsXij8CAwEAAQ== + MIICCgKCAgEA1dA67Uq6IcWTWVVcg5kO4OUcmYY/mUzERK6WwrU7m+Qq2ovA2Fh1 + VTxfNzJg8zgyrBbUwpaLE4LuRgyrYbPABwgNMXS6wnHdunbm0x5RUcih/IRNobV1 + uf2Q/rVcrXHZD5+YL09hTZnU7PVkZm6WX0fc79rEKYIEopPpomCs2mECPSmqZPaW + L9wprtRTuQ3V0xxrCuUKX7SxANEursM8SvNfKydWdaUxjIV2iGVKuVUkAZHwx5jJ + roKEriWsIJ6FHTMb1v5yWXrvngMgYlKrpF6/m/AHEkQoPsEJ+oBkn0fop9pfyZjM + WzMhZHcKFYebSI4HqFRuQOc1scIzUdpC/sZYLYlddbwpJHj4xdJwIUN03Uga/KRQ + n1SrJnhmXonHvJZFBYcNDR6aTtdN7mJVBv8bQ7DGt1q6Gp8QItQqvpdzq314+Pw6 + 0EVKPaqdz6Cqpwn8RtJ9ZGb6BE3yUrpJkU25DyCSO86LmeCchApwssghWvPsbBDg + iF4QCyrWJ2HFnl7jJDGbEajHaE/xko2dt1F5frTWxsmDHRKSRhaGDwp5qgFUpCa0 + 2h+zZqkG4boV6CrMEjStb15EOXTUVfq0DPojFik6agCltslsJAwp+f1fb7NSee4d + TNWb1CHfIQWLPnm1LFwphSqyHY/9ehcsX3PJ7oXI+/BnV8ivvoApWA0CAwEAAQ== -----END RSA PUBLIC KEY----- + Ed25519PublicKey = DWfh6H8Qco+GURdVRhKhLBAsN5epsEYhOM2+88dTdTE ''; }; }; -- cgit v1.2.3 [cgit] Unable to lock slot /tmp/cgit/c4100000.lock: No such file or directory (2)