From e51aa863c5c7b6403b2b8dcbe064697476f200ea Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 8 Oct 2018 20:31:31 +0200 Subject: ma printer: use upstream zj-58 --- makefu/2configs/printer.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'makefu/2configs') diff --git a/makefu/2configs/printer.nix b/makefu/2configs/printer.nix index d5fa65ef9..fb1a67358 100644 --- a/makefu/2configs/printer.nix +++ b/makefu/2configs/printer.nix @@ -5,11 +5,11 @@ let in { services.printing = { enable = true; - drivers = [ - pkgs.samsungUnifiedLinuxDriver - pkgs.cups-dymo # dymo labelwriter - pkgs.foo2zjs # magicolor 1690mf - pkgs.zj-58 + drivers = with pkgs; [ + samsungUnifiedLinuxDriver + cups-dymo # dymo labelwriter + foo2zjs # magicolor 1690mf + cups-zj-58 ]; }; -- cgit v1.2.3 From 77bf84d5ffdab0f930c125ae8daaa15e25e4c879 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 8 Oct 2018 23:39:41 +0200 Subject: ma pkgs.inkscape: share/extensions solves the issue see ee44a46c858b5a80c1888ab5d38aef43a9577783 in https://gitlab.com/inkscape/extensions --- makefu/2configs/rtorrent.nix | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 makefu/2configs/rtorrent.nix (limited to 'makefu/2configs') diff --git a/makefu/2configs/rtorrent.nix b/makefu/2configs/rtorrent.nix deleted file mode 100644 index 9e2990cab..000000000 --- a/makefu/2configs/rtorrent.nix +++ /dev/null @@ -1,19 +0,0 @@ -_: -let - listenPort = 60123; - xml-port = 5000; - authfile = ; -in { - makefu.rtorrent = { - enable = true; - web = { - enable = true; - enableAuth = true; - inherit authfile; - }; - rutorrent.enable = true; - enableXMLRPC = true; - logLevel = "debug"; - inherit listenPort; - }; -} -- cgit v1.2.3 From 9b638b239aa37038b0223840cdf4e5885d1565ea Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 10 Oct 2018 00:08:16 +0200 Subject: ma pkgs.esniper: replaced by upstream --- .../deployment/events-publisher/default.nix | 49 ---------------------- makefu/2configs/shack/events-publisher/default.nix | 49 ++++++++++++++++++++++ 2 files changed, 49 insertions(+), 49 deletions(-) delete mode 100644 makefu/2configs/deployment/events-publisher/default.nix create mode 100644 makefu/2configs/shack/events-publisher/default.nix (limited to 'makefu/2configs') diff --git a/makefu/2configs/deployment/events-publisher/default.nix b/makefu/2configs/deployment/events-publisher/default.nix deleted file mode 100644 index 37d74c282..000000000 --- a/makefu/2configs/deployment/events-publisher/default.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ pkgs, ... }: -with import ; -let - shack-announce = pkgs.callPackage (builtins.fetchTarball { - url = "https://github.com/makefu/events-publisher/archive/c5218195e6afdc646cb7682d8f355a7ec2b90716.tar.gz"; - sha256 = "0xk74q7gah3l5zy3bkvih3k9fr1hclvf71rm3ixcmslhicl7khav"; - }) {} ; - home = "/var/lib/shackannounce"; - user = "shackannounce"; - creds = (toString ) + "/shack-announce.json"; - LOL = "DEBUG"; -in -{ - users.users.${user}= { - uid = genid user; - inherit home; - createHome = true; - }; - systemd.services.shack-announce = { - description = "Announce shack events"; - startAt = "*:0/30"; - path = [ shack-announce ]; - serviceConfig = { - WorkingDirectory = home; - User = user; - PermissionsStartOnly = true; - ExecStartPre = pkgs.writeDash "shack-announce-pre" '' - set -eu - cp ${creds} creds.json - chown ${user} creds.json - ''; - ExecStart = pkgs.writeDash "shack-announce" '' - if test ! -e announce.state; then - echo "initializing state" - announce-daemon \ - --lol ${LOL} \ - --creds creds.json \ - --state announce.state \ - --clean --init - fi - echo "Running announce" - announce-daemon \ - --lol ${LOL} \ - --creds creds.json \ - --state announce.state - ''; - }; - }; -} diff --git a/makefu/2configs/shack/events-publisher/default.nix b/makefu/2configs/shack/events-publisher/default.nix new file mode 100644 index 000000000..37d74c282 --- /dev/null +++ b/makefu/2configs/shack/events-publisher/default.nix @@ -0,0 +1,49 @@ +{ pkgs, ... }: +with import ; +let + shack-announce = pkgs.callPackage (builtins.fetchTarball { + url = "https://github.com/makefu/events-publisher/archive/c5218195e6afdc646cb7682d8f355a7ec2b90716.tar.gz"; + sha256 = "0xk74q7gah3l5zy3bkvih3k9fr1hclvf71rm3ixcmslhicl7khav"; + }) {} ; + home = "/var/lib/shackannounce"; + user = "shackannounce"; + creds = (toString ) + "/shack-announce.json"; + LOL = "DEBUG"; +in +{ + users.users.${user}= { + uid = genid user; + inherit home; + createHome = true; + }; + systemd.services.shack-announce = { + description = "Announce shack events"; + startAt = "*:0/30"; + path = [ shack-announce ]; + serviceConfig = { + WorkingDirectory = home; + User = user; + PermissionsStartOnly = true; + ExecStartPre = pkgs.writeDash "shack-announce-pre" '' + set -eu + cp ${creds} creds.json + chown ${user} creds.json + ''; + ExecStart = pkgs.writeDash "shack-announce" '' + if test ! -e announce.state; then + echo "initializing state" + announce-daemon \ + --lol ${LOL} \ + --creds creds.json \ + --state announce.state \ + --clean --init + fi + echo "Running announce" + announce-daemon \ + --lol ${LOL} \ + --creds creds.json \ + --state announce.state + ''; + }; + }; +} -- cgit v1.2.3 From f97f63deab36b7ff774c4f132c1a87daecc8e9f5 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 10 Oct 2018 14:08:18 +0200 Subject: ma events-publisher: bump version --- makefu/2configs/shack/events-publisher/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'makefu/2configs') diff --git a/makefu/2configs/shack/events-publisher/default.nix b/makefu/2configs/shack/events-publisher/default.nix index 37d74c282..93a965e95 100644 --- a/makefu/2configs/shack/events-publisher/default.nix +++ b/makefu/2configs/shack/events-publisher/default.nix @@ -2,8 +2,8 @@ with import ; let shack-announce = pkgs.callPackage (builtins.fetchTarball { - url = "https://github.com/makefu/events-publisher/archive/c5218195e6afdc646cb7682d8f355a7ec2b90716.tar.gz"; - sha256 = "0xk74q7gah3l5zy3bkvih3k9fr1hclvf71rm3ixcmslhicl7khav"; + url = "https://github.com/makefu/events-publisher/archive/1e98edfabfe5574586b4eb8d30d315ae2afb1f9f.tar.gz"; + sha256 = "013ca4dkkzc7q49cwad6fxpxv01hd8va02025pazlz5q223nk70z"; }) {} ; home = "/var/lib/shackannounce"; user = "shackannounce"; -- cgit v1.2.3 From 0cfc9b54a0d588dadef3642aa6b3872f0392a220 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 14 Oct 2018 23:47:18 +0200 Subject: ma airdcpp: enable state tracking --- makefu/2configs/dcpp/airdcpp.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'makefu/2configs') diff --git a/makefu/2configs/dcpp/airdcpp.nix b/makefu/2configs/dcpp/airdcpp.nix index fe05effd9..ad62babc3 100644 --- a/makefu/2configs/dcpp/airdcpp.nix +++ b/makefu/2configs/dcpp/airdcpp.nix @@ -44,5 +44,6 @@ ''; }; - + state = map (f: "${config.krebs.airdcpp.stateDir}/${f}") + [ "Favorites.xml" "DCPlusPlus.xml" "WebServer.xml" "Recents.xml" "IgnoredUsers.xml" ]; } -- cgit v1.2.3 From efc70c213c464d0a4eecd80e1acf886c8deb787a Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 17 Oct 2018 00:34:46 +0200 Subject: ma homeautomation: cleanup, add flurlicht --- makefu/2configs/deployment/bureautomation/home.nix | 67 ----------- .../2configs/deployment/homeautomation/default.nix | 127 +++++++++++++++++---- 2 files changed, 102 insertions(+), 92 deletions(-) delete mode 100644 makefu/2configs/deployment/bureautomation/home.nix (limited to 'makefu/2configs') diff --git a/makefu/2configs/deployment/bureautomation/home.nix b/makefu/2configs/deployment/bureautomation/home.nix deleted file mode 100644 index 28edb6af2..000000000 --- a/makefu/2configs/deployment/bureautomation/home.nix +++ /dev/null @@ -1,67 +0,0 @@ -{ pkgs, lib, ... }: -let - firetv = "192.168.1.238"; -in { - systemd.services.firetv = { - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - User = "nobody"; - ExecStart = "${pkgs.python-firetv}/bin/firetv-server -d ${firetv}:5555"; - }; - }; - services.home-assistant = { - #panel_iframe: - #configurator: - # title: Configurator - # icon: mdi:wrench - # url: http://hassio.local:3218 - # sensor: - # - platform: random - enable = true; - config = { - homeassistant = { - name = "Bureautomation"; - time_zone = "Europe/Berlin"; - }; - panel_iframe = { - euer_blog = { - title = "Euer Blog"; - icon = "mdi:wrench"; - url = "https://euer.krebsco.de"; - }; - }; - media_player = [ - { platform = "kodi"; - host = firetv; - } - { platform = "firetv"; - # assumes python-firetv running - } - ]; - sensor = [ - { - platform = "luftdaten"; - name = "Shack 1"; - sensorid = "50"; - monitored_conditions = [ "P1" "P2" ]; - } - { - platform = "luftdaten"; - name = "Shack 2"; - sensorid = "658"; - monitored_conditions = [ "P1" "P2" ]; - } - { - platform = "luftdaten"; - name = "Ditzingen"; - sensorid = "5341"; - monitored_conditions = [ "P1" "P2" ]; - } - { platform = "random"; } - ]; - frontend = { }; - http = { }; - feedreader.urls = [ "https://nixos.org/blogs.xml" ]; - }; - }; -} diff --git a/makefu/2configs/deployment/homeautomation/default.nix b/makefu/2configs/deployment/homeautomation/default.nix index f2a3b36e2..5da0dba2e 100644 --- a/makefu/2configs/deployment/homeautomation/default.nix +++ b/makefu/2configs/deployment/homeautomation/default.nix @@ -1,9 +1,60 @@ -{ pkgs, config, ... }: +{ pkgs, lib, config, ... }: # Ideas: ## wake-on-lan server ## let + tasmota_rgb = name: topic: +# LED WS2812b +# effect_state_topic: "stat/led/Scheme" +# effect_command_topic: "cmnd/led/Scheme" +# effect_value_template: "{{ value_json.Scheme }}" + { platform = "mqtt"; + inherit name; + retain = false; + qos = 1; + optimistic = false; + # state + # TODO: currently broken, will not use the custom state topic + #state_topic = "/ham/${topic}/stat/POWER"; + state_topic = "stat/${topic}/POWER"; + command_topic = "/ham/${topic}/cmnd/POWER"; + availability_topic = "/ham/${topic}/tele/LWT"; + payload_on= "ON"; + payload_off= "OFF"; + payload_available= "Online"; + payload_not_available= "Offline"; + # brightness + brightness_state_topic = "/ham/${topic}/stat/Dimmer"; + brightness_command_topic = "/ham/${topic}/cmnd/Dimmer"; + brightness_value_template = "{{ value_json.Dimmer }}"; + brightness_scale = 100; + # color + rgb_state_topic = "/ham/${topic}/stat/Color"; + rgb_command_topic = "/ham/${topic}/cmnd/Color2"; + rgb_command_mode = "hex"; + rgb_command_template = "{{ '%02x%02x%02x' | format(red, green, blue)}}"; + # effects + effect_state_topic = "/ham/${topic}/stat/Scheme"; + effect_command_topic = "/ham/${topic}/cmnd/Scheme"; + effect_value_template = "{{ value_json.Scheme }}"; + effect_list = [ 0 1 2 3 4 5 6 7 8 9 10 11 12 ]; +}; + # switchmode 1 - also toggle power + # switchtopic flurlicht + tasmota_motion = name: topic: + { platform = "mqtt"; + device_class = "motion"; + inherit name; + # TODO: currently broken, will not use the custom state topic + state_topic = "stat/${topic}/POWER"; + payload_on = "ON"; + payload_off = "OFF"; + availability_topic = "/ham/${topic}/tele/LWT"; + payload_available = "Online"; + payload_not_available = "Offline"; + }; + firetv = "192.168.1.238"; tasmota_plug = name: topic: { platform = "mqtt"; @@ -40,16 +91,13 @@ in { imports = [ ./mqtt.nix ]; - systemd.services.firetv = { - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - User = "nobody"; - ExecStart = "${pkgs.python-firetv}/bin/firetv-server -d ${firetv}:5555"; - }; - }; - nixpkgs.config.permittedInsecurePackages = [ - "homeassistant-0.65.5" - ]; + #systemd.services.firetv = { + # wantedBy = [ "multi-user.target" ]; + # serviceConfig = { + # User = "nobody"; + # ExecStart = "${pkgs.python-firetv}/bin/firetv-server -d ${firetv}:5555"; + # }; + #}; services.home-assistant = { config = { homeassistant = { @@ -58,7 +106,7 @@ in { longitude = "9.2478"; elevation = 247; }; - discovery = {}; + #discovery = {}; conversation = {}; history = {}; logbook = {}; @@ -71,16 +119,16 @@ in { { platform = "kodi"; host = firetv; } - { platform = "firetv"; - # assumes python-firetv running - } + #{ platform = "firetv"; + # # assumes python-firetv running + #} ]; mqtt = { broker = "localhost"; port = 1883; client_id = "home-assistant"; username = "hass"; - password = builtins.readFile ; + password = lib.removeSuffix "\n" (builtins.readFile ); keepalive = 60; protocol = 3.1; birth_message = { @@ -96,10 +144,14 @@ in { retain = true; }; }; + binary_sensor = [ + (tasmota_motion "Flur Bewegung" "flurlicht") + ]; sensor = [ - { platform = "speedtest"; - monitored_conditions = [ "ping" "download" "upload" ]; - } + # broken + #{ platform = "speedtest"; + # monitored_conditions = [ "ping" "download" "upload" ]; + #} { platform = "luftdaten"; name = "Ditzingen"; sensorid = "663"; @@ -107,7 +159,8 @@ in { } # https://www.home-assistant.io/cookbook/automation_for_rainy_days/ { platform = "darksky"; - api_key = "c73619e6ea79e553a585be06aacf3679"; + api_key = lib.removeSuffix "\n" + (builtins.readFile ); language = "de"; monitored_conditions = [ "summary" "icon" "nearest_storm_distance" "precip_probability" @@ -125,15 +178,39 @@ in { } ] ++ (tasmota_bme "Schlafzimmer" "schlafzimmer"); frontend = { }; - #group = [ - # { default_view = { view = "yes"; entities = [ - # "sensor.luftdaten" - # ]} - #]; + group = + { default_view = + { view = "yes"; + entities = [ + "group.flur" + "group.schlafzimmer" + "group.draussen" + "group.wohnzimmer" + ]; + }; + flur = [ + "light.flurlicht" + "binary_sensor.flur_bewegung" + ]; + wohnzimmer = [ + "media_player.kodi" + ]; + draussen = [ + "sensor.dark_sky_temperature" + "sensor.dark_sky_hourly_summary" + ]; + schlafzimmer = [ + "sensor.schlafzimmer_temperatur" + "sensor.schlafzimmer_luftdruck" + "sensor.schlafzimmer_luftfeuchtigkeit" + "switch.lichterkette_schlafzimmer" + ]; + }; http = { }; switch = [ (tasmota_plug "Lichterkette Schlafzimmer" "schlafzimmer") ]; + light = [ (tasmota_rgb "Flurlicht" "flurlicht" ) ]; }; enable = true; #configDir = "/var/lib/hass"; -- cgit v1.2.3 From 72a009b6a5593ca6885ca83517dfd99cefe2d3cb Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 21 Oct 2018 00:16:12 +0200 Subject: ma shack/events-publisher: bump to latest version --- makefu/2configs/shack/events-publisher/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'makefu/2configs') diff --git a/makefu/2configs/shack/events-publisher/default.nix b/makefu/2configs/shack/events-publisher/default.nix index 93a965e95..531d2525e 100644 --- a/makefu/2configs/shack/events-publisher/default.nix +++ b/makefu/2configs/shack/events-publisher/default.nix @@ -2,8 +2,8 @@ with import ; let shack-announce = pkgs.callPackage (builtins.fetchTarball { - url = "https://github.com/makefu/events-publisher/archive/1e98edfabfe5574586b4eb8d30d315ae2afb1f9f.tar.gz"; - sha256 = "013ca4dkkzc7q49cwad6fxpxv01hd8va02025pazlz5q223nk70z"; + url = "https://github.com/makefu/events-publisher/archive/670f4d7182a41b6763296e301612499d2986f213.tar.gz"; + sha256 = "1yf9cb08v4rc6x992yx5lcyn62sm3p8i2b48rsmr4m66xdi4bpnd"; }) {} ; home = "/var/lib/shackannounce"; user = "shackannounce"; -- cgit v1.2.3 From cea8403dc5eb48792c9ccd4c4fc9584a84ba4238 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 21 Oct 2018 00:18:59 +0200 Subject: ma shack/gitlab-ci: maintain own config --- makefu/2configs/shack/gitlab-runner/default.nix | 31 +++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 makefu/2configs/shack/gitlab-runner/default.nix (limited to 'makefu/2configs') diff --git a/makefu/2configs/shack/gitlab-runner/default.nix b/makefu/2configs/shack/gitlab-runner/default.nix new file mode 100644 index 000000000..55dc50fa8 --- /dev/null +++ b/makefu/2configs/shack/gitlab-runner/default.nix @@ -0,0 +1,31 @@ + +{ + systemd.services.gitlab-runner.path = [ + "/run/wrappers" # /run/wrappers/bin/su + "/" # /bin/sh + ]; + services.gitlab-runner = { + enable = true; + configOptions = + { concurrent = 1; + runners = [ + { builds_dir = ""; + #docker = + #{ cache_dir = ""; + # disable_cache = true; + # host = ""; image = "nixos/nix:2.1.3"; + # privileged = true; + #}; + #executor = "docker"; + # name = "docker-nix"; + name = "gum-shell"; + executor = "shell"; + environment = [ "PATH=/bin:/run/wrappers/bin:/etc/per-user/gitlab-runner/bin:/etc/per-user-pkgs/gitlab-runner/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin" ]; + # generate via `gitlab-runner register` + token = import ; + url = "https://git.shackspace.de/"; + } + ]; + }; + }; +} -- cgit v1.2.3 From 489d3924307171751b174d62f64ce29a5c2550cf Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 21 Oct 2018 23:04:27 +0200 Subject: ma backup: init --- makefu/2configs/backup/server.nix | 11 +++++++++++ makefu/2configs/backup/ssh/gum.pub | 1 + makefu/2configs/backup/ssh/nextgum.pub | 1 + makefu/2configs/backup/ssh/omo.pub | 1 + makefu/2configs/backup/ssh/x.pub | 1 + makefu/2configs/backup/state.nix | 25 +++++++++++++++++++++++++ 6 files changed, 40 insertions(+) create mode 100644 makefu/2configs/backup/server.nix create mode 100644 makefu/2configs/backup/ssh/gum.pub create mode 100644 makefu/2configs/backup/ssh/nextgum.pub create mode 100644 makefu/2configs/backup/ssh/omo.pub create mode 100644 makefu/2configs/backup/ssh/x.pub create mode 100644 makefu/2configs/backup/state.nix (limited to 'makefu/2configs') diff --git a/makefu/2configs/backup/server.nix b/makefu/2configs/backup/server.nix new file mode 100644 index 000000000..f157e715f --- /dev/null +++ b/makefu/2configs/backup/server.nix @@ -0,0 +1,11 @@ +{lib, ... }: +let + hosts = lib.mapAttrsToList (f: _: lib.removeSuffix ".pub" f) (builtins.readDir ./ssh ); +in { + # TODO: for all enabled machines + services.borgbackup.repos = lib.genAttrs hosts (host: { + authorizedKeys = [ (builtins.readFile (./ssh + "/${host}.pub") ) ]; + path = "/var/lib/borgbackup/${host}"; + user = "borg-${host}"; + }) ; +} diff --git a/makefu/2configs/backup/ssh/gum.pub b/makefu/2configs/backup/ssh/gum.pub new file mode 100644 index 000000000..ed203d544 --- /dev/null +++ b/makefu/2configs/backup/ssh/gum.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOSCJe7DQkKbL58pL78ImO+nVI/aaNFP8Zyqgo8EbNhW makefu@x diff --git a/makefu/2configs/backup/ssh/nextgum.pub b/makefu/2configs/backup/ssh/nextgum.pub new file mode 100644 index 000000000..52d56d956 --- /dev/null +++ b/makefu/2configs/backup/ssh/nextgum.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOUZcfi2SXxCo1if0oU3x9qPK8/O5FmiXy2HFZyTp/P1 makefu@x diff --git a/makefu/2configs/backup/ssh/omo.pub b/makefu/2configs/backup/ssh/omo.pub new file mode 100644 index 000000000..053b4da87 --- /dev/null +++ b/makefu/2configs/backup/ssh/omo.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAtA3XzpjByYQ9uSHQr0dkNUyi6nROjwv1S2IQtUu4pi makefu@x diff --git a/makefu/2configs/backup/ssh/x.pub b/makefu/2configs/backup/ssh/x.pub new file mode 100644 index 000000000..fe894df33 --- /dev/null +++ b/makefu/2configs/backup/ssh/x.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBRfhUv9twYbO7tUe2r2LOXEMNxW14GO3Q0RTkUWeMxw makefu@x diff --git a/makefu/2configs/backup/state.nix b/makefu/2configs/backup/state.nix new file mode 100644 index 000000000..1143708bf --- /dev/null +++ b/makefu/2configs/backup/state.nix @@ -0,0 +1,25 @@ +{ config, ... }: +# back up all state +let + sec = toString ; + sshkey = sec + "/borg.priv"; + phrase = sec + "/borg.pw"; +in +{ + services.borgbackup.jobs.state = { + repo = "borg-${config.krebs.build.host.name}@backup.makefu.r:."; + paths = config.state; + encryption = { + mode = "repokey"; + passCommand = "cat ${phrase}"; + }; + environment.BORG_RSH = "ssh -i ${sshkey}"; + prune.keep = + { daily = 7; + weekly = 4; + monthly = -1; # Keep at least one archive for each month + }; + compression = "auto,lzma"; + startAt = "daily"; + }; +} -- cgit v1.2.3 From 23d99c1ae27744d00b25e0615797c357642c4112 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 21 Oct 2018 23:05:21 +0200 Subject: ma backup: streamline, RIP old rsync --- makefu/2configs/backup.nix | 52 --------------------------------------- makefu/2configs/laptop-backup.nix | 12 --------- 2 files changed, 64 deletions(-) delete mode 100644 makefu/2configs/backup.nix delete mode 100644 makefu/2configs/laptop-backup.nix (limited to 'makefu/2configs') diff --git a/makefu/2configs/backup.nix b/makefu/2configs/backup.nix deleted file mode 100644 index a4d02af6b..000000000 --- a/makefu/2configs/backup.nix +++ /dev/null @@ -1,52 +0,0 @@ -{ config, lib, pkgs, ... }: -with import ; -let - # preparation: - # mkdir -p defaultBackupDir/host.name/src - # as root on omo: - # ssh-copy-id root@src - startAt = "0,6,12,18:00"; - defaultBackupServer = config.krebs.hosts.omo; - defaultBackupDir = "/home/backup"; - defaultPull = host: src: { - method = "pull"; - src = { - inherit host; - path = src; - }; - dst = { - host = defaultBackupServer; - path = "${defaultBackupDir}/${host.name}${src}"; - }; - startAt = "0,6,12,18:00"; - snapshots = { - hourly = { format = "%Y-%m-%dT%H"; retain = 4; }; - daily = { format = "%Y-%m-%d"; retain = 7; }; - weekly = { format = "%YW%W"; retain = 4; }; - monthly = { format = "%Y-%m"; retain = 12; }; - yearly = { format = "%Y"; }; - }; - }; -in { - krebs.backup.plans = { - # wry-to-omo_root = defaultPull config.krebs.hosts.wry "/"; - gum-to-omo_root = defaultPull config.krebs.hosts.gum "/"; - gum-dl-to-omo_external = (defaultPull config.krebs.hosts.gum "/var/download" )// - { - dst.path = "/media/cryptX/backup/gum/var-download"; - dst.host = defaultBackupServer; - startAt = "19:00"; - }; - gum-owncloud-to-omo_external = (defaultPull config.krebs.hosts.gum "/var/www/o.euer.krebsco.de" )// - { - dst.path = "/media/cryptX/backup/gum/var-www-o.euer.krebsco.de"; - dst.host = defaultBackupServer; - - startAt = "05:00"; - }; - # wolf-to-omo_root = defaultPull config.krebs.hosts.wolf "/"; - }; - environment.systemPackages = [ - pkgs.borgbackup - ]; -} diff --git a/makefu/2configs/laptop-backup.nix b/makefu/2configs/laptop-backup.nix deleted file mode 100644 index 8df7043c8..000000000 --- a/makefu/2configs/laptop-backup.nix +++ /dev/null @@ -1,12 +0,0 @@ -{config, lib, pkgs, ... }: - -{ - systemd.user.services.duply-secrets = { - description = "run daily secrets backup"; - startAt = "daily"; - serviceConfig = { - Type = "oneshot"; - ExecStart = "{pkgs.duply}/bin/duply omo-secrets backup"; - }; - }; -} -- cgit v1.2.3 From 56945ee3f2e16719943b8429d85ae3d61d8ee61f Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 21 Oct 2018 23:10:56 +0200 Subject: ma hw/switch: init udev rules --- makefu/2configs/hw/switch.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 makefu/2configs/hw/switch.nix (limited to 'makefu/2configs') diff --git a/makefu/2configs/hw/switch.nix b/makefu/2configs/hw/switch.nix new file mode 100644 index 000000000..d46e8cf3f --- /dev/null +++ b/makefu/2configs/hw/switch.nix @@ -0,0 +1,10 @@ +{ config, lib, pkgs, ... }: + +{ + + users.extraUsers.${config.krebs.build.user.name}.extraGroups = [ "plugdev" ]; + + services.udev.extraRules = '' + SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0664", GROUP="plugdev" + ''; +} -- cgit v1.2.3 From d8e481ac79f7d65fdede7cb553da8f27d7ccbfb8 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 21 Oct 2018 23:16:34 +0200 Subject: ma nginx/euer.{blog,wiki}: add state dirs --- makefu/2configs/nginx/euer.blog.nix | 1 + makefu/2configs/nginx/euer.wiki.nix | 1 + 2 files changed, 2 insertions(+) (limited to 'makefu/2configs') diff --git a/makefu/2configs/nginx/euer.blog.nix b/makefu/2configs/nginx/euer.blog.nix index 65d36d9b6..14d1285db 100644 --- a/makefu/2configs/nginx/euer.blog.nix +++ b/makefu/2configs/nginx/euer.blog.nix @@ -39,4 +39,5 @@ in { }; }; }; + state = [ base-dir ]; } diff --git a/makefu/2configs/nginx/euer.wiki.nix b/makefu/2configs/nginx/euer.wiki.nix index 99533b25c..280622259 100644 --- a/makefu/2configs/nginx/euer.wiki.nix +++ b/makefu/2configs/nginx/euer.wiki.nix @@ -21,6 +21,7 @@ let tw-pass-file = "${sec}/tw-pass.ini"; in { + state = [ base-dir ]; services.phpfpm = { # phpfpm does not have an enable option poolConfigs = { -- cgit v1.2.3 From 851c0e47d1ac7073ea5a38a656f93054b20d4b44 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 21 Oct 2018 23:17:37 +0200 Subject: ma bureautomation: add tasks for shutting down monitor --- makefu/2configs/deployment/bureautomation/hass.nix | 32 +++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'makefu/2configs') diff --git a/makefu/2configs/deployment/bureautomation/hass.nix b/makefu/2configs/deployment/bureautomation/hass.nix index 4605e8933..b1eba22b4 100644 --- a/makefu/2configs/deployment/bureautomation/hass.nix +++ b/makefu/2configs/deployment/bureautomation/hass.nix @@ -11,6 +11,11 @@ let payload_available= "Online"; payload_not_available= "Offline"; }; + tasmota_stecki = name: topic: + ( tasmota_plug name topic) // + { state_topic = "/bam/${topic}/stat/POWER"; + command_topic = "/bam/${topic}/cmnd/POWER"; + }; espeasy_dht22 = name: [ { platform = "mqtt"; name = "${name} DHT22 Temperature"; @@ -72,7 +77,7 @@ in { switch = [ (tasmota_plug "Bauarbeiterlampe" "plug") (tasmota_plug "Blitzdings" "plug2") - (tasmota_plug "Fernseher" "plug3") + (tasmota_stecki "Fernseher" "fernseher") (tasmota_plug "Pluggy" "plug4") ]; binary_sensor = [ @@ -116,6 +121,31 @@ in { frontend = { }; http = { }; feedreader.urls = [ "http://www.heise.de/security/rss/news-atom.xml" ]; + automation = [ + { alias = "Turn on Fernseher on movement"; + trigger = { + platform = "state"; + entity_id = "binary_sensor.motion"; + to = "on"; + }; + action = { + service= "homeassistant.turn_on"; + entity_id= "switch.fernseher"; + }; + } + { alias = "Turn off Fernseher 10 minutes after last movement"; + trigger = { + platform = "state"; + entity_id = "binary_sensor.motion"; + to = "off"; + for.minutes = 10; + }; + action = { + service= "homeassistant.turn_off"; + entity_id= "switch.fernseher"; + }; + } + ]; }; }; } -- cgit v1.2.3 From 99b737e3e554b866fef2a9ba5fa58107e6c75aac Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 21 Oct 2018 23:19:09 +0200 Subject: ma bepasty-dual: unauthorized on error --- makefu/2configs/bepasty-dual.nix | 5 +++++ makefu/2configs/deployment/graphs.nix | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'makefu/2configs') diff --git a/makefu/2configs/bepasty-dual.nix b/makefu/2configs/bepasty-dual.nix index 890652285..f63dbefd8 100644 --- a/makefu/2configs/bepasty-dual.nix +++ b/makefu/2configs/bepasty-dual.nix @@ -32,6 +32,11 @@ in { "paste.${config.krebs.build.host.name}" "paste.r" ]; + extraConfig = '' + if ( $server_addr = "${external-ip}" ) { + return 403; + } + ''; }; defaultPermissions = "admin,list,create,read,delete"; secretKeyFile = secKey; diff --git a/makefu/2configs/deployment/graphs.nix b/makefu/2configs/deployment/graphs.nix index bde9892cd..e7dc54dd0 100644 --- a/makefu/2configs/deployment/graphs.nix +++ b/makefu/2configs/deployment/graphs.nix @@ -6,11 +6,6 @@ let internal-ip = config.krebs.build.host.nets.retiolum.ip4.addr; hn = config.krebs.build.host.name; in { - krebs.bepasty.servers."paste.r".nginx.extraConfig = '' - if ( $server_addr = "${external-ip}" ) { - return 403; - } - ''; krebs.tinc_graphs = { enable = true; nginx = { -- cgit v1.2.3 From f2b532c7ea8a87e46b3d0c8107c33bd631ff08ab Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 21 Oct 2018 23:20:19 +0200 Subject: ma torrent: add state, torrent..r --- makefu/2configs/torrent.nix | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'makefu/2configs') diff --git a/makefu/2configs/torrent.nix b/makefu/2configs/torrent.nix index 3df0ddbfe..ca368dbf0 100644 --- a/makefu/2configs/torrent.nix +++ b/makefu/2configs/torrent.nix @@ -3,12 +3,11 @@ with import ; let - daemon-user = "tor"; basicAuth = import ; peer-port = 51412; web-port = 8112; daemon-port = 58846; - base-dir = config.makefu.dl-dir; + base-dir = config.krebs.rtorrent.workDir; in { users.users = { @@ -23,17 +22,6 @@ in { }; }; - # todo: race condition, do this after download user has been created - system.activationScripts."download-dir-chmod" = '' - for i in finished watch; do - if test ! -d $i;then - mkdir -p "${base-dir}/$i" - chown rtorrent:download "${base-dir}/$i" - chmod 775 "${base-dir}/$i" - fi - done - ''; - users.extraGroups = { download = { gid = lib.mkDefault (genid "download"); @@ -57,15 +45,17 @@ in { rutorrent.enable = true; enableXMLRPC = true; listenPort = peer-port; - downloadDir = base-dir + "/finished"; - watchDir = base-dir + "/watch"; + downloadDir = config.makefu.dl-dir; # dump old torrents into watch folder to have them re-added }; + services.nginx.virtualHosts."torrent.${config.krebs.build.host.name}.r".locations."/" = { proxyPass = "http://localhost:${toString web-port}/"; }; + networking.firewall.extraCommands = '' iptables -A INPUT -i retiolum -p tcp --dport ${toString web-port} -j ACCEPT ''; networking.firewall.allowedTCPPorts = [ peer-port ]; networking.firewall.allowedUDPPorts = [ peer-port ]; + state = [ config.krebs.rtorrent.sessionDir ]; # state which torrents were loaded } -- cgit v1.2.3 From 8f10933423df2f4dd71e13ef28a006e2fad67405 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 21 Oct 2018 23:20:51 +0200 Subject: ma tools: shuffle --- makefu/2configs/tools/android-pentest.nix | 2 +- makefu/2configs/tools/desktop.nix | 2 +- makefu/2configs/tools/extra-gui.nix | 1 - makefu/2configs/tools/media.nix | 2 +- makefu/2configs/tools/mobility.nix | 2 ++ makefu/2configs/tools/secrets.nix | 2 +- 6 files changed, 6 insertions(+), 5 deletions(-) (limited to 'makefu/2configs') diff --git a/makefu/2configs/tools/android-pentest.nix b/makefu/2configs/tools/android-pentest.nix index da8a357ae..9dedafdd2 100644 --- a/makefu/2configs/tools/android-pentest.nix +++ b/makefu/2configs/tools/android-pentest.nix @@ -9,7 +9,7 @@ dex2jar apktool jd-gui - android-studio + # android-studio jdk jre openssl diff --git a/makefu/2configs/tools/desktop.nix b/makefu/2configs/tools/desktop.nix index bb14c3eb5..924668803 100644 --- a/makefu/2configs/tools/desktop.nix +++ b/makefu/2configs/tools/desktop.nix @@ -3,7 +3,7 @@ { users.users.makefu.packages = with pkgs; [ taskwarrior - pass + (pass.withExtensions (ext: [ ext.pass-otp ])) gopass mutt weechat diff --git a/makefu/2configs/tools/extra-gui.nix b/makefu/2configs/tools/extra-gui.nix index 1c28eeffd..3d26cc574 100644 --- a/makefu/2configs/tools/extra-gui.nix +++ b/makefu/2configs/tools/extra-gui.nix @@ -6,7 +6,6 @@ gimp inkscape libreoffice - quodlibet # skype synergy tdesktop diff --git a/makefu/2configs/tools/media.nix b/makefu/2configs/tools/media.nix index a61b6c88e..988550655 100644 --- a/makefu/2configs/tools/media.nix +++ b/makefu/2configs/tools/media.nix @@ -7,7 +7,7 @@ vlc mumble mplayer - quodlibet + quodlibet # exfalso plowshare streamripper diff --git a/makefu/2configs/tools/mobility.nix b/makefu/2configs/tools/mobility.nix index 8a559dbbd..11151003d 100644 --- a/makefu/2configs/tools/mobility.nix +++ b/makefu/2configs/tools/mobility.nix @@ -7,6 +7,8 @@ rclone exfat (pkgs.callPackage ./secrets.nix {}) + + opensc pcsctools libu2f-host ]; # boot.extraModulePackages = [ config.boot.kernelPackages.exfat-nofuse ]; diff --git a/makefu/2configs/tools/secrets.nix b/makefu/2configs/tools/secrets.nix index f88618cbc..7d10983c7 100644 --- a/makefu/2configs/tools/secrets.nix +++ b/makefu/2configs/tools/secrets.nix @@ -1,7 +1,7 @@ { pass, write, writeDash, ... }: write "secrets" { - "/bin/secrets".link = writeDash "brain" '' + "/bin/secrets".link = writeDash "secrets" '' PASSWORD_STORE_DIR=$HOME/.secrets-pass/ \ exec ${pass}/bin/pass $@ ''; -- cgit v1.2.3 From 90da0939308ac0b7e3d73370ee6c12b5901990b7 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 21 Oct 2018 23:21:22 +0200 Subject: ma cgit-retiolum: add secrets repo --- makefu/2configs/git/cgit-retiolum.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'makefu/2configs') diff --git a/makefu/2configs/git/cgit-retiolum.nix b/makefu/2configs/git/cgit-retiolum.nix index 1a7f3d987..4890e4afe 100644 --- a/makefu/2configs/git/cgit-retiolum.nix +++ b/makefu/2configs/git/cgit-retiolum.nix @@ -41,6 +41,7 @@ let autosync = { }; fenkins = { }; pass = { }; + secrets = { }; }; connector-repos = mapAttrs make-priv-repo { -- cgit v1.2.3 From f1bd2ce84d820d0b35c56245d820beffd7d2eb5b Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 21 Oct 2018 23:21:58 +0200 Subject: ma gui: do not use antialiased fonts --- makefu/2configs/gui/base.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'makefu/2configs') diff --git a/makefu/2configs/gui/base.nix b/makefu/2configs/gui/base.nix index 861a9327e..6bcd09826 100644 --- a/makefu/2configs/gui/base.nix +++ b/makefu/2configs/gui/base.nix @@ -66,7 +66,7 @@ in cat |derp < Date: Sun, 21 Oct 2018 23:22:21 +0200 Subject: ma gui/wbob-kiosk: disable screensaver on startup --- makefu/2configs/gui/wbob-kiosk.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'makefu/2configs') diff --git a/makefu/2configs/gui/wbob-kiosk.nix b/makefu/2configs/gui/wbob-kiosk.nix index 7db749227..b0479d0d7 100644 --- a/makefu/2configs/gui/wbob-kiosk.nix +++ b/makefu/2configs/gui/wbob-kiosk.nix @@ -22,4 +22,16 @@ xrandr --output HDMI2 --right-of HDMI1 ''; }; + + systemd.services.xset-off = { + after = [ "display-manager.service" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + ExecStart = "${pkgs.xlibs.xset}/bin/xset -display :0 s off -dpms"; + RemainAfterExit = "yes"; + TimeoutSec = "5"; + Restart = "on-failure"; + }; + }; + } -- cgit v1.2.3 From 7a3801c75ef2ecccb976be8ed62367e6ddb3ce25 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 21 Oct 2018 23:28:52 +0200 Subject: ma home-manager: bump --- makefu/2configs/home-manager/cli.nix | 8 ++++- makefu/2configs/home-manager/default.nix | 3 ++ makefu/2configs/home-manager/desktop.nix | 52 ++++++++++++++++++++------------ makefu/2configs/home-manager/mail.nix | 3 +- 4 files changed, 44 insertions(+), 22 deletions(-) (limited to 'makefu/2configs') diff --git a/makefu/2configs/home-manager/cli.nix b/makefu/2configs/home-manager/cli.nix index 1efc4d2bf..64aa03bd7 100644 --- a/makefu/2configs/home-manager/cli.nix +++ b/makefu/2configs/home-manager/cli.nix @@ -1,12 +1,18 @@ -{ +{pkgs, ... }: { home-manager.users.makefu = { services.gpg-agent = { + enable = true; defaultCacheTtl = 900; maxCacheTtl = 7200; defaultCacheTtlSsh = 3600; maxCacheTtlSsh = 86400; enableSshSupport = true; + enableScDaemon = true; }; programs.fzf.enable = true; # alt-c }; + services.udev.packages = [ + pkgs.libu2f-host + pkgs.yubikey-personalization + ]; } diff --git a/makefu/2configs/home-manager/default.nix b/makefu/2configs/home-manager/default.nix index e75ee6262..2a4574cc8 100644 --- a/makefu/2configs/home-manager/default.nix +++ b/makefu/2configs/home-manager/default.nix @@ -4,4 +4,7 @@ ]; home-manager.users.makefu = { }; + environment.variables = { + GTK_DATA_PREFIX = "/run/current-system/sw"; + }; } diff --git a/makefu/2configs/home-manager/desktop.nix b/makefu/2configs/home-manager/desktop.nix index c2f854d47..ce98e651a 100644 --- a/makefu/2configs/home-manager/desktop.nix +++ b/makefu/2configs/home-manager/desktop.nix @@ -1,31 +1,43 @@ -{pkgs, ... }: { +{ pkgs, lib, ... }: + +{ home-manager.users.makefu = { programs.browserpass = { browsers = [ "firefox" ] ; enable = true; }; + programs.firefox.enable = true; services.network-manager-applet.enable = true; + systemd.user.services.network-manager-applet.Service.Environment = ''XDG_DATA_DIRS=/etc/profiles/per-user/makefu/share GDK_PIXBUF_MODULE_FILE=${pkgs.librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache''; services.blueman-applet.enable = true; services.pasystray.enable = true; - - systemd.user.services.network-manager-applet.Service.Environment = '' - XDG_DATA_DIRS=/etc/profiles/per-user/makefu/share GDK_PIXBUF_MODULE_FILE=${pkgs.librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache - ''; - systemd.user.services.clipit = { - Unit = { - Description = "clipboard manager"; - After = [ "graphical-session-pre.target" ]; - PartOf = [ "graphical-session.target" ]; + systemd.user.services.pasystray.Service.Environment = "PATH=" + (lib.makeBinPath (with pkgs;[ pavucontrol paprefs /* pavumeter */ /* paman */ ]) ); + programs.chromium = { + enable = true; + extensions = [ + "cjpalhdlnbpafiamejdnhcphjbkeiagm" # ublock origin + "dbepggeogbaibhgnhhndojpepiihcmeb" # vimium + # "liloimnbhkghhdhlamdjipkmadhpcjmn" # krebsgold + "fpnmgdkabkmnadcjpehmlllkndpkmiak" # wayback machine + "gcknhkkoolaabfmlnjonogaaifnjlfnp" # foxyproxy + "abkfbakhjpmblaafnpgjppbmioombali" # memex + "kjacjjdnoddnpbbcjilcajfhhbdhkpgk" # forest + ]; }; - Install = { - WantedBy = [ "graphical-session.target" ]; - }; + systemd.user.services.clipit = { + Unit = { + Description = "clipboard manager"; + After = [ "graphical-session-pre.target" ]; + PartOf = [ "graphical-session.target" ]; + }; - Service = { - Environment = '' - XDG_DATA_DIRS=/etc/profiles/per-user/makefu/share GDK_PIXBUF_MODULE_FILE=${pkgs.librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache - ''; - ExecStart = "${pkgs.clipit}/bin/clipit"; - Restart = "on-abort"; + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + + Service = { + Environment = ''XDG_DATA_DIRS=/etc/profiles/per-user/makefu/share GDK_PIXBUF_MODULE_FILE=${pkgs.librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache''; + ExecStart = "${pkgs.clipit}/bin/clipit"; + Restart = "on-abort"; + }; }; }; - }; } diff --git a/makefu/2configs/home-manager/mail.nix b/makefu/2configs/home-manager/mail.nix index ce7ae4f4d..467e0d7a0 100644 --- a/makefu/2configs/home-manager/mail.nix +++ b/makefu/2configs/home-manager/mail.nix @@ -1,5 +1,6 @@ { home-manager.users.makefu = { + accounts.email.maildirBasePath = "/home/makefu/Mail"; accounts.email.accounts.syntaxfehler = { address = "felix.richter@syntax-fehler.de"; userName = "Felix.Richter@syntax-fehler.de"; @@ -27,7 +28,7 @@ }; primary = true; realName = "Felix Richter"; - passwordCommand = "gpg --use-agent --quiet --batch -d /home/makefu/.mail/syntax-fehler.gpg"; + passwordCommand = "gpg --use-agent --quiet --batch -d /home/makefu/.gnupg/mail/syntax-fehler.gpg"; }; programs.offlineimap.enable = true; programs.offlineimap.extraConfig = { -- cgit v1.2.3 From f6b82f2d1f3cd5df1d70bf2b8e9f69196268f1e3 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 21 Oct 2018 23:29:34 +0200 Subject: ma hw/bluetooth: add blueman to dbus packages --- makefu/2configs/hw/bluetooth.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'makefu/2configs') diff --git a/makefu/2configs/hw/bluetooth.nix b/makefu/2configs/hw/bluetooth.nix index 313ca0147..e556b43c0 100644 --- a/makefu/2configs/hw/bluetooth.nix +++ b/makefu/2configs/hw/bluetooth.nix @@ -1,9 +1,7 @@ { pkgs, ... }: { # bluetooth+pulse config # for blueman-applet - users.users.makefu.packages = [ - pkgs.blueman - ]; + users.users.makefu.packages = [ pkgs.blueman ]; hardware.pulseaudio = { enable = true; package = pkgs.pulseaudioFull; @@ -39,4 +37,5 @@ Enable=Source,Sink,Media,Socket ''; }; + services.dbus.packages = [ pkgs.blueman ]; } -- cgit v1.2.3 From 85e7795a34c757993118a39a8b6bb23465c0246b Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 21 Oct 2018 23:29:55 +0200 Subject: ma hw/network-manager: collect state --- makefu/2configs/hw/network-manager.nix | 3 +++ 1 file changed, 3 insertions(+) (limited to 'makefu/2configs') diff --git a/makefu/2configs/hw/network-manager.nix b/makefu/2configs/hw/network-manager.nix index ffc32e0cb..3b9d04549 100644 --- a/makefu/2configs/hw/network-manager.nix +++ b/makefu/2configs/hw/network-manager.nix @@ -27,4 +27,7 @@ powersave = true; scanRandMacAddress = true; }; + state = [ + "/etc/NetworkManager/system-connections" #NM stateful config files + ]; } -- cgit v1.2.3 From 2e88305f407f1b3b2d71e7c3948645374c8cfd65 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 21 Oct 2018 23:31:37 +0200 Subject: ma virtualbox: cleanup --- makefu/2configs/virtualisation/virtualbox.nix | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'makefu/2configs') diff --git a/makefu/2configs/virtualisation/virtualbox.nix b/makefu/2configs/virtualisation/virtualbox.nix index 30de6e44a..e90cc1e8d 100644 --- a/makefu/2configs/virtualisation/virtualbox.nix +++ b/makefu/2configs/virtualisation/virtualbox.nix @@ -1,26 +1,9 @@ { config, lib, pkgs, ... }: -let - mainUser = config.krebs.build.user; - vboxguestpkg = lib.stdenv.mkDerivation rec { - name = "Virtualbox-Extensions-${version}-${rev}"; - version = "5.0.20"; - rev = "106931"; - src = pkgs.fetchurl { - url = "http://download.virtualbox.org/virtualbox/${version}/Oracle_VM_VirtualBox_Extension_Pack-${version}-${rev}.vbox-extpack"; - sha256 = "1dc70x2m7x266zzw5vw36mxqj7xykkbk357fc77f9zrv4lylzvaf"; - }; - }; -in { +{ virtualisation.virtualbox.host.enable = true; nixpkgs.config.virtualbox.enableExtensionPack = true; virtualisation.virtualbox.host.enableHardening = false; - users.extraGroups.vboxusers.members = [ "${mainUser.name}" ]; - nixpkgs.config.packageOverrides = super: { - boot.kernelPackages.virtualbox = super.boot.kernelPackages.virtualbox.override { - buildInputs = super.boot.kernelPackages.virtualBox.buildInputs - ++ [ vboxguestpkg ]; - }; - }; + users.extraGroups.vboxusers.members = [ config.krebs.build.user.name ]; } -- cgit v1.2.3 From ea3afff61105fd32be1ea658460329aecf061eec Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 5 Nov 2018 13:50:22 +0100 Subject: ma gum: prepare replacement by nextgum --- makefu/2configs/taskd.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 makefu/2configs/taskd.nix (limited to 'makefu/2configs') diff --git a/makefu/2configs/taskd.nix b/makefu/2configs/taskd.nix new file mode 100644 index 000000000..5ca3b9904 --- /dev/null +++ b/makefu/2configs/taskd.nix @@ -0,0 +1,11 @@ +{config, ... }: +{ + services.taskserver.enable = true; + services.taskserver.fqdn = config.krebs.build.host.name; + services.taskserver.listenHost = "::"; + services.taskserver.organisations.home.users = [ "makefu" ]; + networking.firewall.extraCommands = '' + iptables -A INPUT -i retiolum -p tcp --dport 53589 -j ACCEPT + ip6tables -A INPUT -i retiolum -p tcp --dport 53589 -j ACCEPT + ''; +} -- cgit v1.2.3 From 2487cbc8829b9c81545d1627d4a03b8fed12de01 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 5 Nov 2018 13:51:28 +0100 Subject: ma wbob.r: more automation --- makefu/2configs/deployment/bureautomation/hass.nix | 129 +++++++++++++++++---- makefu/2configs/deployment/bureautomation/mpd.nix | 9 ++ 2 files changed, 118 insertions(+), 20 deletions(-) create mode 100644 makefu/2configs/deployment/bureautomation/mpd.nix (limited to 'makefu/2configs') diff --git a/makefu/2configs/deployment/bureautomation/hass.nix b/makefu/2configs/deployment/bureautomation/hass.nix index b1eba22b4..443484a34 100644 --- a/makefu/2configs/deployment/bureautomation/hass.nix +++ b/makefu/2configs/deployment/bureautomation/hass.nix @@ -12,7 +12,7 @@ let payload_not_available= "Offline"; }; tasmota_stecki = name: topic: - ( tasmota_plug name topic) // + ( tasmota_plug name topic) // { state_topic = "/bam/${topic}/stat/POWER"; command_topic = "/bam/${topic}/cmnd/POWER"; }; @@ -43,9 +43,6 @@ let }; in { networking.firewall.allowedTCPPorts = [ 8123 ]; - nixpkgs.config.permittedInsecurePackages = [ - "homeassistant-0.65.5" - ]; services.home-assistant = { enable = true; @@ -53,6 +50,9 @@ in { homeassistant = { name = "Bureautomation"; time_zone = "Europe/Berlin"; + latitude = "48.8265"; + longitude = "9.0676"; + elevation = 303; }; mqtt = { @@ -101,26 +101,109 @@ in { sensorid = "5341"; monitored_conditions = [ "P1" "P2" ]; } - { platform = "influxdb"; - queries = [ - { name = "mean value of feinstaub P1"; - where = '' "node" = 'esp8266-1355142' ''; - measurement = "feinstaub"; - database = "telegraf"; - field = "P1"; - } - { name = "mean value of feinstaub P2"; - where = '' "node" = 'esp8266-1355142' ''; - measurement = "feinstaub"; - database = "telegraf"; - field = "P2"; - } - ]; + + { platform = "darksky"; + api_key = lib.removeSuffix "\n" + (builtins.readFile ); + language = "de"; + monitored_conditions = [ "summary" "icon" + "nearest_storm_distance" "precip_probability" + "precip_intensity" + "temperature" # "temperature_high" "temperature_low" + "apparent_temperature" + "hourly_summary" # next 24 hours text + "minutely_summary" + "humidity" + "pressure" + "uv_index" ]; + units = "si" ; + update_interval = { + days = 0; + hours = 0; + minutes = 30; + seconds = 0; + }; + } + #{ platform = "influxdb"; + # queries = [ + # { name = "mean value of feinstaub P1"; + # where = '' "node" = 'esp8266-1355142' ''; + # measurement = "feinstaub"; + # database = "telegraf"; + # field = "P1"; + # } + # { name = "mean value of feinstaub P2"; + # where = '' "node" = 'esp8266-1355142' ''; + # measurement = "feinstaub"; + # database = "telegraf"; + # field = "P2"; + # } + # ]; + #} + ]; + camera = [ + { name = "Baumarkt"; + platform = "generic"; + still_image_url = http://t4915209254324-p80-c0-h6jv2afnujcoftrcstsafb45kdrqv4buy.webdirect.mdex.de/oneshotimage ;# baumarkt + } + { name = "Autobahn Heilbronn"; + platform = "generic"; + still_image_url = https://api.svz-bw.de/v2/verkehrskameras/kameras/K10 ; + } + { name = "Autobahn Singen"; + platform = "generic"; + still_image_url = https://api.svz-bw.de/v2/verkehrskameras/kameras/K11 ; } ]; frontend = { }; http = { }; - feedreader.urls = [ "http://www.heise.de/security/rss/news-atom.xml" ]; + conversation = {}; + history = {}; + logbook = {}; + tts = [ { platform = "google";} ]; + recorder = {}; + group = + { default_view = + { view = "yes"; + entities = [ + "group.sensors" + "group.outside" + "group.switches" + "group.automation" + "group.camera" + ]; + }; + automation = [ + "automation.turn_off_fernseher_10_minutes_after_last_movement" + ]; + switches = [ + "switch.bauarbeiterlampe" + "switch.blitzdings" + "switch.fernseher" + "switch.pluggy" + ]; + camera = [ + "camera.Baumarkt" + "camera.Autobahn_Heilbronn" + "camera.Autobahn_Singen" + ]; + sensors = [ + "binary_sensor.motion" + "sensor.easy2_dht22_humidity" + "sensor.easy2_dht22_temperature" + ]; + outside = [ + "sensor.ditzingen_pm10" + "sensor.ditzingen_pm25" + "sensor.dark_sky_temperature" + "sensor.dark_sky_humidity" + "sensor.dark_sky_pressure" + "sensor.dark_sky_hourly_summary" + "sensor.dark_sky_minutely_summary" + ]; + }; + # only for automation + # feedreader.urls = [ "http://www.heise.de/security/rss/news-atom.xml" ]; automation = [ { alias = "Turn on Fernseher on movement"; trigger = { @@ -144,6 +227,12 @@ in { service= "homeassistant.turn_off"; entity_id= "switch.fernseher"; }; + condition = [{ + condition = "time"; + before = "06:30:00"; #only turn off between 6:30 and 18:00 + after = "18:00:00"; + weekday = [ "mon" "tue" "wed" "thu" "fri" ]; + }]; } ]; }; diff --git a/makefu/2configs/deployment/bureautomation/mpd.nix b/makefu/2configs/deployment/bureautomation/mpd.nix new file mode 100644 index 000000000..1f5acb357 --- /dev/null +++ b/makefu/2configs/deployment/bureautomation/mpd.nix @@ -0,0 +1,9 @@ +{lib,pkgs, ... }: + +{ + systemd.services."ympd-wbob" = { + description = "mpd "; + wantedBy = [ "multi-user.target" ]; + serviceConfig.ExecStart = "${pkgs.ympd}/bin/ympd --host localhost --port 6600 --webport 8866 --user nobody"; + }; +} -- cgit v1.2.3 From 7f52e698476f3d782caa4134a6166c68a9abc56e Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 5 Nov 2018 13:51:54 +0100 Subject: ma wbob-kiosk: trying to get xset working ... --- makefu/2configs/gui/wbob-kiosk.nix | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'makefu/2configs') diff --git a/makefu/2configs/gui/wbob-kiosk.nix b/makefu/2configs/gui/wbob-kiosk.nix index b0479d0d7..6da1a37e7 100644 --- a/makefu/2configs/gui/wbob-kiosk.nix +++ b/makefu/2configs/gui/wbob-kiosk.nix @@ -4,23 +4,26 @@ imports = [ ./base.nix ]; - users.users.makefu.packages = [ pkgs.chromium ]; + users.users.makefu = { + packages = [ pkgs.chromium ]; + extraGroups = [ "audio" "pulse" ]; + }; services.xserver = { - layout = lib.mkForce "de"; - xkbVariant = lib.mkForce ""; windowManager = lib.mkForce { awesome.enable = false; default = "none"; }; - desktopManager.xfce.enable = true; + desktopManager.xfce = { + extraSessionCommands = '' + ${pkgs.xlibs.xset}/bin/xset -display :0 s off -dpms + ${pkgs.xlibs.xrandr}/bin/xrandr --output HDMI2 --right-of HDMI1 + ''; + enable = true; + }; # xrandrHeads = [ "HDMI1" "HDMI2" ]; # prevent screen from turning off, disable dpms - displayManager.sessionCommands = '' - xset -display :0 s off -dpms - xrandr --output HDMI2 --right-of HDMI1 - ''; }; systemd.services.xset-off = { @@ -29,7 +32,8 @@ serviceConfig = { ExecStart = "${pkgs.xlibs.xset}/bin/xset -display :0 s off -dpms"; RemainAfterExit = "yes"; - TimeoutSec = "5"; + TimeoutSec = "5s"; + RestartSec="5s"; Restart = "on-failure"; }; }; -- cgit v1.2.3 From e706831281d6e4a0638cab2a8f38ac21af23081c Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 5 Nov 2018 13:52:11 +0100 Subject: ma homeautomation: more sensors --- .../2configs/deployment/homeautomation/default.nix | 54 +++++++++++++++++++--- 1 file changed, 48 insertions(+), 6 deletions(-) (limited to 'makefu/2configs') diff --git a/makefu/2configs/deployment/homeautomation/default.nix b/makefu/2configs/deployment/homeautomation/default.nix index 5da0dba2e..94799b11d 100644 --- a/makefu/2configs/deployment/homeautomation/default.nix +++ b/makefu/2configs/deployment/homeautomation/default.nix @@ -17,7 +17,7 @@ let # state # TODO: currently broken, will not use the custom state topic #state_topic = "/ham/${topic}/stat/POWER"; - state_topic = "stat/${topic}/POWER"; + state_topic = "/ham/${topic}/stat/POWER"; command_topic = "/ham/${topic}/cmnd/POWER"; availability_topic = "/ham/${topic}/tele/LWT"; payload_on= "ON"; @@ -47,7 +47,7 @@ let device_class = "motion"; inherit name; # TODO: currently broken, will not use the custom state topic - state_topic = "stat/${topic}/POWER"; + state_topic = "/ham/${topic}/stat/POWER"; payload_on = "ON"; payload_off = "OFF"; availability_topic = "/ham/${topic}/tele/LWT"; @@ -87,6 +87,20 @@ let unit_of_measurement = "hPa"; } ]; + tasmota_am2301 = name: topic: + [ { platform = "mqtt"; + name = "${name} Temperatur"; + state_topic = "/ham/${topic}/tele/SENSOR"; + value_template = "{{ value_json.AM2301.Temperature }}"; + unit_of_measurement = "°C"; + } + { platform = "mqtt"; + name = "${name} Luftfeuchtigkeit"; + state_topic = "/ham/${topic}/tele/SENSOR"; + value_template = "{{ value_json.AM2301.Humidity }}"; + unit_of_measurement = "%"; + } + ]; in { imports = [ ./mqtt.nix @@ -153,7 +167,7 @@ in { # monitored_conditions = [ "ping" "download" "upload" ]; #} { platform = "luftdaten"; - name = "Ditzingen"; + name = "Wangen"; sensorid = "663"; monitored_conditions = [ "P1" "P2" ]; } @@ -165,18 +179,23 @@ in { monitored_conditions = [ "summary" "icon" "nearest_storm_distance" "precip_probability" "precip_intensity" - "temperature" # "temperature_high" "temperature_low" + "temperature" + "apparent_temperature" "hourly_summary" + "humidity" + "pressure" "uv_index" ]; units = "si" ; update_interval = { days = 0; hours = 0; - minutes = 10; + minutes = 30; seconds = 0; }; } - ] ++ (tasmota_bme "Schlafzimmer" "schlafzimmer"); + ] + ++ (tasmota_bme "Schlafzimmer" "schlafzimmer") + ++ (tasmota_am2301 "Arbeitszimmer" "arbeitszimmer"); frontend = { }; group = { default_view = @@ -186,6 +205,7 @@ in { "group.schlafzimmer" "group.draussen" "group.wohnzimmer" + "group.arbeitszimmer" ]; }; flur = [ @@ -198,6 +218,8 @@ in { draussen = [ "sensor.dark_sky_temperature" "sensor.dark_sky_hourly_summary" + "sensor.wangen_pm10" + "sensor.wangen_pm25" ]; schlafzimmer = [ "sensor.schlafzimmer_temperatur" @@ -205,12 +227,32 @@ in { "sensor.schlafzimmer_luftfeuchtigkeit" "switch.lichterkette_schlafzimmer" ]; + arbeitszimmer = [ + "switch.strom_staubsauger" + "sensor.arbeitszimmer_temperatur" + "sensor.arbeitszimmer_luftfeuchtigkeit" + ]; }; http = { }; switch = [ (tasmota_plug "Lichterkette Schlafzimmer" "schlafzimmer") + (tasmota_plug "Strom Staubsauger" "arbeitszimmer") ]; light = [ (tasmota_rgb "Flurlicht" "flurlicht" ) ]; + automation = [ + { alias = "Staubsauger Strom aus nach 6h"; + trigger = { + platform = "state"; + entity_id = "switch.strom_staubsauger"; + to = "on"; + for.hours = 6; + }; + action = { + service= "homeassistant.turn_off"; + entity_id= "switch.strom_staubsauger"; + }; + } + ]; }; enable = true; #configDir = "/var/lib/hass"; -- cgit v1.2.3 From af41e7225900113b6a9c9b666a5fa25e209965b7 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 5 Nov 2018 13:55:24 +0100 Subject: ma wbob: cleanup config, minor tweaks --- makefu/2configs/bluetooth-mpd.nix | 2 ++ makefu/2configs/stats/arafetch.nix | 2 ++ makefu/2configs/tools/media.nix | 2 ++ 3 files changed, 6 insertions(+) (limited to 'makefu/2configs') diff --git a/makefu/2configs/bluetooth-mpd.nix b/makefu/2configs/bluetooth-mpd.nix index b59d3ce10..e007b6072 100644 --- a/makefu/2configs/bluetooth-mpd.nix +++ b/makefu/2configs/bluetooth-mpd.nix @@ -57,6 +57,8 @@ in { load-module module-filter-heuristics load-module module-filter-apply load-module module-switch-on-connect + load-module module-equalizer-sink + load-module module-dbus-protocol #load-module module-bluez5-device #load-module module-bluez5-discover ''; diff --git a/makefu/2configs/stats/arafetch.nix b/makefu/2configs/stats/arafetch.nix index 422676b24..c16629cc5 100644 --- a/makefu/2configs/stats/arafetch.nix +++ b/makefu/2configs/stats/arafetch.nix @@ -27,12 +27,14 @@ in { systemd.services.arafetch = { startAt = "Mon,Wed,Fri 09:15:00"; wantedBy = [ "multi-user.target" ]; + after = [ "network-online.target" ]; environment = { OUTDIR = home; }; path = [ pkg pkgs.git pkgs.wget ]; serviceConfig = { User = "arafetch"; + Restart = "always"; WorkingDirectory = home; PrivateTmp = true; ExecStart = pkgs.writeDash "start-weekrun" '' diff --git a/makefu/2configs/tools/media.nix b/makefu/2configs/tools/media.nix index 988550655..88a7c6882 100644 --- a/makefu/2configs/tools/media.nix +++ b/makefu/2configs/tools/media.nix @@ -12,5 +12,7 @@ plowshare streamripper youtube-dl + + pulseeffects ]; } -- cgit v1.2.3