diff options
-rw-r--r-- | krebs/2configs/syncthing.nix | 12 | ||||
-rw-r--r-- | krebs/nixpkgs-unstable.json | 8 | ||||
-rw-r--r-- | krebs/nixpkgs.json | 8 | ||||
-rw-r--r-- | lass/1systems/radio/source.nix | 6 | ||||
-rw-r--r-- | lass/2configs/mail.nix | 12 | ||||
-rw-r--r-- | lass/2configs/services/radio/default.nix | 2 | ||||
-rw-r--r-- | lass/2configs/services/radio/news.nix | 29 |
7 files changed, 51 insertions, 26 deletions
diff --git a/krebs/2configs/syncthing.nix b/krebs/2configs/syncthing.nix index dac1863d5..d6d42ca11 100644 --- a/krebs/2configs/syncthing.nix +++ b/krebs/2configs/syncthing.nix @@ -1,17 +1,21 @@ -{ config, pkgs, ... }: with import <stockholm/lib>; let +{ options, config, pkgs, ... }: with import <stockholm/lib>; let mk_peers = mapAttrs (n: v: { id = v.syncthing.id; }); all_peers = filterAttrs (n: v: v.syncthing.id != null) config.krebs.hosts; - used_peer_names = unique (flatten (mapAttrsToList (n: v: v.devices) config.services.syncthing.declarative.folders)); + used_peer_names = unique (filter isString (flatten (mapAttrsToList (n: v: v.devices) config.services.syncthing.folders))); used_peers = filterAttrs (n: v: elem n used_peer_names) all_peers; in { services.syncthing = { enable = true; configDir = "/var/lib/syncthing"; - devices = mk_peers used_peers; key = toString <secrets/syncthing.key>; cert = toString <secrets/syncthing.cert>; - }; + # workaround for infinite recursion on unstable, remove in 23.11 + } // (if builtins.hasAttr "settings" options.services.syncthing then + { settings.devices = mk_peers used_peers; } + else + { devices = mk_peers used_peers; } + ); boot.kernel.sysctl."fs.inotify.max_user_watches" = 524288; } diff --git a/krebs/nixpkgs-unstable.json b/krebs/nixpkgs-unstable.json index d9e81ad37..9b4622275 100644 --- a/krebs/nixpkgs-unstable.json +++ b/krebs/nixpkgs-unstable.json @@ -1,9 +1,9 @@ { "url": "https://github.com/NixOS/nixpkgs", - "rev": "897876e4c484f1e8f92009fd11b7d988a121a4e7", - "date": "2023-05-06T22:28:42+01:00", - "path": "/nix/store/55lpvam2wgdmrbzx0j5gf51dqrqn8wqv-nixpkgs", - "sha256": "0i9j45jwmqhiv7v8i4dmigaras3iw4hmrds2vvd5x8riln3hyizn", + "rev": "7084250df3d7f9735087d3234407f3c1fc2400e3", + "date": "2023-05-22T13:19:02+02:00", + "path": "/nix/store/zgv3fzg2lywfqdrv4mghd62s9i6zxhrw-nixpkgs", + "sha256": "0nkg8h5ix0sbjqb0gdj5124nbg2gd1nmyl1p14cvlg77fs7afld6", "fetchLFS": false, "fetchSubmodules": false, "deepClone": false, diff --git a/krebs/nixpkgs.json b/krebs/nixpkgs.json index 4ba72d00d..d4d9cc743 100644 --- a/krebs/nixpkgs.json +++ b/krebs/nixpkgs.json @@ -1,9 +1,9 @@ { "url": "https://github.com/NixOS/nixpkgs", - "rev": "a08e061a4ee8329747d54ddf1566d34c55c895eb", - "date": "2023-05-09T12:11:35+02:00", - "path": "/nix/store/lwy9r49c92ml9mbvp2kx1m31p7bcpzxd-nixpkgs", - "sha256": "1h0yd0xka6wj9sbbq34gw7a9qlp044b7dhg16bmn8bv96ix55vzj", + "rev": "a17f99dfcb9643200b3884ca195c69ae41d7f059", + "date": "2023-05-23T18:09:00+02:00", + "path": "/nix/store/2n82i65gv1y54xj3dplkvhfyc8rs1j90-nixpkgs", + "sha256": "180ipicp351s99nvn9xvf5nzs5fzxhawfbykaijvaqj63siss13m", "fetchLFS": false, "fetchSubmodules": false, "deepClone": false, diff --git a/lass/1systems/radio/source.nix b/lass/1systems/radio/source.nix new file mode 100644 index 000000000..4acdb0c26 --- /dev/null +++ b/lass/1systems/radio/source.nix @@ -0,0 +1,6 @@ +{ lib, pkgs, test, ... }: let + npkgs = lib.importJSON ../../../krebs/nixpkgs-unstable.json; +in if test then {} else { + nixpkgs.git.ref = lib.mkForce npkgs.rev; + nixpkgs-unstable = lib.mkForce { file = "/var/empty"; }; +} diff --git a/lass/2configs/mail.nix b/lass/2configs/mail.nix index 0adef8f8c..bf8904b89 100644 --- a/lass/2configs/mail.nix +++ b/lass/2configs/mail.nix @@ -124,15 +124,6 @@ let ''; muttrc = pkgs.writeText "muttrc" '' - # gpg - source ${pkgs.neomutt}/share/doc/neomutt/samples/gpg.rc - set pgp_use_gpg_agent = yes - set pgp_sign_as = 0xDC2A43EF4F11E854B44D599A89E82952976A7E4D - set crypt_autosign = no - set crypt_replyencrypt = yes - set crypt_verify_sig = yes - set pgp_verify_command = "gpg --no-verbose --batch --output - --verify %s %f" - # read html mails auto_view text/html @@ -187,8 +178,7 @@ let until ${pkgs.muchsync}/bin/muchsync -F lass@green.r; do sleep 1 done - ''}<enter> \ - 'run muchsync to green.r' + ''}<enter> #killed bind index d noop diff --git a/lass/2configs/services/radio/default.nix b/lass/2configs/services/radio/default.nix index a511196fd..16ef31b6f 100644 --- a/lass/2configs/services/radio/default.nix +++ b/lass/2configs/services/radio/default.nix @@ -82,7 +82,7 @@ in { users.users = { "${name}" = rec { inherit name; - createHome = lib.mkForce false; + createHome = true; group = name; uid = pkgs.stockholm.lib.genid_uint31 name; description = "radio manager"; diff --git a/lass/2configs/services/radio/news.nix b/lass/2configs/services/radio/news.nix index 0dc711e6c..62f7f548c 100644 --- a/lass/2configs/services/radio/news.nix +++ b/lass/2configs/services/radio/news.nix @@ -1,6 +1,31 @@ { config, lib, pkgs, ... }: let + tts = pkgs.writers.writeBashBin "tts" '' + set -efu + + offset=0 + OUTPUT=$(mktemp -d) + trap 'rm -rf "$OUTPUT"' EXIT + SPEAKER=$[ $RANDOM % 900 ] + while read line; do + echo "$line" | + ${pkgs.larynx}/bin/larynx \ + --model ${pkgs.fetchzip { + url = "https://github.com/rhasspy/piper/releases/download/v0.0.2/voice-en-us-libritts-high.tar.gz"; + hash = "sha256-jCoK4p0O7BuF0nr6Sfj40tpivCvU5M3GHKQRg1tfIO8="; + stripRoot = false; + }}/en-us-libritts-high.onnx \ + -s "$SPEAKER" \ + -f "$OUTPUT"/"$offset".wav + + ((offset+=1)) + done + + ${pkgs.sox}/bin/sox "$OUTPUT"/*.wav "$OUTPUT"/all.wav + cat "$OUTPUT"/all.wav + ''; + send_to_radio = pkgs.writers.writeDashBin "send_to_radio" '' ${pkgs.vorbis-tools}/bin/oggenc - | ${pkgs.cyberlocker-tools}/bin/cput news.ogg @@ -41,16 +66,16 @@ in systemd.services.newsshow = { path = [ newsshow + tts send_to_radio gc_news get_current_news - pkgs.curl pkgs.retry ]; script = '' set -efu retry -t 5 -d 10 -- newsshow | - retry -t 5 -d 10 -- curl -fSsG http://tts.r/api/tts --data-urlencode 'text@-' | + retry -t 5 -d 10 -- tts | retry -t 5 -d 10 -- send_to_radio ''; startAt = "*:00:00"; |