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-21 16:59:51 +01:00
|
|
|
pipedName = "piped-uk";
|
|
|
|
containerName = pipedName;
|
2023-09-20 18:44:24 +01:00
|
|
|
|
|
|
|
pipedSocketForComponent = (
|
|
|
|
component: "/var/lib/nixos-containers/${containerName}/var/sockets/piped-${component}.sock"
|
|
|
|
);
|
|
|
|
in {
|
2023-09-21 16:59:51 +01:00
|
|
|
containers.${containerName} = {
|
2023-09-20 18:44:24 +01:00
|
|
|
autoStart = true;
|
|
|
|
privateNetwork = false;
|
|
|
|
|
|
|
|
specialArgs = {
|
|
|
|
inherit inputs;
|
|
|
|
inherit tree;
|
|
|
|
inherit self;
|
|
|
|
inherit hostPath;
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {...}: {
|
|
|
|
nixpkgs.pkgs = pkgs;
|
|
|
|
|
|
|
|
imports = with tree; [
|
|
|
|
presets.nixos.containerBase
|
2023-09-21 16:59:51 +01:00
|
|
|
presets.nixos.pipedNode
|
2023-09-20 18:44:24 +01:00
|
|
|
];
|
|
|
|
|
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";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-09-21 16:59:51 +01:00
|
|
|
services.nginx.virtualHosts."${pipedName}.owo.monster" = {
|
2023-09-20 18:44:24 +01:00
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://unix:${pipedSocketForComponent "frontend"}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-09-21 16:59:51 +01:00
|
|
|
services.nginx.virtualHosts."backend.${pipedName}.owo.monster" = {
|
2023-09-20 18:44:24 +01:00
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://unix:${pipedSocketForComponent "backend"}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-09-21 16:59:51 +01:00
|
|
|
services.nginx.virtualHosts."proxy.${pipedName}.owo.monster" = {
|
2023-09-20 18:44:24 +01:00
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://unix:${pipedSocketForComponent "proxy"}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|