1
0
mirror of https://github.com/kmein/niveum synced 2026-03-30 09:11:10 +02:00

15 Commits

15 changed files with 131 additions and 99 deletions

18
.bin/ttrss-unread Executable file
View File

@@ -0,0 +1,18 @@
#/usr/bin/env -S deno run -A:q
set -x
session_cache="$HOME/.cache/tt-rss.session"
ttrss_endpoint=https://feed.kmein.de/api/
ttrss_user=k
ttrss_password=$(pass shared/tt-rss/password)
login() {
if [ -f "$session_cache" ]; then
session_id="$(cat "$session_cache")"
else
session_id="$(curl -d '{"op":"login","user":"'"$ttrss_user"'","password":"'"$ttrss_password"'"}' "$ttrss_endpoint" | jq -r .content.session_id)"
echo "$session_id" > "$session_cache"
fi
}
login
curl -d '{"sid":"'"$session_id"'","op":"getUnread"}' "$ttrss_endpoint" | jq .content

View File

@@ -14,6 +14,7 @@
nginx.enable = false; nginx.enable = false;
node = { node = {
enable = true; enable = true;
openFirewall = true;
enabledCollectors = [ enabledCollectors = [
"conntrack" "conntrack"
"diskstats" "diskstats"
@@ -38,8 +39,6 @@
}; };
}; };
networking.firewall.allowedTCPPorts = [config.services.prometheus.exporters.node.port];
systemd.services.promtail = { systemd.services.promtail = {
description = "Promtail service for Loki"; description = "Promtail service for Loki";
wantedBy = ["multi-user.target"]; wantedBy = ["multi-user.target"];

View File

@@ -90,6 +90,7 @@
urls-source "ttrss" urls-source "ttrss"
ttrss-url "https://feed.kmein.de" ttrss-url "https://feed.kmein.de"
ttrss-login "k" ttrss-login "k"
ttrss-flag-star "s"
ttrss-password "${lib.strings.fileContents <secrets/tt-rss/password>}" ttrss-password "${lib.strings.fileContents <secrets/tt-rss/password>}"
ttrss-mode "multi" ttrss-mode "multi"
''; '';
@@ -99,10 +100,9 @@ in {
nixpkgs.config.packageOverrides = pkgs: { nixpkgs.config.packageOverrides = pkgs: {
newsboat = pkgs.writers.writeDashBin "newsboat" '' newsboat = pkgs.writers.writeDashBin "newsboat" ''
${pkgs.newsboat}/bin/newsboat -C ${newsboat-config} -u ${pkgs.writeText "newsboat-urls" '' ${pkgs.newsboat}/bin/newsboat -C ${newsboat-config} -u ${pkgs.writeText "newsboat-urls" ''
https://feed.kmein.de/public.php?op=rss&id=-1&is_cat=0&q=&key=${lib.strings.fileContents <secrets/tt-rss/private-rss.key>} "foo"
"query:🕒 Read Later:flags # \"e\"" "query:🕒 Read Later:flags # \"e\""
https://feed.kmein.de/public.php?op=rss&id=-1&is_cat=0&q=&key=${lib.strings.fileContents <secrets/tt-rss/private-rss.key>} "~Starred"
"query:📥 Unread:unread = \"yes\"" "query:📥 Unread:unread = \"yes\""
" "
''} "$@" ''} "$@"
''; '';
}; };

View File

@@ -7,4 +7,5 @@
fonts.fontconfig.enable = false; fonts.fontconfig.enable = false;
nix.gc.automatic = true; nix.gc.automatic = true;
nix.optimise.automatic = true; nix.optimise.automatic = true;
services.journald.extraConfig = "SystemMaxUse=500M";
} }

48
flake.lock generated
View File

@@ -23,11 +23,11 @@
"utils": "utils" "utils": "utils"
}, },
"locked": { "locked": {
"lastModified": 1669510155, "lastModified": 1669825171,
"narHash": "sha256-PS2WdRXujfxH9PuH0w8aRmrEQ+Toz3RqGlp0mXQRGio=", "narHash": "sha256-HxlZHSiRGXnWAFbIJMeujqBe2KgACYx5XDRY0EA9P+4=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "e999dfe7cba2e1fd59ab135e7496545bd4f82b76", "rev": "478610aa37c8339eacabfa03f07dacf5574edd47",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -95,11 +95,11 @@
"nix-writers": { "nix-writers": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1554228333, "lastModified": 1669756621,
"narHash": "sha256-hG/PlcCvCQhNcU55NpHfATkyH9k6cZmO7uvBoJjasXU=", "narHash": "sha256-Scg3pf+igUXt/YTO8kxQLBmBqCgGPVt/16DFC8YuA2g=",
"ref": "refs/heads/master", "ref": "refs/heads/master",
"rev": "c528cf970e292790b414b4c1c8c8e9d7e73b2a71", "rev": "f65c77bdcc58be2081a0ffbda849289c5191b5e8",
"revCount": 32, "revCount": 33,
"type": "git", "type": "git",
"url": "https://cgit.krebsco.de/nix-writers" "url": "https://cgit.krebsco.de/nix-writers"
}, },
@@ -110,27 +110,27 @@
}, },
"nixos-stable": { "nixos-stable": {
"locked": { "locked": {
"lastModified": 1669418739, "lastModified": 1669834992,
"narHash": "sha256-T86oFvcUIRwHWBWUt7WjaP4BP/3lDGbv5AppQSI1FkI=", "narHash": "sha256-YnhZGHgb4C3Q7DSGisO/stc50jFb9F/MzHeKS4giotg=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "695b3515251873e0a7e2021add4bba643c56cde3", "rev": "596a8e828c5dfa504f91918d0fa4152db3ab5502",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-22.05", "ref": "nixos-22.11",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"nixos-unstable": { "nixos-unstable": {
"locked": { "locked": {
"lastModified": 1669411043, "lastModified": 1669542132,
"narHash": "sha256-LfPd3+EY+jaIHTRIEOUtHXuanxm59YKgUacmSzaqMLc=", "narHash": "sha256-DRlg++NJAwPh8io3ExBJdNW7Djs3plVI5jgYQ+iXAZQ=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "5dc7114b7b256d217fe7752f1614be2514e61bb8", "rev": "a115bb9bd56831941be3776c8a94005867f316a7",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -143,11 +143,11 @@
"recht": { "recht": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1664353498, "lastModified": 1669719044,
"narHash": "sha256-s1MUaSOkyoAMarB4a1DgMsfVhmhAsLIjtyeT+ZCxOEE=", "narHash": "sha256-WsLWlTM2Hrurj9kVajybIOavV9QPYiJweMCOQR6h+YI=",
"owner": "kmein", "owner": "kmein",
"repo": "recht", "repo": "recht",
"rev": "dc2cb407052a53965e6678fd84f0d887f887c11c", "rev": "7c15b13328fb5cee01012c488ff235ee730cac70",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -159,11 +159,11 @@
"retiolum": { "retiolum": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1669363981, "lastModified": 1669921153,
"narHash": "sha256-MkcI5WZ1VGmXR9LsX9oTJJLSF36L871lX25jT0Ruklw=", "narHash": "sha256-il4bbuxSU/hXj3dkUcex97vHDuSgBeBaRfoxKS8EeOA=",
"owner": "krebs", "owner": "krebs",
"repo": "retiolum", "repo": "retiolum",
"rev": "a805971ef7e25d2cc1ce8a062e5f72617880402a", "rev": "4679cdd5f0851f22518e7011144f22431e6551c0",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -211,11 +211,11 @@
"stockholm": { "stockholm": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1669306514, "lastModified": 1669756706,
"narHash": "sha256-bHhys4UdNC2rvg8RHL3BHR5uXv1Z0jxcQb/V7Wavhfk=", "narHash": "sha256-M4Aj6NoYvS6u/52U+cM4yWdpnbdJQ4k1d4u0yrCUY8Y=",
"ref": "refs/heads/master", "ref": "refs/heads/master",
"rev": "dae12b6893a1d28e8bcb1fe3fb9ee8757bbfbed4", "rev": "81b5682c5ff1e36613f844a874e09b897ee13d3e",
"revCount": 10963, "revCount": 10973,
"type": "git", "type": "git",
"url": "https://cgit.lassul.us/stockholm" "url": "https://cgit.lassul.us/stockholm"
}, },

View File

@@ -2,7 +2,7 @@
description = "niveum: packages, modules, systems"; description = "niveum: packages, modules, systems";
inputs = { inputs = {
nixos-stable.url = "github:NixOS/nixpkgs/nixos-22.05"; nixos-stable.url = "github:NixOS/nixpkgs/nixos-22.11";
nixos-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; nixos-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";

View File

@@ -10,10 +10,8 @@ in {
./gitea.nix ./gitea.nix
./hardware-configuration.nix ./hardware-configuration.nix
./hedgedoc.nix ./hedgedoc.nix
./matterbridge.nix
./menstruation.nix ./menstruation.nix
./moinbot.nix ./moinbot.nix
# ./horoscopy.nix
./monitoring ./monitoring
./moodle-dl-borsfaye.nix ./moodle-dl-borsfaye.nix
./names.nix ./names.nix

View File

@@ -4,10 +4,12 @@ let
in { in {
services.gitea = { services.gitea = {
enable = true; enable = true;
disableRegistration = true;
rootUrl = domain; rootUrl = domain;
appName = "code.kmein.de"; appName = "code.kmein.de";
ssh.clonePort = sshPort; settings = {
server.SSH_PORT = sshPort;
service.DISABLE_REGISTRATION = true;
};
}; };
services.nginx.virtualHosts."code.kmein.de" = { services.nginx.virtualHosts."code.kmein.de" = {
forceSSL = true; forceSSL = true;

View File

@@ -27,7 +27,7 @@ in {
services.hedgedoc = { services.hedgedoc = {
enable = true; enable = true;
configuration = { settings = {
allowOrigin = [domain]; allowOrigin = [domain];
allowAnonymous = true; allowAnonymous = true;
allowGravatar = false; allowGravatar = false;

View File

@@ -4,7 +4,13 @@
... ...
}: let }: let
backend = pkgs.callPackage <menstruation-backend> {}; backend = pkgs.callPackage <menstruation-backend> {};
telegram = pkgs.callPackage <menstruation-telegram> {}; old-pkgs = import (pkgs.fetchFromGitHub {
owner = "NixOs";
repo = "nixpkgs";
rev = "695b3515251873e0a7e2021add4bba643c56cde3";
hash = "sha256-T86oFvcUIRwHWBWUt7WjaP4BP/3lDGbv5AppQSI1FkI=";
}) {};
telegram = old-pkgs.poetry2nix.mkPoetryApplication {projectDir = <menstruation-telegram>;};
backendPort = 8000; backendPort = 8000;
in { in {
services.redis.servers.menstruation = { services.redis.servers.menstruation = {

View File

@@ -10,21 +10,40 @@
in { in {
services.grafana = { services.grafana = {
enable = true; enable = true;
domain = "grafana.kmein.r"; settings.server = {
port = 9444; domain = "grafana.kmein.r";
addr = "127.0.0.1"; http_port = 9444;
}; http_addr = "127.0.0.1";
services.nginx.virtualHosts.${config.services.grafana.domain} = {
locations."/" = {
proxyPass = "http://127.0.0.1:${toString config.services.grafana.port}";
proxyWebsockets = true;
}; };
}; };
services.nginx.virtualHosts = {
${config.services.grafana.settings.server.domain} = {
locations."/" = {
proxyPass = "http://127.0.0.1:${toString config.services.grafana.settings.server.http_port}";
proxyWebsockets = true;
};
};
${lib.removePrefix "http://" config.services.prometheus.alertmanager.webExternalUrl} = {
locations."/" = {
proxyPass = "http://127.0.0.1:${toString config.services.prometheus.alertmanager.port}";
proxyWebsockets = true;
};
};
${lib.removePrefix "http://" config.services.prometheus.webExternalUrl} = {
locations."/" = {
proxyPass = "http://127.0.0.1:${toString config.services.prometheus.port}";
proxyWebsockets = true;
};
};
};
services.prometheus.webExternalUrl = "http://prometheus.kmein.r";
niveum.passport.services = [ niveum.passport.services = [
{ {
title = "Prometheus"; title = "Prometheus";
link = config.services.prometheus.webExternalUrl;
description = "collects metrics from devices in the <i>niveum</i> network, blackbox monitors some websites."; description = "collects metrics from devices in the <i>niveum</i> network, blackbox monitors some websites.";
} }
{ {
@@ -33,11 +52,12 @@ in {
} }
{ {
title = "Grafana"; title = "Grafana";
link = "http://${config.services.grafana.domain}"; link = "http://${config.services.grafana.settings.server.domain}";
description = "displays metrics from devices in the <i>niveum</i> network."; description = "displays metrics from devices in the <i>niveum</i> network.";
} }
{ {
title = "Alertmanager bot"; title = "Alertmanager";
link = config.services.prometheus.alertmanager.webExternalUrl;
description = "notifies me when something goes wrong."; description = "notifies me when something goes wrong.";
} }
]; ];
@@ -143,48 +163,31 @@ in {
}) })
]; ];
systemd.services.alertmanager-bot-telegram = {
wantedBy = ["multi-user.target"];
after = ["ip-up.target"];
environment.TELEGRAM_ADMIN = "18980945";
environment.TELEGRAM_TOKEN = lib.strings.fileContents <system-secrets/telegram/prometheus.token>;
serviceConfig = {
Restart = "on-failure";
RestartSec = "15s";
DynamicUser = true;
StateDirectory = "alertbot";
ExecStart = '' ${pkgs.alertmanager-bot-telegram}/bin/alertmanager-bot \
--alertmanager.url=http://localhost:9093 --log.level=info \
--store=bolt --bolt.path=/var/lib/alertbot/bot.db \
--listen.addr="0.0.0.0:16320" \
--template.paths=${
pkgs.writeText "template.tmpl" ''
{{ define "telegram.default" }}
{{range .Alerts -}}
{{.Status}}: {{ index .Annotations "summary"}}
{{end -}}
{{end}}
''
}'';
};
};
services.prometheus.alertmanager = { services.prometheus.alertmanager = {
enable = true; enable = true;
listenAddress = "localhost"; listenAddress = "localhost";
webExternalUrl = "http://alertmanager.kmein.r";
configuration = { configuration = {
route = { route = {
group_wait = "30s"; group_wait = "30s";
repeat_interval = "4h"; repeat_interval = "24h";
receiver = "me"; receiver = "email";
}; };
receivers = [ receivers = [
{ {
name = "me"; name = "email";
webhook_configs = [ email_configs = let
inherit (import <niveum/lib>) kieran;
inherit (import <niveum/lib/email.nix> {inherit lib;}) cock;
in [
{ {
url = "http://localhost:16320";
send_resolved = true; send_resolved = true;
to = kieran.email;
from = cock.user;
smarthost = "${cock.smtp}:587";
auth_username = cock.user;
auth_identity = cock.user;
auth_password = cock.password;
} }
]; ];
} }
@@ -196,7 +199,7 @@ in {
{ {
scheme = "http"; scheme = "http";
path_prefix = "/"; path_prefix = "/";
static_configs = [{targets = ["localhost:9093"];}]; static_configs = [{targets = ["localhost:${toString config.services.prometheus.alertmanager.port}"];}];
} }
]; ];

View File

@@ -9,7 +9,7 @@
in { in {
services.nextcloud = { services.nextcloud = {
enable = true; enable = true;
package = pkgs.nextcloud24; package = pkgs.nextcloud25;
https = true; https = true;
@@ -20,6 +20,8 @@ in {
hostName = "cloud.xn--kiern-0qa.de"; hostName = "cloud.xn--kiern-0qa.de";
phpOptions."opcache.interned_strings_buffer" = "32"; # buffer size in MB
config = { config = {
overwriteProtocol = "https"; overwriteProtocol = "https";
@@ -31,6 +33,27 @@ in {
adminpassFile = passwordFile <system-secrets/nextcloud/admin>; adminpassFile = passwordFile <system-secrets/nextcloud/admin>;
adminuser = "admin"; adminuser = "admin";
# extraTrustedDomains = [ "toum.r" ]; # extraTrustedDomains = [ "toum.r" ];
defaultPhoneRegion = "DE";
};
logLevel = 2;
extraOptions = let
inherit (import <niveum/lib/email.nix> {inherit lib;}) cock;
address = builtins.split "@" cock.user;
in {
defaultapp = "files";
mail_smtpmode = "smtp";
mail_sendmailmode = "smtp";
mail_smtphost = cock.smtp;
mail_smtpport = "587";
mail_from_address = builtins.elemAt address 0;
mail_domain = builtins.elemAt address 2;
mail_smtpsecure = "tls";
mail_smtpauthtype = "LOGIN";
mail_smtpauth = 1;
mail_smtpname = cock.user;
mail_smtppassword = cock.password;
}; };
}; };

View File

@@ -12,7 +12,7 @@ in {
selfUrlPath = "https://${domain}"; selfUrlPath = "https://${domain}";
virtualHost = domain; virtualHost = domain;
registration = { registration = {
enable = true; enable = false;
maxUsers = 3; maxUsers = 3;
}; };
}; };

View File

@@ -26,19 +26,6 @@
url = "http://lammla.info/index.php?reihe=30"; url = "http://lammla.info/index.php?reihe=30";
filter = ["html2text" "strip"]; filter = ["html2text" "strip"];
} }
{
name = "Tatort";
url = "https://www.daserste.de/unterhaltung/krimi/tatort/vorschau/index.html";
filter = [
"html2text"
"strip"
{
shellpipe = ''
${pkgs.gnused}/bin/sed 's/&#32;/ /g;s/))/&\n/g;s/ \+/ /g'
'';
}
];
}
{ {
name = "Kratylos"; name = "Kratylos";
url = "https://kratylos.reichert-online.org/current_issue/KRATYLOS"; url = "https://kratylos.reichert-online.org/current_issue/KRATYLOS";
@@ -49,11 +36,6 @@
url = "http://www.zeno.org/Lesesaal/M/E-Books"; url = "http://www.zeno.org/Lesesaal/M/E-Books";
filter = [{element-by-class = "zenoCOMain";} "html2text" "strip"]; filter = [{element-by-class = "zenoCOMain";} "html2text" "strip"];
} }
{
name = "Arnshaugk Neuerscheinungen";
url = "http://www.arnshaugk.de/index.php";
filter = ["html2text" "strip"];
}
{ {
name = "Carolina Welslau"; name = "Carolina Welslau";
url = "https://carolinawelslau.de/"; url = "https://carolinawelslau.de/";

View File

@@ -24,7 +24,7 @@ in {
<niveum/configs/printing.nix> <niveum/configs/printing.nix>
<niveum/configs/spacetime.nix> <niveum/configs/spacetime.nix>
<niveum/configs/sshd.nix> <niveum/configs/sshd.nix>
<niveum/configs/traadfri.nix> # <niveum/configs/traadfri.nix>
<niveum/configs/tmux.nix> <niveum/configs/tmux.nix>
<niveum/configs/wpa_supplicant.nix> <niveum/configs/wpa_supplicant.nix>
<niveum/modules/retiolum.nix> <niveum/modules/retiolum.nix>