nixfiles/nixos/boxes/colony/vms/shill/containers/middleman.nix

64 lines
1.5 KiB
Nix

{ lib, ...}: {
nixos.systems.middleman = {
system = "x86_64-linux";
nixpkgs = "mine";
assignments = {
internal = {
name = "middleman-ctr";
altNames = [ "http" ];
ipv4.address = "${lib.my.colony.start.ctrs.v4}2";
ipv6 = {
iid = "::2";
address = "${lib.my.colony.start.ctrs.v6}2";
};
};
};
configuration = { lib, config, assignments, ... }:
let
inherit (lib) mkMerge mkIf;
inherit (lib.my) networkdAssignment;
in
{
config = mkMerge [
{
my = {
server.enable = true;
secrets = {
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAuvP9DEsffop53Fsh7xIdeVyQSF6tSKrOUs2faq6rip";
};
firewall = {
tcp.allowed = [ "http" "https" ];
};
tmproot.persistence.config.directories = [
];
};
systemd = {
network.networks."80-container-host0" = networkdAssignment "host0" assignments.internal;
};
services = {
nginx = {
enable = true;
enableReload = true;
};
};
}
(mkIf config.my.build.isDevVM {
virtualisation = {
forwardPorts = [
{ from = "host"; host.port = 8080; guest.port = 80; }
{ from = "host"; host.port = 8443; guest.port = 443; }
];
};
})
];
};
};
}