summaryrefslogtreecommitdiffstats
path: root/lass
diff options
context:
space:
mode:
Diffstat (limited to 'lass')
-rw-r--r--lass/1systems/hilum/config.nix2
-rw-r--r--lass/1systems/icarus/physical.nix9
-rw-r--r--lass/1systems/mors/config.nix8
-rw-r--r--lass/1systems/prism/config.nix66
-rw-r--r--lass/1systems/shodan/config.nix2
-rw-r--r--lass/1systems/uriel/config.nix1
-rw-r--r--lass/1systems/xerxes/config.nix4
-rw-r--r--lass/1systems/yellow/config.nix101
-rw-r--r--lass/2configs/baseX.nix2
-rw-r--r--lass/2configs/blue.nix1
-rw-r--r--lass/2configs/exim-smarthost.nix10
-rw-r--r--lass/2configs/gg23.nix77
-rw-r--r--lass/2configs/green-host.nix2
-rw-r--r--lass/2configs/hass/default.nix86
-rw-r--r--lass/2configs/hass/lib.nix83
-rw-r--r--lass/2configs/hass/rooms/bett.nix27
-rw-r--r--lass/2configs/hass/zigbee.nix152
-rw-r--r--lass/2configs/mpv.nix15
-rw-r--r--lass/2configs/network-manager.nix6
-rw-r--r--lass/2configs/radio.nix129
-rw-r--r--lass/2configs/sync/decsync.nix4
-rw-r--r--lass/2configs/sync/weechat.nix2
-rw-r--r--lass/2configs/syncthing.nix16
-rw-r--r--lass/2configs/websites/domsen.nix6
-rw-r--r--lass/2configs/websites/lassulus.nix7
-rw-r--r--lass/3modules/default.nix1
-rw-r--r--lass/3modules/hass.nix34
-rw-r--r--lass/5pkgs/bruellwuerfel/default.nix26
-rw-r--r--lass/5pkgs/custom/xmonad-lass/default.nix29
-rw-r--r--lass/5pkgs/emot-menu/default.nix3
-rw-r--r--lass/5pkgs/fzfmenu/default.nix26
-rw-r--r--lass/5pkgs/nm-dmenu/default.nix6
-rw-r--r--lass/5pkgs/review-mail-queue/default.nix39
33 files changed, 802 insertions, 180 deletions
diff --git a/lass/1systems/hilum/config.nix b/lass/1systems/hilum/config.nix
index 7a506591b..3f25991d9 100644
--- a/lass/1systems/hilum/config.nix
+++ b/lass/1systems/hilum/config.nix
@@ -33,4 +33,6 @@
services.logind.lidSwitch = "ignore";
services.logind.lidSwitchDocked = "ignore";
+
+ boot.tmpOnTmpfs = true;
}
diff --git a/lass/1systems/icarus/physical.nix b/lass/1systems/icarus/physical.nix
index 861bd8b0b..bd74c29f3 100644
--- a/lass/1systems/icarus/physical.nix
+++ b/lass/1systems/icarus/physical.nix
@@ -46,6 +46,15 @@
'';
services.thinkfan.enable = true;
+ services.thinkfan.levels = ''
+ (0, 0, 55)
+ (1, 48, 60)
+ (2, 50, 61)
+ (3, 52, 63)
+ (6, 60, 65)
+ (7, 80, 85)
+ (127, 90, 32767)
+ '';
services.logind.lidSwitch = "ignore";
services.logind.lidSwitchDocked = "ignore";
diff --git a/lass/1systems/mors/config.nix b/lass/1systems/mors/config.nix
index 03ff42132..fe0b6d85b 100644
--- a/lass/1systems/mors/config.nix
+++ b/lass/1systems/mors/config.nix
@@ -49,17 +49,17 @@ with import <stockholm/lib>;
];
}
{
- krebs.syncthing = {
- peers.schasch.addresses = [ "schasch.r:22000" ];
+ services.syncthing.declarative = {
+ devices.schasch.addresses = [ "schasch.r:22000" ];
folders = {
the_playlist = {
path = "/home/lass/tmp/the_playlist";
- peers = [ "mors" "phone" "prism" "xerxes" ];
+ devices = [ "mors" "phone" "prism" "xerxes" ];
};
free_music = {
id = "mu9mn-zgvsw";
path = "/home/lass/tmp/free_music";
- peers = [ "mors" "schasch" ];
+ devices = [ "mors" "schasch" ];
};
};
};
diff --git a/lass/1systems/prism/config.nix b/lass/1systems/prism/config.nix
index cde65ea6c..004183102 100644
--- a/lass/1systems/prism/config.nix
+++ b/lass/1systems/prism/config.nix
@@ -65,13 +65,6 @@ with import <stockholm/lib>;
config.krebs.users.makefu.pubkey
];
};
- users.users.nin = {
- uid = genid "nin";
- isNormalUser = true;
- openssh.authorizedKeys.keys = [
- config.krebs.users.nin.pubkey
- ];
- };
users.extraUsers.dritter = {
uid = genid_uint31 "dritter";
isNormalUser = true;
@@ -263,8 +256,6 @@ with import <stockholm/lib>;
}
{
users.users.download.openssh.authorizedKeys.keys = [
- "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDB0d0JA20Vqn7I4lCte6Ne2EOmLZyMJyS9yIKJYXNLjbLwkQ4AYoQKantPBkTxR75M09E7d3j5heuWnCjWH45TrfQfe1EOSSC3ppCI6C6aIVlaNs+KhAYZS0m2Y8WkKn+TT5JLEa8yybYVN/RlZPOilpj/1QgjU6CQK+eJ1k/kK+QFXcwN82GDVh5kbTVcKUNp2tiyxFA+z9LY0xFDg/JHif2ROpjJVLQBJ+YPuOXZN5LDnVcuyLWKThjxy5srQ8iDjoxBg7dwLHjby5Mv41K4W61Gq6xM53gDEgfXk4cQhJnmx7jA/pUnsn2ZQDeww3hcc7vRf8soogXXz2KC9maiq0M/svaATsa9Ul4hrKnqPZP9Q8ScSEAUX+VI+x54iWrnW0p/yqBiRAzwsczdPzaQroUFTBxrq8R/n5TFdSHRMX7fYNOeVMjhfNca/gtfw9dYBVquCvuqUuFiRc0I7yK44rrMjjVQRcAbw6F8O7+04qWCmaJ8MPlmApwu2c05VMv9hiJo5p6PnzterRSLCqF6rIdhSnuOwrUIt1s/V+EEZXHCwSaNLaQJnYL0H9YjaIuGz4c8kVzxw4c0B6nl+hqW5y5/B2cuHiumnlRIDKOIzlv8ufhh21iN7QpIsPizahPezGoT1XqvzeXfH4qryo8O4yTN/PWoA+f7o9POU7L6hQ== lhebendanz@nixos"
- config.krebs.users.palo.pubkey
];
}
{
@@ -338,30 +329,36 @@ with import <stockholm/lib>;
localAddress = "10.233.2.14";
};
- services.nginx.virtualHosts."lassul.us".locations."^~ /flix/".extraConfig = ''
- if ($scheme != "https") {
- rewrite ^ https://$host$request_uri permanent;
- }
- auth_basic "Restricted Content";
- auth_basic_user_file ${pkgs.writeText "flix-user-pass" ''
- krebs:$apr1$1Fwt/4T0$YwcUn3OBmtmsGiEPlYWyq0
- ''};
- proxy_pass http://10.233.2.14:80/;
- proxy_set_header Accept-Encoding "";
- sub_filter "https://lassul.us/" "https://lassul.us/flix/";
- sub_filter_once off;
- '';
- services.nginx.virtualHosts."lassul.us".locations."^~ /transmission".extraConfig = ''
- if ($scheme != "https") {
- rewrite ^ https://$host$request_uri permanent;
- }
- auth_basic "Restricted Content";
- auth_basic_user_file ${pkgs.writeText "transmission-user-pass" ''
- krebs:$apr1$1Fwt/4T0$YwcUn3OBmtmsGiEPlYWyq0
- ''};
- proxy_pass_header X-Transmission-Session-Id;
- proxy_pass http://10.233.2.14:9091;
- '';
+ services.nginx.virtualHosts."lassul.us" = {
+ locations."^~ /flix/".extraConfig = ''
+ if ($scheme != "https") {
+ rewrite ^ https://$host$request_uri permanent;
+ }
+ auth_basic "Restricted Content";
+ auth_basic_user_file ${pkgs.writeText "flix-user-pass" ''
+ krebs:$apr1$1Fwt/4T0$YwcUn3OBmtmsGiEPlYWyq0
+ ''};
+ proxy_pass http://10.233.2.14:80/;
+ proxy_set_header Accept-Encoding "";
+ sub_filter "https://lassul.us/" "https://lassul.us/flix/";
+ sub_filter_once off;
+ '';
+ locations."^~ /chatty/".extraConfig = ''
+ rewrite ^ https://$host/flix/$request_uri permanent;
+ '';
+ #locations."^~ /transmission".return = "301 https://$host/transmission/web/";
+ locations."^~ /transmission/".extraConfig = ''
+ if ($scheme != "https") {
+ rewrite ^ https://$host$request_uri permanent;
+ }
+ auth_basic "Restricted Content";
+ auth_basic_user_file ${pkgs.writeText "transmission-user-pass" ''
+ krebs:$apr1$1Fwt/4T0$YwcUn3OBmtmsGiEPlYWyq0
+ ''};
+ proxy_pass_header X-Transmission-Session-Id;
+ proxy_pass http://10.233.2.14:9091;
+ '';
+ };
users.groups.download = {};
users.users = {
@@ -376,6 +373,9 @@ with import <stockholm/lib>;
lass.pubkey
lass-android.pubkey
makefu.pubkey
+ palo.pubkey
+ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDB0d0JA20Vqn7I4lCte6Ne2EOmLZyMJyS9yIKJYXNLjbLwkQ4AYoQKantPBkTxR75M09E7d3j5heuWnCjWH45TrfQfe1EOSSC3ppCI6C6aIVlaNs+KhAYZS0m2Y8WkKn+TT5JLEa8yybYVN/RlZPOilpj/1QgjU6CQK+eJ1k/kK+QFXcwN82GDVh5kbTVcKUNp2tiyxFA+z9LY0xFDg/JHif2ROpjJVLQBJ+YPuOXZN5LDnVcuyLWKThjxy5srQ8iDjoxBg7dwLHjby5Mv41K4W61Gq6xM53gDEgfXk4cQhJnmx7jA/pUnsn2ZQDeww3hcc7vRf8soogXXz2KC9maiq0M/svaATsa9Ul4hrKnqPZP9Q8ScSEAUX+VI+x54iWrnW0p/yqBiRAzwsczdPzaQroUFTBxrq8R/n5TFdSHRMX7fYNOeVMjhfNca/gtfw9dYBVquCvuqUuFiRc0I7yK44rrMjjVQRcAbw6F8O7+04qWCmaJ8MPlmApwu2c05VMv9hiJo5p6PnzterRSLCqF6rIdhSnuOwrUIt1s/V+EEZXHCwSaNLaQJnYL0H9YjaIuGz4c8kVzxw4c0B6nl+hqW5y5/B2cuHiumnlRIDKOIzlv8ufhh21iN7QpIsPizahPezGoT1XqvzeXfH4qryo8O4yTN/PWoA+f7o9POU7L6hQ== lhebendanz@nixos"
+ "AAAAB3NzaC1yc2EAAAADAQABAAABgQC4ECL9NSCWqs4KVe+FF+2BPtl5Bv5aQPHqnXllCyiESZykwRKLx6/AbF5SbUAUMVZtp9oDSdp28m3BvVeWJ/q7hAbIxUtfd/jp+JBRZ8Kj6K5GzUO7Bhgl/o0A7xEjAeOKHiYuLjdPMcFUyl6Ah4ey/mcQYf6AdU0+hYUDeUlKe/YxxYD6202W0GJq2xGdIqs/TbopT9iaX+sv0wdXDVfFY72nFqOUwJW3u6O2viKKRugrz/eo50Eo3ts7pYz/FpDXExrUvV9Vu/bQ34pa8nKgF3/AKQHgmzljNQSVZKyAV8OY0UFonjBMXCBg2tXtwfnlzdx2SyuQVv55x+0AuRKsi85G2xLpXu1A3921pseBTW6Q6kbYK9eqxAay2c/kNbwNqFnO+nCvQ6Ier/hvGddOtItMu96IuU2E7mPN6WgvM8/3fjJRFWnZxFxqu/k7iH+yYT8qwRgdiSqZc76qvkYEuabdk2itstTRY0A3SpI3hFMZDw/7bxgMZtqpfyoRk5s= philip@shiki11:15 <Profpatsch> AAAAB3NzaC1yc2EAAAADAQABAAABgQC4ECL9NSCWqs4KVe+FF+2BPtl5Bv5aQPHqnXllCyiESZykwRKLx6/AbF5SbUAUMVZtp9oDSdp28m3BvVeWJ/q7hAbIxUtfd/jp+JBRZ8Kj6K5GzUO7Bhgl/o0A7xEjAeOKHiYuLjdPMcFUyl6Ah4ey/mcQYf6AdU0+hYUDeUlKe/YxxYD6202W0GJq2xGdIqs/TbopT9iaX+sv0wdXDVfFY72nFqOUwJW3u6O2viKKRugrz/eo50Eo3ts7pYz/FpDXExrUvV9Vu/bQ34pa8nKgF3/AKQHgmzljNQSVZKyAV8OY0UFonjBMXCBg2tXtwfnlzdx2SyuQVv55x+0AuRKsi85G2xLpXu1A3921pseBTW6Q6kbYK9eqxAay2c/kNbwNqFnO+nCvQ6Ier/hvGddOtItMu96IuU2E7mPN6WgvM8/3fjJRFWnZxFxqu/k7iH+yYT8qwRgdiSqZc76qvkYEuabdk2itstTRY0A3SpI3hFMZDw/7bxgMZtqpfyoRk5s= philip@shiki"
];
};
};
diff --git a/lass/1systems/shodan/config.nix b/lass/1systems/shodan/config.nix
index 9bb31191c..831e03f79 100644
--- a/lass/1systems/shodan/config.nix
+++ b/lass/1systems/shodan/config.nix
@@ -19,7 +19,9 @@ with import <stockholm/lib>;
<stockholm/lass/2configs/ssh-cryptsetup.nix>
<stockholm/lass/2configs/nfs-dl.nix>
<stockholm/lass/2configs/gg23.nix>
+ <stockholm/lass/2configs/hass>
<stockholm/lass/2configs/br.nix>
+ <stockholm/lass/2configs/fetchWallpaper.nix>
];
krebs.build.host = config.krebs.hosts.shodan;
diff --git a/lass/1systems/uriel/config.nix b/lass/1systems/uriel/config.nix
index 3eddcfc52..b50dc63f5 100644
--- a/lass/1systems/uriel/config.nix
+++ b/lass/1systems/uriel/config.nix
@@ -12,6 +12,7 @@ with import <stockholm/lib>;
i18n.defaultLocale ="de_DE.UTF-8";
time.timeZone = "Europe/Berlin";
services.xserver.enable = true;
+ services.xserver.libinput.enable = false;
users.users.locke = {
uid = genid "locke";
home = "/home/locke";
diff --git a/lass/1systems/xerxes/config.nix b/lass/1systems/xerxes/config.nix
index 8630d0f4b..e4a4fb505 100644
--- a/lass/1systems/xerxes/config.nix
+++ b/lass/1systems/xerxes/config.nix
@@ -41,11 +41,11 @@
displayManager.lightdm.autoLogin.user = "lass";
};
- krebs.syncthing = {
+ services.syncthing.declarative = {
folders = {
the_playlist = {
path = "/home/lass/tmp/the_playlist";
- peers = [ "mors" "phone" "prism" "xerxes" ];
+ devices = [ "mors" "phone" "prism" "xerxes" ];
};
};
};
diff --git a/lass/1systems/yellow/config.nix b/lass/1systems/yellow/config.nix
index abbc0045b..82fe3fac5 100644
--- a/lass/1systems/yellow/config.nix
+++ b/lass/1systems/yellow/config.nix
@@ -54,12 +54,107 @@ with import <stockholm/lib>;
root = "/var/download/finished";
extraConfig = ''
fancyindex on;
- dav_methods PUT DELETE MKCOL COPY MOVE;
-
+ fancyindex_footer "/fancy.html";
+ include ${pkgs.nginx}/conf/mime.types;
+ include ${pkgs.writeText "extrMime" ''
+ types {
+ video/webm mkv;
+ }
+ ''};
create_full_put_path on;
- dav_access all:r;
'';
};
+ locations."/chatty" = {
+ proxyPass = "http://localhost:3000";
+ extraConfig = ''
+ rewrite /chatty/(.*) /$1 break;
+ proxy_set_header Host $host;
+ '';
+ };
+ locations."= /fancy.html".extraConfig = ''
+ alias ${pkgs.writeText "nginx_footer" ''
+ <div id="mydiv">
+ <!-- Include a header DIV with the same name as the draggable DIV, followed by "header" -->
+ <div id="mydivheader">Click here to move</div>
+ <iframe src="/chatty/index.html"></iframe>
+ </div>
+ <style>
+ #mydiv {
+ position: absolute;
+ z-index: 9;
+ background-color: #f1f1f1;
+ border: 1px solid #d3d3d3;
+ text-align: center;
+ }
+
+ #mydivheader {
+ padding: 10px;
+ cursor: move;
+ z-index: 10;
+ background-color: #2196F3;
+ color: #fff;
+ }
+ </style>
+ <script>
+ // Make the DIV element draggable:
+ dragElement(document.getElementById("mydiv"));
+
+ function dragElement(elmnt) {
+ var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
+ if (document.getElementById(elmnt.id + "header")) {
+ // if present, the header is where you move the DIV from:
+ document.getElementById(elmnt.id + "header").onmousedown = dragMouseDown;
+ } else {
+ // otherwise, move the DIV from anywhere inside the DIV:
+ elmnt.onmousedown = dragMouseDown;
+ }
+
+ function dragMouseDown(e) {
+ e = e || window.event;
+ e.preventDefault();
+ // get the mouse cursor position at startup:
+ pos3 = e.clientX;
+ pos4 = e.clientY;
+ document.onmouseup = closeDragElement;
+ // call a function whenever the cursor moves:
+ document.onmousemove = elementDrag;
+ }
+
+ function elementDrag(e) {
+ e = e || window.event;
+ e.preventDefault();
+ // calculate the new cursor position:
+ pos1 = pos3 - e.clientX;
+ pos2 = pos4 - e.clientY;
+ pos3 = e.clientX;
+ pos4 = e.clientY;
+ // set the element's new position:
+ elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
+ elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
+ }
+
+ function closeDragElement() {
+ // stop moving when mouse button is released:
+ document.onmouseup = null;
+ document.onmousemove = null;
+ }
+ }
+ </script>
+ ''};
+ '';
+ };
+ };
+
+ systemd.services.bruellwuerfel = {
+ wantedBy = [ "multi-user.target" ];
+ environment = {
+ IRC_CHANNEL = "#flix";
+ IRC_NICK = "bruelli";
+ IRC_SERVER = "irc.r";
+ IRC_HISTORY_FILE = "/tmp/bruelli.history";
+ };
+ serviceConfig = {
+ ExecStart = "${pkgs.bruellwuerfel}/bin/bruellwuerfel";
};
};
diff --git a/lass/2configs/baseX.nix b/lass/2configs/baseX.nix
index 52d694c46..b3340cb31 100644
--- a/lass/2configs/baseX.nix
+++ b/lass/2configs/baseX.nix
@@ -71,12 +71,14 @@ in {
gitAndTools.qgit
git-preview
gnome3.dconf
+ iodine
lm_sensors
ncdu
nix-index
nix-review
nmap
pavucontrol
+ ponymix
powertop
rxvt_unicode-with-plugins
sxiv
diff --git a/lass/2configs/blue.nix b/lass/2configs/blue.nix
index aad8411b1..a4000cada 100644
--- a/lass/2configs/blue.nix
+++ b/lass/2configs/blue.nix
@@ -19,6 +19,7 @@ with (import <stockholm/lib>);
];
services.tor.enable = true;
+ services.tor.client.enable = true;
krebs.iptables.tables.filter.INPUT.rules = [
{ predicate = "-i retiolum -p udp --dport 60000:61000"; target = "ACCEPT";}
diff --git a/lass/2configs/exim-smarthost.nix b/lass/2configs/exim-smarthost.nix
index 565608633..82839beba 100644
--- a/lass/2configs/exim-smarthost.nix
+++ b/lass/2configs/exim-smarthost.nix
@@ -102,9 +102,19 @@
"microsoft@lassul.us"
"stickers@lassul.us"
"nextbike@lassul.us"
+ "mytello@lassul.us"
+ "camp@lassul.us"
+ "urlwatch@lassul.us"
+ "lidl@lassul.us"
+ "geizhals@lassul.us"
+ "auschein@lassul.us"
+ "tleech@lassul.us"
+ "durstexpress@lassul.us"
];
in {
+ environment.systemPackages = [ pkgs.review-mail-queue ];
+
krebs.exim-smarthost = {
enable = true;
dkim = [
diff --git a/lass/2configs/gg23.nix b/lass/2configs/gg23.nix
index b23494b28..3d4c1e306 100644
--- a/lass/2configs/gg23.nix
+++ b/lass/2configs/gg23.nix
@@ -20,12 +20,13 @@ with import <stockholm/lib>;
}
'';
machines = [
- { ethernetAddress = "c8:3d:d4:2c:40:ae"; hostName = "tv"; ipAddress = "10.42.0.3"; }
+ { ethernetAddress = "a8:a6:48:65:ce:4c"; hostName = "tv"; ipAddress = "10.42.0.3"; }
{ ethernetAddress = "3c:2a:f4:22:28:37"; hostName = "drucker"; ipAddress = "10.42.0.4"; }
- { ethernetAddress = "80:7d:3a:67:b7:01"; hostName = "s20-bett"; ipAddress = "10.42.0.10"; }
+ { ethernetAddress = "80:7d:3a:67:b7:01"; hostName = "s20-tv"; ipAddress = "10.42.0.10"; }
{ ethernetAddress = "80:7d:3a:68:04:f0"; hostName = "s20-drucker"; ipAddress = "10.42.0.11"; }
- { ethernetAddress = "80:7d:3a:68:11:a5"; hostName = "s20-kueche"; ipAddress = "10.42.0.12"; }
+ { ethernetAddress = "80:7d:3a:68:11:a5"; hostName = "s20-wasch"; ipAddress = "10.42.0.12"; }
{ ethernetAddress = "80:7d:3a:67:bb:69"; hostName = "s20-stereo"; ipAddress = "10.42.0.13"; }
+ { ethernetAddress = "ec:b5:fa:07:78:16"; hostName = "hue-bridge"; ipAddress = "10.42.0.21"; }
{ ethernetAddress = "80:8d:b7:c5:80:dc"; hostName = "arubaAP"; ipAddress = "10.42.0.99"; }
];
};
@@ -45,9 +46,6 @@ with import <stockholm/lib>;
boot.kernel.sysctl."net.ipv4.ip_forward" = 1;
krebs.iptables.tables.filter.INPUT.rules = [
- { predicate = "-i int0 -p tcp --dport 8123"; target = "ACCEPT"; } # hass
- { predicate = "-i retiolum -p tcp --dport 8123"; target = "ACCEPT"; } # hass
- { predicate = "-i int0 -p tcp --dport 1883"; target = "ACCEPT"; } # mosquitto
{ predicate = "-i int0 -p udp --dport 53"; target = "ACCEPT"; } # dns
];
krebs.iptables.tables.filter.FORWARD.rules = [
@@ -62,72 +60,5 @@ with import <stockholm/lib>;
krebs.iptables.tables.nat.POSTROUTING.rules = [
{ v6 = false; predicate = "-s 10.42.0.0/24 ! -d 10.42.0.0/24"; target = "MASQUERADE"; }
];
-
- services.home-assistant = let
- tasmota_s20 = name: topic: {
- platform = "mqtt";
- inherit name;
- state_topic = "stat/${topic}/POWER";
- command_topic = "cmnd/${topic}/POWER";
- payload_on = "ON";
- payload_off = "OFF";
- };
- in {
- enable = true;
- package = pkgs.home-assistant.override {
- #extraComponents = [
- # (pkgs.fetchgit {
- # url = "https://github.com/marcschumacher/dwd_pollen";
- # rev = "0.1";
- # sha256 = "12vldwsds27c9l15ffc6svk9mj17jhypcz736pvpmpqbsymllz2p";
- # })
- #];
- };
- config = {
- homeassistant = {
- name = "Home"; time_zone = "Europe/Berlin";
- latitude = "48.7687";
- longitude = "9.2478";
- elevation = 247;
- };
- sun.elevation = 66;
- discovery = {};
- frontend = { };
- mqtt = {
- broker = "localhost";
- port = 1883;
- client_id = "home-assistant";
- username = "gg23";
- password = "gg23-mqtt";
- keepalive = 60;
- protocol = 3.1;
- };
- sensor = [
- ];
- switch = [
- (tasmota_s20 "Drucker Strom" "drucker")
- (tasmota_s20 "Bett Licht" "bett")
- (tasmota_s20 "Kueche Licht" "kueche")
- ];
- device_tracker = [
- {
- platform = "luci";
- }
- ];
- };
- };
-
- services.mosquitto = {
- enable = true;
- host = "0.0.0.0";
- allowAnonymous = false;
- checkPasswords = true;
- users.gg23 = {
- password = "gg23-mqtt";
- acl = [ "topic readwrite #" ];
- };
- };
- environment.systemPackages = [ pkgs.mosquitto ];
-
}
diff --git a/lass/2configs/green-host.nix b/lass/2configs/green-host.nix
index 1421eede7..0cccbc30e 100644
--- a/lass/2configs/green-host.nix
+++ b/lass/2configs/green-host.nix
@@ -20,7 +20,7 @@ with import <stockholm/lib>;
}
];
- krebs.syncthing.folders."/var/lib/sync-containers".peers = [ "icarus" "skynet" "littleT" "shodan" ];
+ services.syncthing.declarative.folders."/var/lib/sync-containers".devices = [ "icarus" "skynet" "littleT" "shodan" ];
krebs.permown."/var/lib/sync-containers" = {
owner = "root";
group = "syncthing";
diff --git a/lass/2configs/hass/default.nix b/lass/2configs/hass/default.nix
new file mode 100644
index 000000000..ef9361102
--- /dev/null
+++ b/lass/2configs/hass/default.nix
@@ -0,0 +1,86 @@
+{ config, lib, pkgs, ... }:
+{
+ imports = [
+ ./zigbee.nix
+ ./rooms/bett.nix
+ ];
+
+ krebs.iptables.tables.filter.INPUT.rules = [
+ { predicate = "-i int0 -p tcp --dport 1883"; target = "ACCEPT"; } # mosquitto
+ { predicate = "-i docker0 -p tcp --dport 1883"; target = "ACCEPT"; } # mosquitto
+ { predicate = "-i int0 -p tcp --dport 8123"; target = "ACCEPT"; } # hass
+ { predicate = "-i retiolum -p tcp --dport 8123"; target = "ACCEPT"; } # hass
+ ];
+
+ services.home-assistant = {
+ enable = true;
+ package = pkgs.home-assistant.override {
+ # extraComponents = [ "hue" ];
+ };
+ configWritable = true;
+ };
+
+ lass.hass.config = let
+ tasmota_s20 = name: topic: {
+ platform = "mqtt";
+ inherit name;
+ state_topic = "stat/${topic}/POWER";
+ command_topic = "cmnd/${topic}/POWER";
+ payload_on = "ON";
+ payload_off = "OFF";
+ };
+ in {
+ homeassistant = {
+ name = "Home";
+ time_zone = "Europe/Berlin";
+ latitude = "48.7687";
+ longitude = "9.2478";
+ elevation = 247;
+ };
+ config = {};
+ sun.elevation = 66;
+ discovery = {};
+ frontend = {};
+ mqtt = {
+ broker = "localhost";
+ port = 1883;
+ client_id = "home-assistant";
+ username = "gg23";
+ password = "gg23-mqtt";
+ keepalive = 60;
+ protocol = 3.1;
+
+ discovery = true;
+ birth_message = {
+ topic = "/hass/status";
+ payload = "online";
+ };
+ will_message = {
+ topic = "/hass/status";
+ payload = "offline";
+ };
+ };
+ sensor = [
+ ];
+ switch = [
+ (tasmota_s20 "TV" "tv")
+ (tasmota_s20 "Drucker Strom" "drucker")
+ (tasmota_s20 "Waschmaschine" "wasch")
+ (tasmota_s20 "Stereo Anlage" "stereo")
+ ];
+ mobile_app = {};
+ };
+
+ services.mosquitto = {
+ enable = true;
+ host = "0.0.0.0";
+ allowAnonymous = false;
+ checkPasswords = true;
+ users.gg23 = {
+ password = "gg23-mqtt";
+ acl = [ "topic readwrite #" ];
+ };
+ };
+
+ environment.systemPackages = [ pkgs.mosquitto ];
+}
diff --git a/lass/2configs/hass/lib.nix b/lass/2configs/hass/lib.nix
new file mode 100644
index 000000000..c69f5e887
--- /dev/null
+++ b/lass/2configs/hass/lib.nix
@@ -0,0 +1,83 @@
+{
+ lights = {
+ bett = "light.0x0017880106ed3bd8_light";
+ essen = "light.0x0017880108327622_light";
+ arbeit = "light.0x0017880106ee2865_light";
+ nass = "light.0x00178801082e9f2f_light";
+ };
+
+ sensors = {
+ bett = "0x00178801086ac38c";
+ };
+
+ lightswitch = switch: light: {
+ automation = [
+ {
+ trigger = {
+ platform = "mqtt";
+ topic = "zigbee/${switch}";
+ };
+ condition = {
+ condition = "or";
+ conditions = [
+ {
+ condition = "template";
+ value_template = "{{ trigger.payload_json.action == 'on-press' }}";
+ }
+ {
+ condition = "template";
+ value_template = "{{ trigger.payload_json.action == 'up-press' }}";
+ }
+ {
+ condition = "and";
+ conditions = [
+ {
+ condition = "template";
+ value_template = "{{ trigger.payload_json.action == 'down-press' }}";
+ }
+ {
+ condition = "template";
+ value_template = "{{ trigger.payload_json.brightness > 30 }}";
+ }
+ ];
+ }
+ ];
+ };
+ action = [
+ {
+ service = "light.turn_on";
+ data_template = {
+ entity_id = light;
+ brightness = "{{ trigger.payload_json.brightness }}";
+ };
+ }
+ ];
+ }
+ {
+ trigger = {
+ platform = "mqtt";
+ topic = "zigbee/${switch}";
+ };
+ condition = {
+ condition = "or";
+ conditions = [
+ {
+ condition = "template";
+ value_template = "{{ trigger.payload_json.action == 'off-press' }}";
+ }
+ {
+ condition = "template";
+ value_template = "{{ trigger.payload_json.brightness < 30 }}";
+ }
+ ];
+ };
+ action = {
+ service = "light.turn_off";
+ data_template = {
+ entity_id = light;
+ };
+ };
+ }
+ ];
+ };
+}
diff --git a/lass/2configs/hass/rooms/bett.nix b/lass/2configs/hass/rooms/bett.nix
new file mode 100644
index 000000000..21092ef5f
--- /dev/null
+++ b/lass/2configs/hass/rooms/bett.nix
@@ -0,0 +1,27 @@
+{ lib, ... }:
+with import ../lib.nix;
+
+{
+ lass.hass.config = lib.lists.fold lib.recursiveUpdate {} [
+ {
+ #automation = [{
+ # trigger = {
+ # platform = "mqtt";
+ # topic = "zigbee/0x00178801086ac38c/action";
+ # payload = "on-press";
+ # };
+ # action = {
+ # service = "light.turn_on";
+ # data = {
+ # brightness = 150;
+ # rgb_color = [ 255 0 0 ];
+ # entity_id = [
+ # "light.0x0017880108327622_light"
+ # ];
+ # };
+ # };
+ #}];
+ }
+ (lightswitch sensors.bett lights.bett)
+ ];
+}
diff --git a/lass/2configs/hass/zigbee.nix b/lass/2configs/hass/zigbee.nix
new file mode 100644
index 000000000..4d57f9ca4
--- /dev/null
+++ b/lass/2configs/hass/zigbee.nix
@@ -0,0 +1,152 @@
+{config, pkgs, lib, ...}: let
+
+ zigbee2mqtt_cfg = pkgs.writeText "zigbee2mqtt.json" (builtins.toJSON {
+ homeassistant = true;
+ permit_join = true;
+ mqtt = {
+ discovery = true;
+ base_topic = "zigbee";
+ server = "mqtt://10.42.0.1";
+ user = "gg23";
+ password = "gg23-mqtt";
+ };
+ serial.port = "/dev/cc2531";
+ });
+
+in {
+ # symlink the zigbee controller
+ services.udev.extraRules = ''
+ SUBSYSTEM=="tty", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", SYMLINK+="cc2531", MODE="0660", GROUP="dailout"
+ '';
+
+ system.activationScripts.installZigbee = ''
+ install -d /var/lib/zigbee2mqtt
+ install ${zigbee2mqtt_cfg} /var/lib/zigbee2mqtt/configuration.yaml
+ '';
+
+ # 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"];
+ };
+
+ lass.hass.config = {
+ sensor = [
+ # Sensor for monitoring the bridge state
+ {
+ platform = "mqtt";
+ name = "Zigbee2mqtt Bridge state";
+ state_topic = "/zigbee/bridge/state";
+ icon = "mdi:router-wireless";
+ }
+ # Sensor for Showing the Zigbee2mqtt Version
+ {
+ platform = "mqtt";
+ name = "Zigbee2mqtt Version";
+ state_topic = "/zigbee/bridge/config";
+ value_template = "{{ value_json.version }}";
+ icon = "mdi:zigbee";
+ }
+ # Sensor for Showing the Coordinator Version
+ {
+ platform = "mqtt";
+ name = "Coordinator Version";
+ state_topic = "/zigbee/bridge/config";
+ value_template = "{{ value_json.coordinator }}";
+ icon = "mdi:chip";
+ }
+ ];
+ switch = [
+ {
+ platform = "mqtt";
+ name = "Zigbee2mqtt Main join";
+ state_topic = "/zigbee/bridge/config/permit_join";
+ command_topic = "/zigbee/bridge/config/permit_join";
+ payload_on = "true";
+ payload_off = "false";
+ }
+ ];
+ automation = [
+ {
+ alias = "Zigbee2mqtt Log Level";
+ initial_state = "on";
+ trigger = {
+ platform = "state";
+ entity_id = "input_select.zigbee2mqtt_log_level";
+ };
+ action = [
+ {
+ service = "mqtt.publish";
+ data = {
+ payload_template = "{{ states('input_select.zigbee2mqtt_log_level') }}";
+ topic = "/zigbee/bridge/config/log_level";
+ };
+ }
+ ];
+ }
+ # Automation to start timer when enable join is turned on
+ {
+ id = "zigbee_join_enabled";
+ alias = "Zigbee Join Enabled";
+ hide_entity = "true";
+ trigger = {
+ platform = "state";
+ entity_id = "switch.zigbee2mqtt_main_join";
+ to = "on";
+ };
+ action = {
+ service = "timer.start";
+ entity_id = "timer.zigbee_permit_join";
+ };
+ }
+ # Automation to stop timer when switch turned off and turn off switch when timer finished
+ {
+ id = "zigbee_join_disabled";
+ alias = "Zigbee Join Disabled";
+ hide_entity = "true";
+ trigger = [
+ {
+ platform = "event";
+ event_type = "timer.finished";
+ event_data.entity_id = "timer.zigbee_permit_join";
+ }
+ {
+ platform = "state";
+ entity_id = "switch.zigbee2mqtt_main_join";
+ to = "off";
+ }
+ ];
+ action = [
+ { service = "timer.cancel";
+ data.entity_id = "timer.zigbee_permit_join";
+ }
+ { service = "switch.turn_off";
+ entity_id = "switch.zigbee2mqtt_main_join";
+ }
+ ];
+ }
+ ];
+ input_select.zigbee2mqtt_log_level = {
+ name = "Zigbee2mqtt Log Level";
+ options = [
+ "debug"
+ "info"
+ "warn"
+ "error"
+ ];
+ initial = "info";
+ icon = "mdi:format-list-bulleted";
+ };
+
+ timer.zigbee_permit_join = {
+ name = "Zigbee Time remaining";
+ duration = 120;
+ };
+ };
+}
+
diff --git a/lass/2configs/mpv.nix b/lass/2configs/mpv.nix
index 7dc43a9ee..5d7bfed60 100644
--- a/lass/2configs/mpv.nix
+++ b/lass/2configs/mpv.nix
@@ -12,14 +12,17 @@ let
video_filename = sys.argv[1]
vid = scan_video(video_filename)
- sub = download_best_subtitles([vid], {Language('eng')})[vid][0]
+ try:
+ sub = download_best_subtitles([vid], {Language('eng')})[vid][0]
- filename = '/tmp/' + vid.title + '.srt'
+ filename = '/tmp/' + vid.title + '.srt'
- with open(filename, 'wb+') as file:
- file.write(sub.content)
+ with open(filename, 'wb+') as file:
+ file.write(sub.content)
- print(filename)
+ print(filename)
+ except: # noqa
+ print("/dev/null")
'';
autosub = pkgs.writeText "autosub.lua" ''
@@ -70,7 +73,6 @@ let
download()
end
- mp.register_event('file-loaded', control_download)
mp.add_key_binding('S', "download_subs", download)
'';
@@ -79,7 +81,6 @@ let
paths = [
(pkgs.writeDashBin "mpv" ''
exec ${pkgs.mpv}/bin/mpv --no-config --script=${autosub} "$@"
- # exec ${pkgs.mpv}/bin/mpv --no-config "$@"
'')
pkgs.mpv
];
diff --git a/lass/2configs/network-manager.nix b/lass/2configs/network-manager.nix
index ab27eb841..75b9bd1fd 100644
--- a/lass/2configs/network-manager.nix
+++ b/lass/2configs/network-manager.nix
@@ -26,7 +26,11 @@
users.users.mainUser = {
extraGroups = [ "networkmanager" ];
packages = with pkgs; [
- gnome3.gnome_keyring gnome3.dconf
+ gnome3.gnome_keyring
+ gnome3.dconf
];
};
+ environment.systemPackages = [
+ pkgs.nm-dmenu
+ ];
}
diff --git a/lass/2configs/radio.nix b/lass/2configs/radio.nix
index b24d7af3e..6245691fe 100644
--- a/lass/2configs/radio.nix
+++ b/lass/2configs/radio.nix
@@ -9,20 +9,76 @@ let
admin-password = import <secrets/icecast-admin-pw>;
source-password = import <secrets/icecast-source-pw>;
+ music_dir = "/home/radio/music";
+
add_random = pkgs.writeDashBin "add_random" ''
- ${pkgs.mpc_cli}/bin/mpc add "$(${pkgs.mpc_cli}/bin/mpc ls the_playlist/music | grep '\.ogg$' | shuf -n1)"
+ ${pkgs.mpc_cli}/bin/mpc add "$(${pkgs.findutils}/bin/find "${music_dir}/the_playlist" | grep -v '/other/' | grep '\.ogg$' | shuf -n1 | sed 's,${music_dir}/,,')"
'';
- skip_track = pkgs.writeDashBin "skip_track" ''
+ skip_track = pkgs.writeBashBin "skip_track" ''
+ set -eu
+
${add_random}/bin/add_random
- echo skipping: "$(${print_current}/bin/print_current)"
+ music_dir=${escapeShellArg music_dir}
+ current_track=$(${pkgs.mpc_cli}/bin/mpc current -f %file%)
+ track_infos=$(${print_current}/bin/print_current)
+ skip_count=$(${pkgs.attr}/bin/getfattr -n user.skip_count --only-values "$music_dir"/"$current_track" || echo 0)
+ if [[ "$current_track" =~ ^the_playlist/music/.* ]] && [ "$skip_count" -le 2 ]; then
+ skip_count=$((skip_count+1))
+ ${pkgs.attr}/bin/setfattr -n user.skip_count -v "$skip_count" "$music_dir"/"$current_track"
+ echo skipping: "$track_infos" skip_count: "$skip_count"
+ else
+ mkdir -p "$music_dir"/.graveyard/
+ mv "$music_dir"/"$current_track" "$music_dir"/.graveyard/
+ echo killing: "$track_infos"
+ fi
${pkgs.mpc_cli}/bin/mpc -q next
'';
+ good_track = pkgs.writeBashBin "good_track" ''
+ set -eu
+
+ music_dir=${escapeShellArg music_dir}
+ current_track=$(${pkgs.mpc_cli}/bin/mpc current -f %file%)
+ track_infos=$(${print_current}/bin/print_current)
+ if [[ "$current_track" =~ ^the_playlist/music/.* ]]; then
+ ${pkgs.attr}/bin/setfattr -n user.skip_count -v 0 "$music_dir"/"$current_track"
+ else
+ mv "$music_dir"/"$current_track" "$music_dir"/the_playlist/music/ || :
+ fi
+ echo good: "$track_infos"
+ '';
+
+ track_youtube_link = pkgs.writeDash "track_youtube_link" ''
+ ${pkgs.mpc_cli}/bin/mpc current -f %file% \
+ | ${pkgs.gnused}/bin/sed 's@.*\(.\{11\}\)\.ogg@https://www.youtube.com/watch?v=\1@'
+ '';
+
print_current = pkgs.writeDashBin "print_current" ''
echo "$(${pkgs.mpc_cli}/bin/mpc current -f %file%) \
- $(${pkgs.mpc_cli}/bin/mpc current -f %file% \
- | ${pkgs.gnused}/bin/sed 's@.*\(.\{11\}\)\.ogg@http://www.youtube.com/watch?v=\1@')"
+ $(${track_youtube_link})"
+ '';
+
+ print_current_json = pkgs.writeDashBin "print_current_json" ''
+ ${pkgs.jq}/bin/jq -n -c \
+ --arg name "$(${pkgs.mpc_cli}/bin/mpc current)" \
+ --arg filename "$(${pkgs.mpc_cli}/bin/mpc current -f %file%)" \
+ --arg youtube "$(${track_youtube_link})" '{
+ name: $name,
+ filename: $filename,
+ youtube: $youtube
+ }'
+ '';
+
+ write_to_irc = pkgs.writeDash "write_to_irc" ''
+ ${pkgs.curl}/bin/curl -fsSv --unix-socket /home/radio/reaktor.sock http://z/ \
+ -H content-type:application/json \
+ -d "$(${pkgs.jq}/bin/jq -n \
+ --arg text "$1" '{
+ command:"PRIVMSG",
+ params:["#the_playlist",$text]
+ }'
+ )"
'';
in {
@@ -48,8 +104,10 @@ in {
krebs.per-user.${name}.packages = with pkgs; [
add_random
+ good_track
skip_track
print_current
+ print_current_json
ncmpcpp
mpc_cli
];
@@ -57,7 +115,7 @@ in {
services.mpd = {
enable = true;
group = "radio";
- musicDirectory = "/home/radio/music";
+ musicDirectory = "${music_dir}";
extraConfig = ''
log_level "default"
auto_update "yes"
@@ -115,6 +173,7 @@ in {
tables = {
filter.INPUT.rules = [
{ predicate = "-p tcp --dport 8000"; target = "ACCEPT"; }
+ { predicate = "-i retiolum -p tcp --dport 8001"; target = "ACCEPT"; }
];
};
};
@@ -164,6 +223,7 @@ in {
done | while read track; do
echo "$(date -Is)" "$track" | tee -a "$HISTORY_FILE"
echo "$(tail -$LIMIT "$HISTORY_FILE")" > "$HISTORY_FILE"
+ ${write_to_irc} "playing: $track"
done
'';
in {
@@ -175,14 +235,20 @@ in {
serviceConfig = {
ExecStart = recentlyPlayed;
+ User = "radio";
};
};
+ # allow reaktor2 to modify files
+ systemd.services."reaktor2-the_playlist".serviceConfig.DynamicUser = mkForce false;
+
krebs.reaktor2.the_playlist = {
hostname = "irc.freenode.org";
port = "6697";
useTLS = true;
nick = "the_playlist";
+ username = "radio";
+ API.listen = "unix:/home/radio/reaktor.sock";
plugins = [
{
plugin = "register";
@@ -199,12 +265,19 @@ in {
workdir = config.krebs.reaktor2.the_playlist.stateDir;
hooks.PRIVMSG = [
{
- #activate = "match";
- pattern = "^\\s*([0-9A-Za-z._][0-9A-Za-z._-]*)(?:\\s+(.*\\S))?\\s*$";
+ activate = "match";
+ pattern = "^(?:.*\\s)?\\s*the_playlist:\\s*([0-9A-Za-z._][0-9A-Za-z._-]*)(?:\\s+(.*\\S))?\\s*$";
command = 1;
arguments = [2];
commands = {
skip.filename = "${skip_track}/bin/skip_track";
+ next.filename = "${skip_track}/bin/skip_track";
+ bad.filename = "${skip_track}/bin/skip_track";
+
+ good.filename = "${good_track}/bin/good_track";
+ nice.filename = "${good_track}/bin/good_track";
+ like.filename = "${good_track}/bin/good_track";
+
current.filename = "${print_current}/bin/print_current";
suggest.filename = pkgs.writeDash "suggest" ''
echo "$@" >> playlist_suggest
@@ -217,6 +290,42 @@ in {
];
};
+ krebs.htgen.radio = {
+ port = 8001;
+ user = {
+ name = "radio";
+ };
+ script = ''
+ case "$Method $Request_URI" in
+ "GET /current")
+ printf 'HTTP/1.1 200 OK\r\n'
+ printf 'Connection: close\r\n'
+ printf '\r\n'
+ ${print_current_json}/bin/print_current_json
+ exit
+ ;;
+ "POST /skip")
+ printf 'HTTP/1.1 200 OK\r\n'
+ printf 'Connection: close\r\n'
+ printf '\r\n'
+ msg=$(${skip_track}/bin/skip_track)
+ ${write_to_irc} "$msg"
+ echo "$msg"
+ exit
+ ;;
+ "POST /good")
+ printf 'HTTP/1.1 200 OK\r\n'
+ printf 'Connection: close\r\n'
+ printf '\r\n'
+ msg=$(${good_track}/bin/good_track)
+ ${write_to_irc} "$msg"
+ echo "$msg"
+ exit
+ ;;
+ esac
+ '';
+ };
+
services.nginx = {
enable = true;
virtualHosts."radio.lassul.us" = {
@@ -258,9 +367,9 @@ in {
alias ${html};
'';
};
- krebs.syncthing.folders."the_playlist" = {
+ services.syncthing.declarative.folders."the_playlist" = {
path = "/home/radio/music/the_playlist";
- peers = [ "mors" "phone" "prism" "xerxes" ];
+ devices = [ "mors" "phone" "prism" "xerxes" ];
};
krebs.permown."/home/radio/music/the_playlist" = {
owner = "radio";
diff --git a/lass/2configs/sync/decsync.nix b/lass/2configs/sync/decsync.nix
index c3f6511c2..9caefdd2d 100644
--- a/lass/2configs/sync/decsync.nix
+++ b/lass/2configs/sync/decsync.nix
@@ -1,7 +1,7 @@
{
- krebs.syncthing.folders.decsync = {
+ services.syncthing.declarative.folders.decsync = {
path = "/home/lass/decsync";
- peers = [ "mors" "blue" "green" "phone" ];
+ devices = [ "mors" "blue" "green" "phone" ];
};
krebs.permown."/home/lass/decsync" = {
owner = "lass";
diff --git a/lass/2configs/sync/weechat.nix b/lass/2configs/sync/weechat.nix
index 30c7b262b..ccbfc75a1 100644
--- a/lass/2configs/sync/weechat.nix
+++ b/lass/2configs/sync/weechat.nix
@@ -1,5 +1,5 @@
{
- krebs.syncthing.folders."/home/lass/.weechat".peers = [ "blue" "green" "mors" ];
+ services.syncthing.declarative.folders."/home/lass/.weechat".devices = [ "blue" "green" "mors" ];
krebs.permown."/home/lass/.weechat" = {
owner = "lass";
group = "syncthing";
diff --git a/lass/2configs/syncthing.nix b/lass/2configs/syncthing.nix
index d4df17b9a..5397c2ca6 100644
--- a/lass/2configs/syncthing.nix
+++ b/lass/2configs/syncthing.nix
@@ -7,18 +7,20 @@ in {
enable = true;
group = "syncthing";
configDir = "/var/lib/syncthing";
+ declarative = {
+ key = toString <secrets/syncthing.key>;
+ cert = toString <secrets/syncthing.cert>;
+ devices = mk_peers all_peers;
+ folders."/home/lass/sync" = {
+ devices = attrNames (filterAttrs (n: v: n != "phone") own_peers);
+ # ignorePerms = false;
+ };
+ };
};
krebs.iptables.tables.filter.INPUT.rules = [
{ predicate = "-p tcp --dport 22000"; target = "ACCEPT";}
{ predicate = "-p udp --dport 21027"; target = "ACCEPT";}
];
- krebs.syncthing = {
- enable = true;
- cert = toString <secrets/syncthing.cert>;
- key = toString <secrets/syncthing.key>;
- peers = mk_peers all_peers;
- folders."/home/lass/sync".peers = attrNames (filterAttrs (n: v: n != "phone") own_peers);
- };
system.activationScripts.syncthing-home = ''
${pkgs.coreutils}/bin/chmod a+x /home/lass
diff --git a/lass/2configs/websites/domsen.nix b/lass/2configs/websites/domsen.nix
index 80ed12edc..bd113567f 100644
--- a/lass/2configs/websites/domsen.nix
+++ b/lass/2configs/websites/domsen.nix
@@ -270,14 +270,14 @@ in {
};
boot.kernel.sysctl."fs.inotify.max_user_watches" = "1048576";
- krebs.syncthing.folders = {
+ services.syncthing.declarative.folders = {
domsen-backups = {
path = "/backups/domsen";
- peers = [ "domsen-backup" ];
+ devices = [ "domsen-backup" ];
};
domsen-backup-srv-http = {
path = "/srv/http";
- peers = [ "domsen-backup" ];
+ devices = [ "domsen-backup" ];
};
};
diff --git a/lass/2configs/websites/lassulus.nix b/lass/2configs/websites/lassulus.nix
index 901fecfb2..baeac213b 100644
--- a/lass/2configs/websites/lassulus.nix
+++ b/lass/2configs/websites/lassulus.nix
@@ -13,6 +13,8 @@ in {
];
security.acme = {
+ email = "acme@lassul.us";
+ acceptTerms = true;
certs."lassul.us" = {
allowKeysForGroup = true;
group = "lasscert";
@@ -72,11 +74,6 @@ in {
security.acme.certs."cgit.lassul.us" = {
email = "lassulus@lassul.us";
webroot = "/var/lib/acme/acme-challenge";
- plugins = [
- "account_key.json"
- "fullchain.pem"
- "key.pem"
- ];
group = "nginx";
user = "nginx";
};
diff --git a/lass/3modules/default.nix b/lass/3modules/default.nix
index 90dcb9d9c..057c7c74a 100644
--- a/lass/3modules/default.nix
+++ b/lass/3modules/default.nix
@@ -4,6 +4,7 @@ _:
./dnsmasq.nix
./ejabberd
./folderPerms.nix
+ ./hass.nix
./hosts.nix
./mysql-backup.nix
./news.nix
diff --git a/lass/3modules/hass.nix b/lass/3modules/hass.nix
new file mode 100644
index 000000000..30158e78a
--- /dev/null
+++ b/lass/3modules/hass.nix
@@ -0,0 +1,34 @@
+{ config, lib, pkgs, ... }:
+with import <stockholm/lib>;
+let
+
+ cfg = config.lass.hass;
+
+in {
+ options.lass.hass = {
+ config = mkOption {
+ default = {};
+ type = with lib.types; let
+ valueType = nullOr (oneOf [
+ bool
+ int
+ float
+ str
+ (attrsOf valueType)
+ (listOf valueType)
+ ]) // {
+ description = "Yaml value";
+ emptyValue.value = {};
+ };
+ in valueType;
+ };
+ };
+
+ config =
+ assert versionOlder version "20.09";
+ mkIf (cfg.config != {})
+ {
+ services.home-assistant.config = cfg.config;
+ };
+}
+
diff --git a/lass/5pkgs/bruellwuerfel/default.nix b/lass/5pkgs/bruellwuerfel/default.nix
new file mode 100644
index 000000000..cb8f08fa8
--- /dev/null
+++ b/lass/5pkgs/bruellwuerfel/default.nix
@@ -0,0 +1,26 @@
+{ yarn2nix-moretea, fetchFromGitHub, nodePackages, nodejs }: let
+ #src = ~/src/bruellwuerfel;
+ src = fetchFromGitHub {
+ owner = "krebs";
+ repo = "bruellwuerfel";
+ rev = "57e20e630f732ce4e15b495ec5f9bf72a121b959";
+ sha256 = "08zwwl24sq21r497a03lqpy2x10az8frrsh6d38xm92snd1yf85b";
+ };
+
+in yarn2nix-moretea.mkYarnModules rec {
+ pname = "bruellwuerfel";
+ version = "1.0";
+ name = "${pname}-${version}";
+ packageJSON = "${src}/package.json";
+ yarnLock = "${src}/yarn.lock";
+ postBuild = ''
+ cp -r ${src}/{src,tsconfig.json} $out/
+ cd $out
+ ${nodePackages.typescript}/bin/tsc || :
+ mkdir -p $out/bin
+ echo '#!/bin/sh' > $out/bin/bruellwuerfel
+ echo "export NODE_PATH=$out/dist" >> $out/bin/bruellwuerfel
+ echo "${nodejs}/bin/node $out/dist/index.js" >> $out/bin/bruellwuerfel
+ chmod +x $out/bin/bruellwuerfel
+ '';
+}
diff --git a/lass/5pkgs/custom/xmonad-lass/default.nix b/lass/5pkgs/custom/xmonad-lass/default.nix
index c0aef513f..e1c45598f 100644
--- a/lass/5pkgs/custom/xmonad-lass/default.nix
+++ b/lass/5pkgs/custom/xmonad-lass/default.nix
@@ -1,16 +1,10 @@
{ config, pkgs, ... }:
-pkgs.writeHaskellPackage "xmonad-lass" {
- executables.xmonad = {
- extra-depends = [
- "containers"
- "extra"
- "unix"
- "X11"
- "xmonad"
- "xmonad-contrib"
- "xmonad-stockholm"
- ];
- text = /* haskell */ ''
+pkgs.writers.writeHaskellBin "xmonad" {
+ libraries = with pkgs.haskellPackages; [
+ extra
+ xmonad-stockholm
+ ];
+} /* haskell */ ''
{-# LANGUAGE LambdaCase #-}
@@ -62,7 +56,7 @@ instance UrgencyHook LibNotifyUrgencyHook where
safeSpawn "${pkgs.libnotify}/bin/notify-send" [show name, "workspace " ++ idx]
myTerm :: FilePath
-myTerm = "${pkgs.rxvt_unicode_with-plugins}/bin/urxvtc"
+myTerm = "${pkgs.rxvt_unicode-with-plugins}/bin/urxvtc"
myFont :: String
myFont = "-*-clean-*-*-*-*-*-*-*-*-*-*-iso10646-1"
@@ -150,10 +144,7 @@ myKeyMap =
, ("M4-<F2>", windows copyToAll)
- , ("M4-<F4>", spawn "${pkgs.writeDash "nm-dmenu" ''
- export PATH=$PATH:${pkgs.dmenu}/bin:${pkgs.networkmanagerapplet}/bin
- exec ${pkgs.networkmanager_dmenu}/bin/networkmanager_dmenu "$@"
- ''}")
+ , ("M4-<F4>", spawn "${pkgs.nm-dmenu}/bin/nm-dmenu")
, ("M4-<Insert>", spawn "${pkgs.writeDash "paste" ''
${pkgs.coreutils}/bin/sleep 0.1
${pkgs.xclip}/bin/xclip -o | ${pkgs.xdotool}/bin/xdotool type -f -
@@ -223,6 +214,4 @@ gridConfig = def
allWorkspaceNames :: W.StackSet i l a sid sd -> X [i]
allWorkspaceNames ws =
return $ map W.tag (W.hidden ws ++ (map W.workspace $ W.visible ws)) ++ [W.tag $ W.workspace $ W.current ws]
- '';
- };
-}
+''
diff --git a/lass/5pkgs/emot-menu/default.nix b/lass/5pkgs/emot-menu/default.nix
index d5d84e456..440e160d0 100644
--- a/lass/5pkgs/emot-menu/default.nix
+++ b/lass/5pkgs/emot-menu/default.nix
@@ -18,6 +18,9 @@
ζ | zeta
(╯°□°)╯ ┻━┻ | table flip
(」゜ロ゜)」 | why woot
+(_゜_゜_) | gloom I see you
+༼ ༎ຶ ෴ ༎ຶ༽ | sad
+(\/) (°,,,,°) (\/) | krebs
'';
in
diff --git a/lass/5pkgs/fzfmenu/default.nix b/lass/5pkgs/fzfmenu/default.nix
index bdae8ceed..64e95d233 100644
--- a/lass/5pkgs/fzfmenu/default.nix
+++ b/lass/5pkgs/fzfmenu/default.nix
@@ -32,14 +32,24 @@ pkgs.writeDashBin "fzfmenu" ''
done
INPUT=$(${pkgs.coreutils}/bin/cat)
OUTPUT="$(${pkgs.coreutils}/bin/mktemp)"
- ${pkgs.rxvt_unicode}/bin/urxvt \
- -name fzfmenu -title fzfmenu \
- -e ${pkgs.dash}/bin/dash -c \
- "echo \"$INPUT\" | ${pkgs.fzf}/bin/fzf \
- --history=/dev/null \
- --print-query \
- --prompt=\"$PROMPT\" \
- > \"$OUTPUT\"" 2>/dev/null
+ if [ -z ''${TERM+x} ]; then #check if we can print fzf in the shell
+ ${pkgs.rxvt_unicode}/bin/urxvt \
+ -name fzfmenu -title fzfmenu \
+ -e ${pkgs.dash}/bin/dash -c \
+ "echo \"$INPUT\" | ${pkgs.fzf}/bin/fzf \
+ --history=/dev/null \
+ --print-query \
+ --prompt=\"$PROMPT\" \
+ --reverse \
+ > \"$OUTPUT\"" 2>/dev/null
+ else
+ echo "$INPUT" | ${pkgs.fzf}/bin/fzf \
+ --history=/dev/null \
+ --print-query \
+ --prompt="$PROMPT" \
+ --reverse \
+ > "$OUTPUT"
+ fi
${pkgs.coreutils}/bin/tail -1 "$OUTPUT"
${pkgs.coreutils}/bin/rm "$OUTPUT"
''
diff --git a/lass/5pkgs/nm-dmenu/default.nix b/lass/5pkgs/nm-dmenu/default.nix
new file mode 100644
index 000000000..cb47bded3
--- /dev/null
+++ b/lass/5pkgs/nm-dmenu/default.nix
@@ -0,0 +1,6 @@
+{ pkgs, ... }:
+
+pkgs.writeDashBin "nm-dmenu" ''
+ export PATH=$PATH:${pkgs.dmenu}/bin:${pkgs.networkmanagerapplet}/bin
+ exec ${pkgs.networkmanager_dmenu}/bin/networkmanager_dmenu "$@"
+''
diff --git a/lass/5pkgs/review-mail-queue/default.nix b/lass/5pkgs/review-mail-queue/default.nix
new file mode 100644
index 000000000..c8c66706c
--- /dev/null
+++ b/lass/5pkgs/review-mail-queue/default.nix
@@ -0,0 +1,39 @@
+{ pkgs }: let
+
+ review = pkgs.writers.writeBash "review-mail" ''
+ mail="$1"
+ ${pkgs.exim}/bin/exim -Mvc "$mail" | grep -E 'Subject:|To:'
+ ${pkgs.exim}/bin/exim -Mvl "$mail"
+ while :; do
+ read -p 'delete?' key
+ case "$key" in
+ v*)
+ ${pkgs.exim}/bin/exim -Mvc "$mail"
+ ;;
+ d*)
+ ${pkgs.exim}/bin/exim -Mrm "$mail"
+ break
+ ;;
+ r*)
+ ${pkgs.exim}/bin/exim -Mt "$mail"
+ break
+ ;;
+ n*)
+ break
+ ;;
+ esac
+ done
+ echo '-------------------'
+ echo '-------------------'
+ echo '-------------------'
+ echo '-------------------'
+ echo '-------------------'
+ '';
+
+in pkgs.writers.writeBashBin "review-mail" ''
+ for mail in $(${pkgs.exim}/bin/exim -bp \
+ | ${pkgs.gnugrep}/bin/grep frozen \
+ | ${pkgs.gawk}/bin/awk '{print $3}'); do
+ ${review} "$mail"
+ done
+''
[cgit] Unable to lock slot /tmp/cgit/39000000.lock: No such file or directory (2)