1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00

11 Commits

15 changed files with 153 additions and 491 deletions

View File

@@ -1,8 +0,0 @@
{ pkgs, ... }:
{
environment.systemPackages = [ pkgs.zeroad ];
networking.firewall = {
allowedTCPPorts = [ 20595 ];
allowedUDPPorts = [ 20595 ];
};
}

View File

@@ -4,7 +4,7 @@
lib,
...
}: let
darwin = lib.strings.hasSuffix "-darwin" pkgs.system;
darwin = lib.strings.hasSuffix "-darwin" pkgs.stdenv.hostPlatform.system;
in {
environment.systemPackages =
[

View File

@@ -17,11 +17,15 @@ in {
./hesychius.nix
./smyth.nix
./nachtischsatan.nix
./tlg-wotd.nix
# ./tlg-wotd.nix TODO reenable
./celan.nix
./nietzsche.nix
];
age.secrets = {
telegram-token-kmein.file = ../../secrets/telegram-token-kmein.age;
};
systemd.tmpfiles.rules = map (path:
tmpfilesConfig {
type = "d";

View File

@@ -3,11 +3,14 @@
lib,
config,
niveumPackages,
unstablePackages,
...
}: let
mastodonEndpoint = "https://social.krebsco.de";
in {
systemd.services.bot-tlg-wotd = {
# TODO reenable
# once https://github.com/NixOS/nixpkgs/pull/462893 is in stable NixOS
enable = true;
wants = ["network-online.target"];
startAt = "9:30";
@@ -42,9 +45,8 @@ in {
#ancientgreek #classics #wotd #wordoftheday
transliteration=$(${pkgs.writers.makePythonWriter pkgs.python311 pkgs.python311Packages pkgs.python3Packages "translit.py" {
# revert to pkgs.writers.writePython3 once https://github.com/NixOS/nixpkgs/pull/353367 is merged
libraries = [ pkgs.python3Packages.cltk ];
transliteration=$(${pkgs.writers.writePython3 "translit.py" {
libraries = py: [ py.cltk ];
} ''
import sys
from cltk.phonology.grc.transcription import Transcriber
@@ -149,7 +151,6 @@ in {
};
age.secrets = {
telegram-token-kmein.file = ../../secrets/telegram-token-kmein.age;
mastodon-token-tlgwotd.file = ../../secrets/mastodon-token-tlgwotd.age;
};

13
configs/gaming.nix Normal file
View File

@@ -0,0 +1,13 @@
{ pkgs, ... }:
{
environment.systemPackages = [
pkgs.zeroad
pkgs.mari0
pkgs.luanti # fka minetest
];
networking.firewall = {
# for 0ad multiplayer
allowedTCPPorts = [ 20595 ];
allowedUDPPorts = [ 20595 ];
};
}

114
flake.lock generated
View File

@@ -813,26 +813,23 @@
"type": "github"
}
},
"nix-formatter-pack_2": {
"nix-index-database": {
"inputs": {
"nixpkgs": [
"nix-on-droid",
"nixpkgs"
],
"nmd": "nmd_3",
"nmt": "nmt_2"
]
},
"locked": {
"lastModified": 1666720474,
"narHash": "sha256-iWojjDS1D19zpeZXbBdjWb9MiKmVVFQCqtJmtTXgPx8=",
"owner": "Gerschtli",
"repo": "nix-formatter-pack",
"rev": "14876cc8fe94a3d329964ecb073b4c988c7b61f5",
"lastModified": 1765267181,
"narHash": "sha256-d3NBA9zEtBu2JFMnTBqWj7Tmi7R5OikoU2ycrdhQEws=",
"owner": "nix-community",
"repo": "nix-index-database",
"rev": "82befcf7dc77c909b0f2a09f5da910ec95c5b78f",
"type": "github"
},
"original": {
"owner": "Gerschtli",
"repo": "nix-formatter-pack",
"owner": "nix-community",
"repo": "nix-index-database",
"type": "github"
}
},
@@ -867,33 +864,6 @@
"type": "github"
}
},
"nix-on-droid_2": {
"inputs": {
"home-manager": [
"home-manager"
],
"nix-formatter-pack": "nix-formatter-pack_2",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-for-bootstrap": "nixpkgs-for-bootstrap_2",
"nmd": "nmd_4"
},
"locked": {
"lastModified": 1688144254,
"narHash": "sha256-8KL1l/7eP2Zm1aJjdVaSOk0W5kTnJo9kcgW03gqWuiI=",
"owner": "t184256",
"repo": "nix-on-droid",
"rev": "2301e01d48c90b60751005317de7a84a51a87eb6",
"type": "github"
},
"original": {
"owner": "t184256",
"ref": "release-23.05",
"repo": "nix-on-droid",
"type": "github"
}
},
"nix-writers": {
"flake": false,
"locked": {
@@ -982,22 +952,6 @@
"type": "github"
}
},
"nixpkgs-for-bootstrap_2": {
"locked": {
"lastModified": 1686921029,
"narHash": "sha256-J1bX9plPCFhTSh6E3TWn9XSxggBh/zDD4xigyaIQBy8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c7ff1b9b95620ce8728c0d7bd501c458e6da9e04",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c7ff1b9b95620ce8728c0d7bd501c458e6da9e04",
"type": "github"
}
},
"nixpkgs-old": {
"locked": {
"lastModified": 1682600000,
@@ -1280,38 +1234,6 @@
"type": "gitlab"
}
},
"nmd_3": {
"flake": false,
"locked": {
"lastModified": 1666190571,
"narHash": "sha256-Z1hc7M9X6L+H83o9vOprijpzhTfOBjd0KmUTnpHAVjA=",
"owner": "rycee",
"repo": "nmd",
"rev": "b75d312b4f33bd3294cd8ae5c2ca8c6da2afc169",
"type": "gitlab"
},
"original": {
"owner": "rycee",
"repo": "nmd",
"type": "gitlab"
}
},
"nmd_4": {
"flake": false,
"locked": {
"lastModified": 1666190571,
"narHash": "sha256-Z1hc7M9X6L+H83o9vOprijpzhTfOBjd0KmUTnpHAVjA=",
"owner": "rycee",
"repo": "nmd",
"rev": "b75d312b4f33bd3294cd8ae5c2ca8c6da2afc169",
"type": "gitlab"
},
"original": {
"owner": "rycee",
"repo": "nmd",
"type": "gitlab"
}
},
"nmt": {
"flake": false,
"locked": {
@@ -1328,22 +1250,6 @@
"type": "gitlab"
}
},
"nmt_2": {
"flake": false,
"locked": {
"lastModified": 1648075362,
"narHash": "sha256-u36WgzoA84dMVsGXzml4wZ5ckGgfnvS0ryzo/3zn/Pc=",
"owner": "rycee",
"repo": "nmt",
"rev": "d83601002c99b78c89ea80e5e6ba21addcfe12ae",
"type": "gitlab"
},
"original": {
"owner": "rycee",
"repo": "nmt",
"type": "gitlab"
}
},
"nur": {
"locked": {
"lastModified": 1693680361,
@@ -1491,7 +1397,7 @@
"home-manager": "home-manager_2",
"menstruation-backend": "menstruation-backend_2",
"menstruation-telegram": "menstruation-telegram_2",
"nix-on-droid": "nix-on-droid_2",
"nix-index-database": "nix-index-database",
"nixinate": "nixinate_2",
"nixpkgs": "nixpkgs_7",
"nixpkgs-old": "nixpkgs-old_2",

View File

@@ -130,7 +130,6 @@
# TODO remove flake-utils dependency from my own repos
nixosModules = {
htgen = import modules/htgen.nix;
moodle-dl = import modules/moodle-dl.nix;
networkmanager-declarative = import modules/networkmanager-declarative.nix;
passport = import modules/passport.nix;
@@ -170,7 +169,6 @@
inputs.self.nixosModules.passport
inputs.self.nixosModules.panoptikon
inputs.self.nixosModules.go-webring
inputs.self.nixosModules.htgen
inputs.stockholm.nixosModules.reaktor2
retiolum.nixosModules.retiolum
nur.modules.nixos.default
@@ -212,7 +210,6 @@
modules = [
systems/makanek/configuration.nix
inputs.self.nixosModules.telegram-bot
inputs.self.nixosModules.htgen
inputs.self.nixosModules.passport
agenix.nixosModules.default
retiolum.nixosModules.retiolum
@@ -319,7 +316,6 @@
# krebs
brainmelter = pkgs.callPackage packages/brainmelter.nix {};
cyberlocker-tools = pkgs.callPackage packages/cyberlocker-tools.nix {};
htgen = pkgs.callPackage packages/htgen.nix {};
hc = pkgs.callPackage packages/hc.nix {};
kpaste = pkgs.callPackage packages/kpaste.nix {};
pls = pkgs.callPackage packages/pls.nix {};

View File

@@ -85,9 +85,6 @@ let
big-fm-name = name: "${name} | bigFM";
big-fm = name: "https://streams.bigfm.de/bigfm-${name}-128-aac";
rautemusik-name = name: "${name} | rm.fm";
rautemusik = name: "http://${name}-high.rautemusik.fm/";
rte-name = name: "RTÉ ${name}";
rte = name: "https://www.rte.ie/manifests/${name}.m3u8";
@@ -1207,198 +1204,6 @@ in
logo = "https://cdn.schlagerparadies.de/images/rsp_setup/logo-radio-schlagerparadies.svg";
tags = [tags.schlager];
}
{
station = rautemusik-name "Volksmusik";
desc = "Volksmusik, Blasmusik, Schlager";
stream = rautemusik "volksmusik";
tags = [tags.schlager];
}
{
station = rautemusik-name "Study";
stream = rautemusik "study";
desc = "Lo-Fi, Chillout, Easy Listening";
tags = [tags.lofi tags.chill];
}
{
station = rautemusik-name "TechHouse";
stream = rautemusik "techhouse";
desc = "Techhouse, Deephouse, Techno, Minimal";
tags = [tags.party];
}
{
station = rautemusik-name "Goldies";
stream = rautemusik "goldies";
desc = "Oldies, 60s, 70s, 80s";
tags = [tags.vintage];
}
{
station = rautemusik-name "90s";
stream = rautemusik "90s";
desc = "90s, Eurodance, Pop, HipHop";
tags = [tags.vintage];
}
{
station = rautemusik-name "Schlager";
stream = rautemusik "schlager";
desc = "Schlager, Discofox, Deutsch, Pop";
tags = [tags.schlager];
}
{
station = rautemusik-name "Country";
stream = rautemusik "country";
desc = "Country, Western, Americana";
tags = [tags.trad tags.american];
}
{
station = rautemusik-name "Sex";
stream = rautemusik "sex";
desc = "RnB, Pop, Easy Listening";
tags = [tags.chill];
}
{
station = rautemusik-name "LoveHits";
stream = rautemusik "lovehits";
desc = "Lovesongs, Balladen, RnB, Pop";
tags = [tags.pop];
}
{
station = rautemusik-name "Klassik";
stream = rautemusik "klassik";
desc = "Symphonie, Orchester, Klassik";
tags = [tags.classical];
}
{
station = rautemusik-name "Traurig";
stream = rautemusik "traurig";
desc = "Balladen, Pop, Easy Listening";
tags = [tags.pop];
}
{
station = rautemusik-name "Happy";
stream = rautemusik "happy";
desc = "Pop, Dance, Charts";
tags = [tags.pop];
}
{
station = rautemusik-name "Solo Piano";
stream = rautemusik "solopiano";
desc = "Klavier, Instrumental, Easy Listening";
tags = [tags.classical];
}
{
station = rautemusik-name "HappyHardcore";
stream = rautemusik "happyhardcore";
desc = "UK Core, Happy Hardcore, Dance";
tags = [tags.party];
}
{
station = rautemusik-name "HardeR";
stream = rautemusik "harder";
desc = "Hardstyle, Hardcore, Jumpstyle";
tags = [tags.party];
}
{
station = rautemusik-name "BigCityBeats";
stream = rautemusik "bigcitybeats";
desc = "EDM, Dance, House, Electro, Star DJs";
tags = [tags.pop tags.party];
}
{
station = rautemusik-name "Lounge";
stream = rautemusik "lounge";
desc = "Ambient, Jazz, Chillout, Easy Listening";
tags = [tags.chill];
}
{
station = rautemusik-name "Oriental";
stream = rautemusik "oriental";
desc = "Arabisch, Oriental, HipHop";
tags = [tags.arabic];
}
{
station = rautemusik-name "Salsa";
stream = rautemusik "salsa";
desc = "Salsa, Latina, Tropical";
tags = [tags.groovy];
}
{
station = rautemusik-name "Christmas";
stream = rautemusik "christmas";
desc = "Weihnachtslieder, Balladen, Schlager";
tags = [tags.xmas];
}
{
station = rautemusik-name "Christmas Chor";
stream = rautemusik "christmas-chor";
desc = "Chor, Weihnachtslieder, Gesang";
tags = [tags.xmas];
}
{
station = rautemusik-name "Christmas Schlager";
stream = rautemusik "christmas-schlager";
desc = "Schlager, Weihnachtslieder";
tags = [tags.xmas tags.schlager];
}
{
station = rautemusik-name "Weihnachten.FM";
stream = rautemusik "weihnachten";
desc = "Weihnachtslieder, Pop";
tags = [tags.xmas];
}
{
station = rautemusik-name "Top40";
stream = rautemusik "top40";
desc = "Charts, Top40, Dance, Hiphop";
tags = [tags.top40];
}
{
station = rautemusik-name "Rock";
desc = "Rock, Alternative, Punk";
stream = rautemusik "rock";
tags = [tags.rock];
}
{
station = rautemusik-name "PartyHits";
desc = "Karneval, Mallorca, Après Ski, Schlager";
stream = rautemusik "partyhits";
tags = [tags.schlager];
}
{
station = rautemusik-name "Deutschrap Charts";
stream = rautemusik "deutschrap-charts";
desc = "Deutschrap, HipHop, Rap, Charts";
tags = [tags.rap];
}
{
station = rautemusik-name "Deutschrap Classic";
stream = rautemusik "deutschrap-classic";
desc = "Oldschool, Rap, HipHop, Deutschrap";
tags = [tags.rap];
}
{
station = rautemusik-name "ChartHits";
stream = rautemusik "ChartHits";
desc = "House, RnB, Dance, Electro";
tags = [tags.top40];
}
{
station = rautemusik-name "BreakZ.FM";
stream = rautemusik "breakz";
desc = "RnB, House, HipHop, Dance, Mixtapes";
tags = [tags.top40];
}
{
station = rautemusik-name "Bass";
stream = rautemusik "bass";
desc = "DnB, Dubstep, Trap & Bass House";
tags = [tags.party];
}
{
station = rautemusik-name "12punks";
stream = rautemusik "12punks";
desc = "Punk, Punk Rock, Ska, Hardcore";
tags = [tags.rock];
}
{
logo = "https://d3kle7qwymxpcy.cloudfront.net/images/broadcasts/77/a4/13931/1/c175.png";
station = "Raidió Rírá";
@@ -1406,12 +1211,6 @@ in
desc = "Is cairt-staisiún ceoil é Raidió Rí-Rá a bhíonn ag craoladh go hiomlán trí Ghaeilge! Bíonn an ceol ar fad ó na cairteacha le cloisteáil ar an stáisiún, mar aon leis an bpopnuacht, an nuacht spóirt agus an nuacht scannánaíochta is déanaí!";
tags = [tags.top40];
}
{
stream = "http://188.247.86.67:8008";
station = "Rotana Tarab";
logo = "https://liveonlineradio.net/wp-content/uploads/2017/11/Rotana-Tarab-100x47.jpg";
tags = [tags.trad tags.arabic];
}
{
stream = "http://asima.out.airtime.pro:8000/asima_a";
station = "Asima";
@@ -1554,6 +1353,11 @@ in
desc = "Ohne Blatt vor dem Mund! Für alle, die aufwachen wollen.";
tags = [tags.text];
}
{
station = "NIUS";
stream = "https://nius.stream25.radiohost.de/live_mp3-192";
tags = [tags.text];
}
{
station = "Kontrafunk";
stream = "https://icecast.multhielemedia.de/listen/kontrafunk/radio.mp3";
@@ -1649,21 +1453,6 @@ in
station = "ERTU Al Quran Al Kareem";
tags = [tags.arabic tags.text tags.holy];
}
{
stream = "http://149.28.52.216:3344/listen.mp3";
station = "Verse 24/7 Holy Quran";
tags = [tags.arabic tags.text tags.holy];
}
{
stream = "https://s6.voscast.com:9355/stream";
station = "Kilid Herat";
tags = [tags.arabic tags.holy]; # nasheeds
}
{
stream = "https://s6.voscast.com:9355/stream";
station = "Radio Salam Watandar";
tags = [tags.arabic tags.holy];
}
{
stream = "http://onair15.xdevel.com:7064/1/";
station = "Radio Mozart Italia";
@@ -1671,12 +1460,6 @@ in
desc = "Emittente ufficiale delle Associazioni Mozart Italia nel mondo";
tags = [tags.classical];
}
{
stream = "http://onair7.xdevel.com:7126/1/";
station = "Opera Radio Budapest";
logo = "https://www.opera.hu/static/default/asset/img/common/opera-logo.svg";
tags = [tags.classical];
}
{
stream = "http://peacefulpiano.stream.publicradio.org/peacefulpiano.mp3";
station = "Peaceful Piano";
@@ -1846,11 +1629,6 @@ in
stream = "https://playerservices.streamtheworld.com/api/livestream-redirect/KAN_88.mp3";
tags = [tags.hebrew];
}
{
station = "Digital Impulse Classical Channel";
stream = "http://orion.shoutca.st:8978/stream";
tags = [tags.classical];
}
{
station = "Старое радио (детское)";
stream = "http://195.91.237.50:8000/detskoe128";
@@ -1921,18 +1699,23 @@ in
stream = "http://cw.dimebank.com:8080/CNNfast";
tags = [tags.text];
}
{
station = "80s80s | Dark Wave";
stream = "https://streams.80s80s.de/darkwave/mp3-192/homepage/";
tags = [tags.wave];
}
{
station = "80s80s | Wave";
stream = "https://streams.80s80s.de/wave/mp3-192/homepage/";
tags = [tags.wave];
}
{
station = "XXX orchestral";
stream = "http://orion.shoutca.st:8978/stream";
tags = [tags.classical];
}
{
station = "XXX greek";
stream = "http://radio.hostchefs.net:8046/stream?1520818130148";
tags = [tags.greek];
}
{
station = "XXX turkish or greek";
station = "Kral FM Xanthi";
stream = "https://onairmediagroup.live24.gr/kralfm100xanthi";
tags = [tags.greek tags.turkish];
}
@@ -1986,11 +1769,6 @@ in
stream = "http://s2.voscast.com:12312/;";
station = "Bahrain Quran Radio";
}
{
tags = [tags.arabic tags.text tags.holy];
stream = "http://162.244.81.30:8224/;";
station = "Quran Radio Lebanon";
}
{
tags = [tags.arabic tags.text tags.holy];
stream = "http://tijaniyyah.asuscomm.com:8000/stream/2/";
@@ -2001,16 +1779,6 @@ in
station = "Coptic for God";
stream = "http://66.70.249.70:5832/stream";
}
{
stream = "http://stream-025.zeno.fm/5y95pu36sm0uv?";
station = "Hayat FM";
tags = [tags.arabic tags.text tags.holy];
}
{
stream = "http://uk2.internet-radio.com:8151/stream";
station = "The Quran Radio";
tags = [tags.arabic tags.text tags.holy];
}
{
stream = "http://www.radioeins.de/livemp3";
station = "radioeins | RBB";
@@ -2025,9 +1793,17 @@ in
stream = "http://mp3.ffh.de/radioffh/hqlivestream.mp3";
station = "Hitradio FFH";
}
{
stream = "https://mp3.planetradio.de/planetradio/hqlivestream.aac";
station = "planet radio";
}
{ # Lex Fridman's favourite
stream = "av://lavfi:anoisesrc=color=brown";
station = "Brownian noise";
station = "Brown noise";
}
{
stream = "av://lavfi:anoisesrc=color=pink";
station = "Pink noise";
}
{
stream = "https://st03.sslstream.dlf.de/dlf/03/high/aac/stream.aac";

View File

@@ -1,47 +0,0 @@
{
config,
lib,
pkgs,
...
}: let
htgen = pkgs.callPackage ../packages/htgen.nix {};
in {
options.services.htgen = lib.mkOption {
default = {};
type = lib.types.attrsOf (lib.types.submodule ({config, ...}: {
options = {
enable = lib.mkEnableOption "htgen-${config._module.args.name}";
port = lib.mkOption {
type = lib.types.int;
};
script = lib.mkOption {
type = lib.types.str;
};
};
}));
};
config = {
systemd.services =
lib.mapAttrs' (
name: cfg:
lib.nameValuePair "htgen-${name}" {
wantedBy = ["multi-user.target"];
after = ["network.target"];
environment = {
HOME = "/var/lib/htgen-${name}";
HTGEN_PORT = toString cfg.port;
HTGEN_SCRIPT = cfg.script;
};
serviceConfig = {
SyslogIdentifier = "htgen-${name}";
DynamicUser = true;
StateDirectory = "htgen-${name}";
PrivateTmp = true;
Restart = "always";
ExecStart = "${htgen}/bin/htgen --serve";
};
}
)
config.services.htgen;
};
}

View File

@@ -1,10 +1,10 @@
{ writers, chromium }:
writers.writeDashBin "cro" ''
${chromium}/bin/chromium \
--disable-sync \
--no-default-browser-check \
--no-first-run \
--user-data-dir="$(mktemp -d)" \
--incognito \
"$@"
''
{ coreutils, chromium }:
chromium.override {
commandLineArgs = [
"--disable-sync"
"--no-default-browser-check"
"--no-first-run"
"--user-data-dir=$(${coreutils}/bin/mktemp -d)"
"--incognito"
];
}

View File

@@ -1,31 +0,0 @@
{
fetchgit,
lib,
pkgs,
stdenv,
}:
stdenv.mkDerivation rec {
pname = "htgen";
version = "1.3.1";
src = fetchgit {
url = "http://cgit.krebsco.de/htgen";
rev = "refs/tags/${version}";
sha256 = "0ml8kp89bwkrwy6iqclzyhxgv2qn9dcpwaafbmsr4mgcl70zx22r";
};
installPhase = ''
mkdir -p $out/bin
{
echo '#! ${pkgs.dash}/bin/dash'
echo 'export PATH=${lib.makeBinPath [
pkgs.coreutils
pkgs.jq
pkgs.ucspi-tcp
]}''${PATH+":$PATH"}'
sed 's:^Server=htgen$:&/${version}:' htgen
} > $out/bin/htgen
chmod +x $out/bin/htgen
cp -r examples $out
'';
}

View File

@@ -9,7 +9,7 @@ in {
./hardware-configuration.nix
../../configs/networkmanager.nix
../../configs/default.nix
../../configs/0ad.nix
../../configs/gaming.nix
# ../../configs/gnome.nix
];

View File

@@ -7,8 +7,10 @@ in {
defaultOptions.settings = {
USER_DEFINED_DEFAULT = true;
};
instances = {
"gitea".settings = {
instances = let instance = "gitea"; in {
${instance}.settings = {
BIND = "/run/anubis/anubis-${instance}/anubis.sock";
METRICS_BIND = "/run/anubis/anubis-${instance}/anubis-metrics.sock";
TARGET = "http://localhost:${toString config.services.gitea.settings.server.HTTP_PORT}";
USER_DEFINED_INSTANCE = true;
OG_PASSTHROUGH = true;

View File

@@ -3,7 +3,8 @@
pkgs,
lib,
...
}: let
}:
let
tarotPort = 7407;
tarotFiles = pkgs.fetchzip {
url = "https://c.krebsco.de/tarot.zip";
@@ -14,33 +15,45 @@
url = "http://c.krebsco.de/tarot.pdf";
sha256 = "1n2m53kjg2vj9dbr70b9jrsbqwdfrcb48l4wswn21549fi24g6dx";
};
in {
services.htgen.tarot = {
port = tarotPort;
script = ''. ${pkgs.writers.writeDash "tarot" ''
case "$Method $Request_URI" in
"GET /")
if item=$(${pkgs.findutils}/bin/find ${toString tarotFiles} -type f | ${pkgs.coreutils}/bin/shuf -n1); then
card=$(mktemp --tmpdir tarot.XXX)
trap 'rm $card' EXIT
reverse=$(${pkgs.coreutils}/bin/shuf -i0-1 -n1)
if [ "$reverse" -eq 1 ]; then
${pkgs.imagemagick}/bin/convert -rotate 180 "$item" "$card"
else
${pkgs.coreutils}/bin/cp "$item" "$card"
fi
printf 'HTTP/1.1 200 OK\r\n'
printf 'Content-Type: %s\r\n' "$(${pkgs.file}/bin/file -ib "$card")"
printf 'Server: %s\r\n' "$Server"
printf 'Connection: close\r\n'
printf 'Content-Length: %d\r\n' $(${pkgs.coreutils}/bin/wc -c < "$card")
printf '\r\n'
cat "$card"
exit
fi
;;
esac
''}'';
in
{
systemd.services.tarot = {
enable = true;
serviceConfig.Type = "simple";
wantedBy = [ "multi-user.target" ];
serviceConfig.ExecStart = pkgs.writers.writePython3 "tarot-server" {
libraries = py: [ py.pillow py.flask ];
} ''
from flask import Flask, send_file
from pathlib import Path
from random import choice, randint
from io import BytesIO
from PIL import Image
app = Flask(__name__)
TAROT_DIR = Path("${tarotFiles}")
@app.route("/")
def tarot():
card_path = choice(list(TAROT_DIR.glob("*")))
with Image.open(card_path) as img:
if randint(0, 1):
img = img.rotate(180)
buf = BytesIO()
img.save(buf, format="JPEG")
buf.seek(0)
return send_file(
buf,
mimetype='image/jpeg',
as_attachment=False
)
if __name__ == "__main__":
app.run(port=${toString tarotPort})
'';
};
niveum.passport.services = [
@@ -55,7 +68,7 @@ in {
enableACME = true;
forceSSL = true;
locations = {
"/".proxyPass = "http://127.0.0.1:${toString tarotPort}";
"/".proxyPass = "http://127.0.0.1:${toString tarotPort}/";
"/files/" = {
root = pkgs.linkFarm "tarot" [
{

View File

@@ -74,6 +74,40 @@ in {
hardware.bluetooth.enable = true;
systemd.services.update-containers = {
startAt = "Mon 02:00";
script = ''
images=$(${pkgs.podman}/bin/podman ps -a --format="{{.Image}}" | sort -u)
for image in $images; do
${pkgs.podman}/bin/podman pull "$image"
done
'';
serviceConfig = {
Type = "oneshot";
Restart = "on-failure";
RestartSec = "1h";
};
};
systemd.services.restart-homeassistant = {
startAt = "Tue 02:00";
script = ''
${pkgs.systemd}/bin/systemctl try-restart podman-homeassistant.service
'';
serviceConfig = {
Type = "oneshot";
};
};
virtualisation.podman = {
enable = true;
autoPrune = {
enable = true;
flags = ["--all"];
};
};
virtualisation.oci-containers = {
backend = "podman";
containers.homeassistant = {
@@ -82,6 +116,9 @@ in {
"${playlistDirectoryPath}:/media"
"/run/dbus:/run/dbus:ro"
];
# needed for bluetooth
capabilities.NET_ADMIN = true;
capabilities.NET_RAW = true;
environment.TZ = "Europe/Berlin";
image = "ghcr.io/home-assistant/home-assistant:stable";
extraOptions = [