diff --git a/flake.nix b/flake.nix index 00c257b..06490e0 100755 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,7 @@ elmskell-blog.url = "git+file:///var/lib/git-server/blog.git"; jank-client.url = "git+file:///var/lib/git-server/jank-client-fork.git"; + math-project.url = "git+file:///var/lib/git-server/math-project.git"; }; outputs = { @@ -16,6 +17,7 @@ elmskell-blog, spacebar-server, jank-client, + math-project, ... }: let system = "x86_64-linux"; @@ -44,6 +46,10 @@ noshell.nixosModules.default {programs.noshell.enable = true;} + math-project.nixosModules.default + {programs.math-project.enable = true;} + ./services/math-project.nix + ./configuration.nix ]; }; diff --git a/services/ferron.nix b/services/ferron.nix index c300d29..c694a57 100755 --- a/services/ferron.nix +++ b/services/ferron.nix @@ -21,6 +21,10 @@ domain = "blog.mtgmonkey.net"; proxyTo = "http://localhost:9181/"; } + { + domain = "math.mtgmonkey.net"; + proxyTo = "http://localhost:9282/"; + } { domain = "git.mtgmonkey.net"; proxyTo = "http://localhost:8000/"; @@ -35,9 +39,8 @@ } { domain = "translate.mtgmonkey.net"; - proxyTo = "http://localhost:9109/" + proxyTo = "http://localhost:9109/"; } - ]; }; in { diff --git a/services/math-project.nix b/services/math-project.nix new file mode 100755 index 0000000..af31585 --- /dev/null +++ b/services/math-project.nix @@ -0,0 +1,49 @@ +{ + pkgs, + lib, + math-project, + ... +}: let + botPolicies-nix = { + dnsbl = false; + status_codes = { + CHALLENGE = 200; + DENY = 200; + }; + bots = [ + { + name = "catch-everything"; + user_agent_regex = ".*"; + action = "CHALLENGE"; + } + ]; + }; +in { + services.anubis = { + instances.math-project = { + enable = true; + settings = { + BIND = "[::1]:9282"; + BIND_NETWORK = "tcp"; + DIFFICULTY = 4; + METRICS_BIND = "[::1]:9283"; + METRICS_BIND_NETWORK = "tcp"; + POLICY_FNAME = "/etc/anubis/math-project.botPolicies.yaml"; + TARGET = "http://localhost:8080"; + }; + }; + }; + + environment.etc."anubis/math-project.botPolicies.yaml" = { + source = (pkgs.formats.yaml {}).generate "" botPolicies-nix; + mode = "644"; + }; + + systemd.services.math-project = { + serviceConfig = { + Type = "simple"; + ExecStart = "${lib.getExe math-project}"; + RemainAfterExit = true; + }; + }; +}