2023-09-20 18:44:24 +01:00
|
|
|
{
|
|
|
|
self,
|
|
|
|
hostPath,
|
|
|
|
tree,
|
|
|
|
inputs,
|
|
|
|
config,
|
|
|
|
pkgs,
|
2023-09-21 05:06:27 +01:00
|
|
|
lib,
|
2023-09-20 18:44:24 +01:00
|
|
|
...
|
|
|
|
}: let
|
2023-09-21 05:06:27 +01:00
|
|
|
inherit (lib.modules) mkForce;
|
|
|
|
|
2023-09-20 18:44:24 +01:00
|
|
|
containerName = "piped-uk";
|
|
|
|
|
|
|
|
pipedSocketForComponent = (
|
|
|
|
component: "/var/lib/nixos-containers/${containerName}/var/sockets/piped-${component}.sock"
|
|
|
|
);
|
|
|
|
in {
|
|
|
|
containers.piped-uk = {
|
|
|
|
autoStart = true;
|
|
|
|
privateNetwork = false;
|
|
|
|
|
|
|
|
specialArgs = {
|
|
|
|
inherit inputs;
|
|
|
|
inherit tree;
|
|
|
|
inherit self;
|
|
|
|
inherit hostPath;
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {...}: {
|
|
|
|
nixpkgs.pkgs = pkgs;
|
|
|
|
|
|
|
|
imports = with tree; [
|
|
|
|
presets.nixos.containerBase
|
|
|
|
|
|
|
|
profiles.nginx
|
|
|
|
profiles.firewallAllow.httpCommon
|
|
|
|
|
|
|
|
profiles.pipedCluster
|
|
|
|
|
|
|
|
./secrets.nix
|
|
|
|
];
|
|
|
|
|
|
|
|
systemd.tmpfiles.rules = [
|
|
|
|
"d /var/lib/cockroachdb-certs - root root"
|
|
|
|
];
|
|
|
|
|
2023-09-21 05:06:27 +01:00
|
|
|
networking.firewall.enable = mkForce false;
|
|
|
|
|
2023-09-20 18:44:24 +01:00
|
|
|
home-manager.users.root.home.stateVersion = "23.05";
|
|
|
|
system.stateVersion = "23.05";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx.virtualHosts."piped-uk.owo.monster" = {
|
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://unix:${pipedSocketForComponent "frontend"}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx.virtualHosts."backend.piped-uk.owo.monster" = {
|
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://unix:${pipedSocketForComponent "backend"}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx.virtualHosts."proxy.piped-uk.owo.monster" = {
|
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://unix:${pipedSocketForComponent "proxy"}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|