summaryrefslogtreecommitdiffstats
path: root/lass
diff options
context:
space:
mode:
Diffstat (limited to 'lass')
-rw-r--r--lass/2configs/paste.nix42
-rw-r--r--lass/5pkgs/default.nix18
2 files changed, 51 insertions, 9 deletions
diff --git a/lass/2configs/paste.nix b/lass/2configs/paste.nix
index affc35307..cfd7f5576 100644
--- a/lass/2configs/paste.nix
+++ b/lass/2configs/paste.nix
@@ -61,6 +61,11 @@ with import <stockholm/lib>;
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,43 @@ with import <stockholm/lib>;
". ${pkgs.htgen}/examples/paste"
];
};
+
+ 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 */ ''
+ 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 */ ''
diff --git a/lass/5pkgs/default.nix b/lass/5pkgs/default.nix
index e4208f1c1..6fa93e146 100644
--- a/lass/5pkgs/default.nix
+++ b/lass/5pkgs/default.nix
@@ -1,24 +1,24 @@
-with import <stockholm/lib>;
self: super: let
+ lib = super.lib;
# This callPackage will try to detect obsolete overrides.
callPackage = path: args: let
override = super.callPackage path args;
- upstream = optionalAttrs (override ? "name")
- (super.${(parseDrvName override.name).name} or {});
+ upstream = lib.optionalAttrs (override ? "name")
+ (super.${(builtins.parseDrvName override.name).name} or {});
in if upstream ? "name" &&
override ? "name" &&
- compareVersions upstream.name override.name != -1
+ builtins.compareVersions upstream.name override.name != -1
then
- trace
+ builtins.trace
"Upstream `${upstream.name}' gets overridden by `${override.name}'."
override
else override;
subdirsOf = path:
- mapAttrs (name: _: path + "/${name}")
- (filterAttrs (_: eq "directory") (readDir path));
+ lib.mapAttrs (name: _: path + "/${name}")
+ (lib.filterAttrs (_: x: x == "directory") (builtins.readDir path));
-in mapAttrs (_: flip callPackage {})
- (filterAttrs (_: dir: pathExists (dir + "/default.nix"))
+in lib.mapAttrs (_: lib.flip callPackage {})
+ (lib.filterAttrs (_: dir: lib.pathExists (dir + "/default.nix"))
(subdirsOf ./.))