From 170d54681b0e589afde00f082e506f692e1c9d25 Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 26 Nov 2020 19:53:55 +0100 Subject: [PATCH 01/11] realwallpaper: keep old markers if new ones are empty --- krebs/5pkgs/simple/realwallpaper/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/krebs/5pkgs/simple/realwallpaper/default.nix b/krebs/5pkgs/simple/realwallpaper/default.nix index 72a314ba9..56a7dfb98 100644 --- a/krebs/5pkgs/simple/realwallpaper/default.nix +++ b/krebs/5pkgs/simple/realwallpaper/default.nix @@ -108,7 +108,10 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' 'https://neo.sci.gsfc.nasa.gov/view.php?datasetId=MOD14A1_E_FIRE') & # regular fetches - fetch marker.json "$marker_url" & + fetch marker.json.tmp "$marker_url" + if [ -s marker.json.tmp ]; then + mv marker.json.tmp marker.json + fi fetch sun-raw.jpg 'https://sdo.gsfc.nasa.gov/assets/img/latest/latest_512_0171.jpg' & wait From 70bfe7e697c99b9f0f70d142a58aeea9143e9de3 Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 26 Nov 2020 20:42:20 +0100 Subject: [PATCH 02/11] l green.r: use shallow clone --- lass/1systems/green/source.nix | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/lass/1systems/green/source.nix b/lass/1systems/green/source.nix index 21f3a8bd5..48499c9db 100644 --- a/lass/1systems/green/source.nix +++ b/lass/1systems/green/source.nix @@ -1,14 +1,5 @@ { lib, pkgs, ... }: { - nixpkgs = lib.mkForce { - file = { - path = toString (pkgs.fetchFromGitHub { - owner = "nixos"; - repo = "nixpkgs"; - rev = (lib.importJSON ../../../krebs/nixpkgs.json).rev; - sha256 = (lib.importJSON ../../../krebs/nixpkgs.json).sha256; - }); - useChecksum = true; - }; - }; + nixpkgs-unstable = lib.mkForce { file = "/var/empty"; }; + nixpkgs.git.shallow = true; } From 6e09a80450925194e0614fe97345efb94d147872 Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 4 Dec 2020 19:20:35 +0100 Subject: [PATCH 03/11] exim-retiolum: add system-aliases option --- krebs/3modules/exim-retiolum.nix | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/krebs/3modules/exim-retiolum.nix b/krebs/3modules/exim-retiolum.nix index 118a8b2d5..a16661c9f 100644 --- a/krebs/3modules/exim-retiolum.nix +++ b/krebs/3modules/exim-retiolum.nix @@ -10,6 +10,11 @@ with import ; (s: substring 1 (stringLength s - 2) s) (toJSON value); + to-lsearch = concatMapStrings ({ from, to, ... }: "${from}: ${to}\n"); + lsearch = mapAttrs (name: set: toFile name (to-lsearch set)) ({ + inherit (cfg) system-aliases; + }); + in { options.krebs.exim-retiolum = { enable = mkEnableOption "krebs.exim-retiolum"; @@ -59,6 +64,19 @@ in { }; }; }; + system-aliases = mkOption { + type = types.listOf (types.submodule ({ + options = { + from = mkOption { + type = types.str; # TODO e-mail address + }; + to = mkOption { + type = types.str; # TODO e-mail address / TODO listOf + }; + }; + })); + default = []; + }; }; imports = [ { @@ -145,6 +163,11 @@ in { begin routers + system_aliases: + debug_print = "R: system_aliases for $local_part@$domain" + driver = redirect + data = ''${lookup{$local_part}lsearch{${lsearch.system-aliases}}} + local: driver = accept domains = +local_domains From 79d680a93e006ccceec4a135a0e3a0dc210c9c9f Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 8 Dec 2020 14:59:18 +0100 Subject: [PATCH 04/11] nixpkgs: f41c0fc -> 3a02dc9 --- krebs/nixpkgs.json | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/krebs/nixpkgs.json b/krebs/nixpkgs.json index b21087764..cbbc430ab 100644 --- a/krebs/nixpkgs.json +++ b/krebs/nixpkgs.json @@ -1,7 +1,10 @@ { "url": "https://github.com/NixOS/nixpkgs", - "rev": "f41c0fc7d8e49d94220f74495d4d702922df2a67", - "date": "2020-11-15T21:38:00-06:00", - "sha256": "01wim7ayn69y056q28ifw2f0mdypidpc0z15dda54aj5yy5vai09", - "fetchSubmodules": false + "rev": "3a02dc9edb283beb9580c9329f242ad705a721c3", + "date": "2020-12-07T14:46:07+01:00", + "path": "/nix/store/g3m6s3j4d69irnl5y9igq4ljcsy281x6-nixpkgs", + "sha256": "1d1lqjqqqskfg5b0hyy9q94yqzgwsnb5i0pcl71q378hl8wbgj6x", + "fetchSubmodules": false, + "deepClone": false, + "leaveDotGit": false } From 46c5284a1d6e302505ea3477ce5de6b4a286e805 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 8 Dec 2020 15:17:14 +0100 Subject: [PATCH 05/11] nixpkgs-unstable: a322b32 -> 83cbad9 --- krebs/nixpkgs-unstable.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/krebs/nixpkgs-unstable.json b/krebs/nixpkgs-unstable.json index aa78bef29..31687fcb5 100644 --- a/krebs/nixpkgs-unstable.json +++ b/krebs/nixpkgs-unstable.json @@ -1,9 +1,9 @@ { "url": "https://github.com/NixOS/nixpkgs", - "rev": "a322b32e9d74fb476944ff6cfb55833dc69cfaaa", - "date": "2020-11-19T01:15:20+01:00", - "path": "/nix/store/cgb65l8rr7v7dd4hk5sv05bnmqkcgl0n-nixpkgs", - "sha256": "1r0mkiqxija75spnyksmh8x5j4smnrxv5f7768s81gsl570kls0l", + "rev": "83cbad92d73216bb0d9187c56cce0b91f9121d5a", + "date": "2020-12-07T07:45:13+00:00", + "path": "/nix/store/722gvcjwx2cxnb55bqnmkf1kirnddjib-nixpkgs", + "sha256": "12g7d0rbw6s2zb6aq1scv59p6b5xzgsqic72pf272bhsa1bymbs0", "fetchSubmodules": false, "deepClone": false, "leaveDotGit": false From 9a862040dc2cbf87a8f3230595c6e96a027ebc25 Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 17 Dec 2020 14:49:38 +0100 Subject: [PATCH 06/11] l radio: remove icecast, let mpd stream directly (icecast has hiccups) --- lass/2configs/radio.nix | 61 ++++++++--------------------------------- 1 file changed, 11 insertions(+), 50 deletions(-) diff --git a/lass/2configs/radio.nix b/lass/2configs/radio.nix index 3e8d12381..f15e36a69 100644 --- a/lass/2configs/radio.nix +++ b/lass/2configs/radio.nix @@ -6,9 +6,6 @@ let name = "radio"; mainUser = config.users.extraUsers.mainUser; - admin-password = import ; - source-password = import ; - music_dir = "/home/radio/music"; add_random = pkgs.writeDashBin "add_random" '' @@ -138,51 +135,16 @@ in { auto_update "yes" audio_output { - type "shout" - encoding "lame" - name "the_playlist_mp3" - host "localhost" - port "8000" - mount "/radio.mp3" - password "${source-password}" - bitrate "128" - - format "44100:16:2" - - user "source" - genre "good music" + type "httpd" + name "lassulus radio" + encoder "vorbis" # optional + port "8000" + quality "5.0" # do not define if bitrate is defined + # bitrate "128" # do not define if quality is defined + format "44100:16:1" + always_on "yes" # prevent MPD from disconnecting all listeners when playback is stopped. + tags "yes" # httpd supports sending tags to listening streams. } - audio_output { - type "shout" - encoding "ogg" - name "the_playlist_ogg" - host "localhost" - port "8000" - mount "/radio.ogg" - password "${source-password}" - bitrate "128" - - format "44100:16:2" - - user "source" - genre "good music" - } - ''; - }; - - services.icecast = { - enable = true; - hostname = "radio.lassul.us"; - admin.password = admin-password; - extraConf = '' - - /radio.mp3 - ${source-password} - - - /radio.ogg - ${source-password} - ''; }; @@ -206,7 +168,7 @@ in { systemd.services.radio = let autoAdd = pkgs.writeDash "autoAdd" '' - LIMIT=$1 #in secconds + LIMIT=$1 #in seconds timeLeft () { playlistDuration=$(${pkgs.mpc_cli}/bin/mpc --format '%time%' playlist | ${pkgs.gawk}/bin/awk -F ':' 'BEGIN{t=0} {t+=$1*60+$2} END{print t}') @@ -238,8 +200,7 @@ in { ${pkgs.mpc_cli}/bin/mpc idle player > /dev/null ${pkgs.mpc_cli}/bin/mpc current -f %file% done | while read track; do - listeners=$(${pkgs.curl}/bin/curl 'http://localhost:8000/status-json.xsl' \ - | ${pkgs.jq}/bin/jq '[.icestats.source[].listeners] | add') + listeners=$(${pkgs.iproute}/bin/ss -Hno state established '( sport = :8000 )' | wc -l) echo "$(date -Is)" "$track" | tee -a "$HISTORY_FILE" echo "$(tail -$LIMIT "$HISTORY_FILE")" > "$HISTORY_FILE" ${write_to_irc} "playing: $track listeners: $listeners" From cc0e1e46c0b1758e131913b53b24f2f38cb3a520 Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 17 Dec 2020 14:51:24 +0100 Subject: [PATCH 07/11] l radio: actually stream in stereo --- lass/2configs/radio.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lass/2configs/radio.nix b/lass/2configs/radio.nix index f15e36a69..8c95b535d 100644 --- a/lass/2configs/radio.nix +++ b/lass/2configs/radio.nix @@ -141,7 +141,7 @@ in { port "8000" quality "5.0" # do not define if bitrate is defined # bitrate "128" # do not define if quality is defined - format "44100:16:1" + format "44100:16:2" always_on "yes" # prevent MPD from disconnecting all listeners when playback is stopped. tags "yes" # httpd supports sending tags to listening streams. } From a695688bdf02a1e194e76deb298ab8a51df728b6 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 21 Dec 2020 15:25:00 +0100 Subject: [PATCH 08/11] nixpkgs: 3a02dc9 -> 3d2d8f2 --- krebs/nixpkgs.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/krebs/nixpkgs.json b/krebs/nixpkgs.json index cbbc430ab..44e373b81 100644 --- a/krebs/nixpkgs.json +++ b/krebs/nixpkgs.json @@ -1,9 +1,9 @@ { "url": "https://github.com/NixOS/nixpkgs", - "rev": "3a02dc9edb283beb9580c9329f242ad705a721c3", - "date": "2020-12-07T14:46:07+01:00", - "path": "/nix/store/g3m6s3j4d69irnl5y9igq4ljcsy281x6-nixpkgs", - "sha256": "1d1lqjqqqskfg5b0hyy9q94yqzgwsnb5i0pcl71q378hl8wbgj6x", + "rev": "3d2d8f281a27d466fa54b469b5993f7dde198375", + "date": "2020-12-20T14:17:36+01:00", + "path": "/nix/store/mqn37480fj6x9xbq3igz4haw3m2lc7fm-nixpkgs", + "sha256": "1hfis53xyzy6hfdivlwkwdy7irbhk7c500a4lf7x43cfkijx5ks1", "fetchSubmodules": false, "deepClone": false, "leaveDotGit": false From c6bb79ae68ee8ca3f1f2293fc6d6ccea1a99d9f2 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 21 Dec 2020 15:31:00 +0100 Subject: [PATCH 09/11] nixpkgs-unstable: 83cbad9 -> e9158ec --- krebs/nixpkgs-unstable.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/krebs/nixpkgs-unstable.json b/krebs/nixpkgs-unstable.json index 31687fcb5..4f07b0e88 100644 --- a/krebs/nixpkgs-unstable.json +++ b/krebs/nixpkgs-unstable.json @@ -1,9 +1,9 @@ { "url": "https://github.com/NixOS/nixpkgs", - "rev": "83cbad92d73216bb0d9187c56cce0b91f9121d5a", - "date": "2020-12-07T07:45:13+00:00", - "path": "/nix/store/722gvcjwx2cxnb55bqnmkf1kirnddjib-nixpkgs", - "sha256": "12g7d0rbw6s2zb6aq1scv59p6b5xzgsqic72pf272bhsa1bymbs0", + "rev": "e9158eca70ae59e73fae23be5d13d3fa0cfc78b4", + "date": "2020-12-09T15:09:49+01:00", + "path": "/nix/store/cx4wf6pi1l2p01sz7png891m65kinfz3-nixpkgs", + "sha256": "0cnmvnvin9ixzl98fmlm3g17l6w95gifqfb3rfxs55c0wj2ddy53", "fetchSubmodules": false, "deepClone": false, "leaveDotGit": false From 4fcf00d9bb7a8417f6f4028a8eaaa616ad28a166 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 21 Dec 2020 17:56:00 +0100 Subject: [PATCH 10/11] l domsen nextcloud: 19 -> 20 --- lass/2configs/websites/domsen.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lass/2configs/websites/domsen.nix b/lass/2configs/websites/domsen.nix index ac7db10f5..f3beb9eb9 100644 --- a/lass/2configs/websites/domsen.nix +++ b/lass/2configs/websites/domsen.nix @@ -91,7 +91,7 @@ in { services.nextcloud = { enable = true; hostName = "o.xanf.org"; - package = pkgs.nextcloud19; + package = pkgs.nextcloud20; config = { adminpassFile = toString + "/nextcloud_pw"; overwriteProtocol = "https"; From 2cbed4cab9bf40fa6d712375b740bfcd41503470 Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 24 Dec 2020 22:00:21 +0100 Subject: [PATCH 11/11] l hass zigbee: update with new adapter --- lass/2configs/hass/zigbee.nix | 56 +++++++++++++++++------------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/lass/2configs/hass/zigbee.nix b/lass/2configs/hass/zigbee.nix index b2a221e49..789a7fb92 100644 --- a/lass/2configs/hass/zigbee.nix +++ b/lass/2configs/hass/zigbee.nix @@ -1,38 +1,40 @@ {config, pkgs, lib, ...}: let - zigbee2mqtt_cfg = pkgs.writeText "zigbee2mqtt.json" (builtins.toJSON { - homeassistant = true; - permit_join = false; - mqtt = { - discovery = true; - base_topic = "zigbee"; - server = "mqtt://10.42.0.1"; - user = "gg23"; - password = "gg23-mqtt"; - }; - serial.port = "/dev/cc2531"; - }); + unstable-pkgs = import {}; in { # symlink the zigbee controller services.udev.extraRules = '' - SUBSYSTEM=="tty", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", SYMLINK+="cc2531", MODE="0660", GROUP="dailout" + SUBSYSTEM=="tty", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", SYMLINK+="cc2531", MODE="0660", GROUP="dialout" + SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SYMLINK+="cc2652", MODE="0660", GROUP="dialout" ''; - system.activationScripts.installZigbee = '' - install -d /var/lib/zigbee2mqtt - install ${zigbee2mqtt_cfg} /var/lib/zigbee2mqtt/configuration.yaml - ''; + # needed to use unstable package + systemd.services.zigbee2mqtt.environment.ZIGBEE2MQTT_DATA = "/var/lib/zigbee2mqtt"; - # hack to restart docker container on config change - systemd.services.docker-zigbee2mqtt.environment.cfg = zigbee2mqtt_cfg; - - docker-containers.zigbee2mqtt = { - image = "koenkk/zigbee2mqtt"; - extraDockerOptions = [ - "--device=/dev/cc2531:/dev/cc2531" - ]; - volumes = ["/var/lib/zigbee2mqtt:/app/data"]; + services.zigbee2mqtt = { + enable = true; + package = unstable-pkgs.zigbee2mqtt; + config = { + homeassistant = true; + frontend.port = 1337; + experimental.new_api = true; + permit_join = false; + mqtt = { + discovery = true; + base_topic = "zigbee"; + server = "mqtt://10.42.0.1"; + user = "gg23"; + password = "gg23-mqtt"; + }; + serial = { + port = "/dev/cc2652"; + # disable_led = true; + }; + advanced = { + pan_id = 4222; + }; + }; }; services.home-assistant.config = { @@ -93,7 +95,6 @@ in { { id = "zigbee_join_enabled"; alias = ""; - hide_entity = "true"; trigger = { platform = "state"; entity_id = "switch.zigbee2mqtt_join"; @@ -107,7 +108,6 @@ in { # Automation to stop timer when switch turned off and turn off switch when timer finished { id = "zigbee_join_disabled"; - hide_entity = "true"; trigger = [ { platform = "event";