Add jackett config and generate colmena hosts from attribute set

This commit is contained in:
fi 2023-07-16 02:00:44 +02:00
commit 64d9dbd4b0
Signed by: fi
SSH key fingerprint: SHA256:d+6fQoDPMbSFK95zRVflRKZLRKF4cPSQb7VIxYkhFsA
9 changed files with 45 additions and 47 deletions

6
flake.lock generated
View file

@ -2,11 +2,11 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1689282004, "lastModified": 1689373857,
"narHash": "sha256-VNhuyb10c9SV+3hZOlxwJwzEGytZ31gN9w4nPCnNvdI=", "narHash": "sha256-mtBksyvhhT98Zsm9tYHuMKuLwUKDwv+BGTl6K5nOGhY=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e74e68449c385db82de3170288a28cd0f608544f", "rev": "dfdbcc428f365071f0ca3888f6ec8c25c3792885",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -3,49 +3,41 @@
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
}; };
outputs = { nixpkgs, ... }: { outputs = { self, nixpkgs, ... }: {
hosts = {
nitter = {
site = "vs";
};
nixos-coturn = {
site = "vs";
};
tor-relay = {
site = "vs";
};
jackett = {
site = "vs";
};
};
generateColmenaHost = name: host : {
deployment = {
targetHost = "${name}.${host.site}.grzb.de";
targetUser = "colmena-deploy";
};
imports = [
./configuration/common
./configuration/proxmox-vm
./hosts/${name}
];
};
colmena = { colmena = {
meta = { meta = {
nixpkgs = import nixpkgs { nixpkgs = import nixpkgs {
system = "x86_64-linux"; system = "x86_64-linux";
}; };
}; };
} // builtins.mapAttrs (self.generateColmenaHost) self.hosts;
nitter = { name, nodes, pkgs, ... }: {
deployment = {
targetHost = "nitter.vs.grzb.de";
targetUser = "colmena-deploy";
};
imports = [
./configuration/common
./configuration/proxmox-vm
./hosts/nitter
];
};
coturn = { name, nodes, pkgs, ... }: {
deployment = {
targetHost = "nixos-coturn.vs.grzb.de";
targetUser = "colmena-deploy";
};
imports = [
./configuration/common
./configuration/proxmox-vm
./hosts/coturn
];
};
tor-relay = { name, nodes, pkgs, ...}: {
deployment = {
targetHost = "tor-relay.vs.grzb.de";
targetUser = "colmena-deploy";
};
imports = [
./configuration/common
./configuration/proxmox-vm
./hosts/tor-relay
];
};
};
}; };
} }

View file

@ -1,10 +1,9 @@
{ config, pkgs, ... }: { ... }:
{ {
imports = [ boot.loader.grub = {
./hardware-configuration.nix enable = true;
./jackett.nix device = "/dev/vda";
]; };
networking = { networking = {
hostName = "jackett"; hostName = "jackett";

View file

@ -0,0 +1,7 @@
{ ... }:
{
imports = [
./configuration.nix
./jackett.nix
];
}

View file

@ -1,4 +1,4 @@
{ config, pkgs, ... }: { ... }:
{ {
boot.loader.grub = { boot.loader.grub = {
enable = true; enable = true;

View file

@ -0,0 +1,14 @@
{ ... }:
{
boot.loader.grub = {
enable = true;
device = "/dev/vda";
};
networking = {
hostName = "coturn";
firewall.enable = false;
};
system.stateVersion = "23.05";
}

View file

@ -0,0 +1,45 @@
{ ... }:
{
services.coturn = {
enable = true;
min-port = 49200;
max-port = 49500;
use-auth-secret = true;
static-auth-secret-file = "/secrets/static-auth-secret.secret";
realm = "turn.nekover.se";
cert = "/certs/turn.nekover.se/fullchain.pem";
pkey = "/certs/turn.nekover.se/key.pem";
no-tcp-relay = true;
extraConfig = "
external-ip=170.133.2.81/10.202.41.118
prometheus
syslog
no-tlsv1
no-tlsv1_1
denied-peer-ip=10.0.0.0-10.255.255.255
denied-peer-ip=192.168.0.0-192.168.255.255
denied-peer-ip=172.16.0.0-172.31.255.255
no-multicast-peers
denied-peer-ip=0.0.0.0-0.255.255.255
denied-peer-ip=100.64.0.0-100.127.255.255
denied-peer-ip=127.0.0.0-127.255.255.255
denied-peer-ip=169.254.0.0-169.254.255.255
denied-peer-ip=192.0.0.0-192.0.0.255
denied-peer-ip=192.0.2.0-192.0.2.255
denied-peer-ip=192.88.99.0-192.88.99.255
denied-peer-ip=198.18.0.0-198.19.255.255
denied-peer-ip=198.51.100.0-198.51.100.255
denied-peer-ip=203.0.113.0-203.0.113.255
denied-peer-ip=240.0.0.0-255.255.255.255
allowed-peer-ip=10.202.41.118
user-quota=12
total-quota=1200
";
};
}

View file

@ -0,0 +1,8 @@
{ ... }:
{
imports = [
./configuration.nix
./secrets.nix
./coturn.nix
];
}

View file

@ -0,0 +1,11 @@
{ ... }:
{
deployment.keys."static-auth-secret.secret" = {
keyCommand = [ "env" "GNUPGHOME=/home/yuri/.passinfra_gnupg" "PASSWORD_STORE_DIR=/home/yuri/pass/infra" "pass" "coturn/static-auth-secret" ];
destDir = "/secrets";
user = "turnserver";
group = "turnserver";
permissions = "0640";
uploadAt = "pre-activation";
};
}