diff --git a/.gitmodules b/.gitmodules index d71c6a72..eb472877 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ [submodule "dotfiles/config/alacritty/themes"] path = dotfiles/config/alacritty/themes url = https://github.com/alacritty/alacritty-theme +[submodule "nixos/railbird.ai"] + path = nixos/railbird.ai + url = git@github.com:billnerds/railbird.ai.git diff --git a/nixos/cache-server.nix b/nixos/cache-server.nix index 6b6b4ba6..d6300545 100644 --- a/nixos/cache-server.nix +++ b/nixos/cache-server.nix @@ -1,20 +1,45 @@ -{ config, makeEnable, ... }: -makeEnable config "modules.cache-server" false { - age.secrets."cache-priv-key.pem".file = ./secrets/cache-priv-key.pem.age; - - services.nix-serve = { - enable = true; - secretKeyFile = config.age.secrets."cache-priv-key.pem".path; - port = 5050; +{ config, makeEnable, lib, ... }: +with lib; +let cfg = config.modules.cache-server; +in +{ + options = { + modules.cache-server = { + enable = mkEnableOption "nix cache server"; + port = mkOption { + type = types.int; + default = 8080; + }; + host-string = mkOption { + type = types.string; + default = "0.0.0.0"; + }; + path = mkOption { + type = types.string; + default = "/"; + }; + }; }; - services.nginx = { - enable = true; - recommendedProxySettings = true; - virtualHosts = { - "0.0.0.0" = { - locations."/".proxyPass = "http://${config.services.nix-serve.bindAddress}:${toString config.services.nix-serve.port}"; + config = mkIf cfg.enable { + age.secrets."cache-priv-key.pem".file = ./secrets/cache-priv-key.pem.age; + + services.nix-serve = { + enable = true; + secretKeyFile = config.age.secrets."cache-priv-key.pem".path; + port = 5050; + }; + + services.nginx = { + enable = true; + recommendedProxySettings = true; + virtualHosts = { + "${cfg.host-string}" = { + locations."${cfg.path}".proxyPass = "http://${config.services.nix-serve.bindAddress}:${toString config.services.nix-serve.port}"; + listen = [ { addr = "0.0.0.0"; port = cfg.port; } ]; + }; }; }; }; } + diff --git a/nixos/machines/biskcomp.nix b/nixos/machines/biskcomp.nix index 42e83388..11671aba 100644 --- a/nixos/machines/biskcomp.nix +++ b/nixos/machines/biskcomp.nix @@ -15,7 +15,28 @@ modules.syncthing.enable = true; modules.fonts.enable = true; modules.nixified-ai.enable = false; - modules.cache-server.enable = true; + modules.cache-server = { + enable = true; + host-string = "192.168.1.44 railbird.ai 1896Folsom.duckdns.org 0.0.0.0 67.162.131.71"; + port = 80; + path = "/nix-cache"; + }; + + services.nginx = { + enable = true; + recommendedProxySettings = true; + recommendedGzipSettings = true; + recommendedTlsSettings = true; + virtualHosts = let conf = { + root = ../railbird.ai; + locations."/" = { + index = "index.html"; + }; + }; + in { + "192.168.1.44 railbird.ai 1896Folsom.duckdns.org 0.0.0.0 67.162.131.71" = conf; + }; + }; services.plex = { enable = true; diff --git a/nixos/railbird.ai b/nixos/railbird.ai new file mode 160000 index 00000000..74ee66bc --- /dev/null +++ b/nixos/railbird.ai @@ -0,0 +1 @@ +Subproject commit 74ee66bcb6c3a1ba509d1e78435e391255dc0647