From b16de242e0f1560c42d14b71dccc0858d70643ec Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 10 Aug 2022 14:40:50 +0200 Subject: l paste: add /form endpoint for form posts --- lass/2configs/paste.nix | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'lass') diff --git a/lass/2configs/paste.nix b/lass/2configs/paste.nix index affc35307..101899e94 100644 --- a/lass/2configs/paste.nix +++ b/lass/2configs/paste.nix @@ -61,6 +61,11 @@ with import ; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://127.0.0.1:${toString config.krebs.htgen.paste.port}; ''; + locations."/form".extraConfig = '' + client_max_body_size 4G; + proxy_set_header Host $host; + proxy_pass http://127.0.0.1:${toString config.krebs.htgen.paste-form.port}; + ''; locations."/image".extraConfig = '' proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; @@ -86,6 +91,33 @@ with import ; ". ${pkgs.htgen}/examples/paste" ]; }; + + krebs.htgen.paste-form = { + port = 7770; + script = /* sh */ '' + export PATH=${makeBinPath [ + pkgs.curl + pkgs.gnused + ]}:$PATH + (. ${pkgs.writeScript "paste-form" '' + case "$Method" in + 'POST') + ref=$(head -c $req_content_length | sed '0,/^\r$/d;$d' | curl -fSs --data-binary @- https://p.krebsco.de | sed '1d;s/^http:/https:/') + + printf 'HTTP/1.1 200 OK\r\n' + printf 'Content-Type: text/plain; charset=UTF-8\r\n' + printf 'Server: %s\r\n' "$Server" + printf 'Connection: close\r\n' + printf 'Content-Length: %d\r\n' $(expr ''${#ref} + 1) + printf '\r\n' + printf '%s\n' "$ref" + + exit + ;; + esac + ''}) + ''; + }; krebs.htgen.imgur = { port = 7771; script = /* sh */ '' -- cgit v1.2.3 From 7ce87f5fdb602de7638b2df237e891e6038907ac Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 10 Aug 2022 14:41:04 +0200 Subject: l paste: gc after 30 days --- lass/2configs/paste.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lass') diff --git a/lass/2configs/paste.nix b/lass/2configs/paste.nix index 101899e94..cfd7f5576 100644 --- a/lass/2configs/paste.nix +++ b/lass/2configs/paste.nix @@ -92,6 +92,16 @@ with import ; ]; }; + systemd.services.paste-gc = { + startAt = "daily"; + serviceConfig = { + ExecStart = '' + ${pkgs.findutils}/bin/find /var/lib/htgen-paste/items -type f -mtime '+30' -exec rm {} \; + ''; + User = "htgen-paste"; + }; + }; + krebs.htgen.paste-form = { port = 7770; script = /* sh */ '' -- cgit v1.2.3 From 8301bb18d00df6a91e257b582bfbe24e5edff103 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sun, 18 Sep 2022 12:17:18 +0200 Subject: l: use snapcast in gg23 --- lass/1systems/icarus/config.nix | 2 ++ lass/1systems/shodan/config.nix | 2 ++ lass/1systems/styx/config.nix | 3 +++ lass/2configs/snapclient.nix | 12 ++++++++++++ lass/2configs/snapserver.nix | 13 +++++++++++++ 5 files changed, 32 insertions(+) create mode 100644 lass/2configs/snapclient.nix create mode 100644 lass/2configs/snapserver.nix (limited to 'lass') diff --git a/lass/1systems/icarus/config.nix b/lass/1systems/icarus/config.nix index 609da6011..2d2f23f95 100644 --- a/lass/1systems/icarus/config.nix +++ b/lass/1systems/icarus/config.nix @@ -10,6 +10,7 @@ with import ; + @@ -21,6 +22,7 @@ with import ; # + ]; krebs.build.host = config.krebs.hosts.icarus; diff --git a/lass/1systems/shodan/config.nix b/lass/1systems/shodan/config.nix index 7695e637b..5d6a440e0 100644 --- a/lass/1systems/shodan/config.nix +++ b/lass/1systems/shodan/config.nix @@ -8,6 +8,7 @@ with import ; + @@ -21,6 +22,7 @@ with import ; + ]; krebs.build.host = config.krebs.hosts.shodan; diff --git a/lass/1systems/styx/config.nix b/lass/1systems/styx/config.nix index 016d1480f..e49d24f9a 100644 --- a/lass/1systems/styx/config.nix +++ b/lass/1systems/styx/config.nix @@ -8,6 +8,7 @@ with import ; + @@ -23,6 +24,8 @@ with import ; # + + ]; krebs.build.host = config.krebs.hosts.styx; diff --git a/lass/2configs/snapclient.nix b/lass/2configs/snapclient.nix new file mode 100644 index 000000000..8015680e9 --- /dev/null +++ b/lass/2configs/snapclient.nix @@ -0,0 +1,12 @@ +{ config, lib, pkgs, ... }: +{ + systemd.services.snapclient = { + wantedBy = [ "multi-user.target" ]; + path = [ pkgs.snapcast ]; + script = "snapclient -h 10.42.0.1"; + serviceConfig = { + DynamicUser = true; + Group = "pipewire"; + }; + }; +} diff --git a/lass/2configs/snapserver.nix b/lass/2configs/snapserver.nix new file mode 100644 index 000000000..3c6dbf750 --- /dev/null +++ b/lass/2configs/snapserver.nix @@ -0,0 +1,13 @@ +{ config, lib, pkgs, ... }: +{ + services.snapserver = { + enable = true; + openFirewall = true; + streams = { + pipewire = { + type = "pipe"; + location = "/run/snapserver/snapfifo"; + }; + }; + }; +} -- cgit v1.2.3 From 48cb415d2fb845ec0c2853f6440bec5fae589930 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sun, 18 Sep 2022 12:19:02 +0200 Subject: home-media: add snapmpv --- lass/2configs/home-media.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lass') diff --git a/lass/2configs/home-media.nix b/lass/2configs/home-media.nix index f250ca8d8..f3908e6be 100644 --- a/lass/2configs/home-media.nix +++ b/lass/2configs/home-media.nix @@ -20,4 +20,15 @@ with import ; krebs.iptables.tables.filter.INPUT.rules = [ { predicate = "-p tcp --dport 4713"; target = "ACCEPT"; } # pulseaudio ]; + + environment.systemPackages = [ + (pkgs.writers.writeDashBin "snapmpv" '' + /run/current-system/sw/bin/mpv \ + --audio-display=no --audio-channels=stereo \ + --audio-samplerate=48000 --audio-format=s16 \ + --ao-pcm-file=/run/snapserver/snapfifo --ao=pcm \ + --audio-delay=-1 \ + "$@" + '') + ]; } -- cgit v1.2.3 From e5aa44907512f0ba97def7549e199d365ff29db6 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 19 Sep 2022 10:59:27 +0200 Subject: l binary-cache-server: use nix-serve-ng --- lass/2configs/binary-cache/server.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lass') diff --git a/lass/2configs/binary-cache/server.nix b/lass/2configs/binary-cache/server.nix index 1abf51ae6..dcc4b5f1a 100644 --- a/lass/2configs/binary-cache/server.nix +++ b/lass/2configs/binary-cache/server.nix @@ -1,6 +1,17 @@ -{ config, lib, pkgs, stockholm, ...}: +{ config, lib, pkgs, ...}: +let + nix-serve-ng-src = builtins.fetchTarball { + # Replace the URL and hash with whatever you actually need + url = "https://github.com/aristanetworks/nix-serve-ng/archive/1937593598bb1285b41804f25cd6f9ddd4d5f1cb.tar.gz"; + sha256 = "1lqd207gbx1wjbhky33d2r8xi6avfbx4v0kpsvn84zaanifdgz2g"; + }; + + nix-serve-ng = import nix-serve-ng-src; + +in { + imports = [ nix-serve-ng.nixosModules.default ]; # generate private key with: # nix-store --generate-binary-cache-key my-secret-key my-public-key services.nix-serve = { -- cgit v1.2.3 From 9d8db2c17e15c3a2b0ea498e728fe854b45d4ed0 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 19 Sep 2022 11:27:16 +0200 Subject: l binary-cache: use nix-serve-ng from haskellPackages --- lass/2configs/binary-cache/server.nix | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'lass') diff --git a/lass/2configs/binary-cache/server.nix b/lass/2configs/binary-cache/server.nix index dcc4b5f1a..30bef5137 100644 --- a/lass/2configs/binary-cache/server.nix +++ b/lass/2configs/binary-cache/server.nix @@ -1,17 +1,8 @@ { config, lib, pkgs, ...}: -let - - nix-serve-ng-src = builtins.fetchTarball { - # Replace the URL and hash with whatever you actually need - url = "https://github.com/aristanetworks/nix-serve-ng/archive/1937593598bb1285b41804f25cd6f9ddd4d5f1cb.tar.gz"; - sha256 = "1lqd207gbx1wjbhky33d2r8xi6avfbx4v0kpsvn84zaanifdgz2g"; - }; - - nix-serve-ng = import nix-serve-ng-src; - -in { - imports = [ nix-serve-ng.nixosModules.default ]; + nixpkgs.config.packageOverrides = p: { + nix-serve = p.haskellPackages.nix-serve-ng; + }; # generate private key with: # nix-store --generate-binary-cache-key my-secret-key my-public-key services.nix-serve = { -- cgit v1.2.3 From 55957c6d6adb51d2079c117c1e7309c60ee0fe0f Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 19 Sep 2022 13:34:16 +0200 Subject: l games: reenable doom --- lass/2configs/games.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lass') diff --git a/lass/2configs/games.nix b/lass/2configs/games.nix index 26707f1f0..01941bde8 100644 --- a/lass/2configs/games.nix +++ b/lass/2configs/games.nix @@ -70,10 +70,10 @@ in { # steam-run # scummvm # dolphinEmu - # doom1 - # doom2 + doom1 + doom2 # protontricks - # vdoom1 + vdoom1 # vdoom2 # vdoomserver retroarchBare -- cgit v1.2.3