Compare commits
20 commits
master
...
feat/soulb
| Author | SHA1 | Date | |
|---|---|---|---|
| b782d74647 | |||
| d99ec5e25b | |||
| d6fc70612a | |||
| 003b6c277b | |||
| 0462478d7e | |||
| c93496cb84 | |||
| 789f9b9cd3 | |||
| cb34055830 | |||
| 02a3207d08 | |||
| 8778adf3bc | |||
| 30d3063c9b | |||
| 59bbe127d6 | |||
| 5b666bf576 | |||
| 20b5d96686 | |||
| 4b19491ec7 | |||
| f1defd435a | |||
| 042a04cbfc | |||
| 0d89b2a64f | |||
| 4e19a6378b | |||
| c36a3f09de |
9 changed files with 98 additions and 7 deletions
|
|
@ -1,22 +1,42 @@
|
||||||
{ ... }: {
|
{ ... }: {
|
||||||
system.stateVersion = "25.11";
|
system.stateVersion = "25.11";
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
"d /persist/slskd/Downloads 755 slskd slskd"
|
"d /persist/slskd/downloads 755 slskd slskd"
|
||||||
];
|
];
|
||||||
fileSystems."/var/lib/slskd" = {
|
fileSystems."/var/lib/slskd" = {
|
||||||
device = "/persist/slskd";
|
device = "/persist/slskd";
|
||||||
fsType = "none";
|
fsType = "none";
|
||||||
options = [ "bind" ];
|
options = [ "bind" ];
|
||||||
};
|
};
|
||||||
|
fileSystems."/var/lib/tailscale" = {
|
||||||
|
device = "/persist/tailscale";
|
||||||
|
fsType = "none";
|
||||||
|
options = [ "bind" ];
|
||||||
|
};
|
||||||
networking.firewall.allowedTCPPorts = [ 5030 50300 ];
|
networking.firewall.allowedTCPPorts = [ 5030 50300 ];
|
||||||
networking.firewall.allowedUDPPorts = [ 5030 50300 ];
|
networking.firewall.allowedUDPPorts = [ 5030 50300 ];
|
||||||
|
|
||||||
|
services.tailscale = {
|
||||||
|
enable = true;
|
||||||
|
authKeyFile = "/binds/tailscale_auth";
|
||||||
|
openFirewall = true;
|
||||||
|
# interfaceName = "userspace-networking";
|
||||||
|
# extraDaemonFlags = [ "--socks5-server=localhost:1055" ];
|
||||||
|
extraSetFlags = [ "--exit-node=100.67.1.1" ];
|
||||||
|
useRoutingFeatures = "client";
|
||||||
|
};
|
||||||
|
|
||||||
services.slskd = {
|
services.slskd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
domain = null;
|
domain = null;
|
||||||
environmentFile = "/binds/slskd_env";
|
environmentFile = "/binds/slskd_env";
|
||||||
settings = {
|
settings = {
|
||||||
shares.directories = [ "/binds/music/" ];
|
shares.directories = [ "/binds/music/" ];
|
||||||
|
# soulseek.connection.proxy = {
|
||||||
|
# enabled = true;
|
||||||
|
# address = "localhost";
|
||||||
|
# port = "1055";
|
||||||
|
# };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,18 +16,27 @@
|
||||||
host4 = subnet4 1;
|
host4 = subnet4 1;
|
||||||
client4 = subnet4 2;
|
client4 = subnet4 2;
|
||||||
|
|
||||||
|
clientTun = "100.67.2.101";
|
||||||
|
|
||||||
modules = [
|
modules = [
|
||||||
./configuration.nix
|
./configuration.nix
|
||||||
{
|
{
|
||||||
networking.useHostResolvConf = false;
|
networking.useHostResolvConf = false;
|
||||||
networking.nameservers = [ host ];
|
networking.nameservers = [ "8.8.8.8" ];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
in {
|
in {
|
||||||
nixosConfigurations.container = nixpkgs.lib.nixosSystem {
|
nixosConfigurations.container = nixpkgs.lib.nixosSystem {
|
||||||
inherit modules;
|
inherit modules;
|
||||||
};
|
};
|
||||||
nixosModule = { config, ... }: {
|
nixosModule = { config, ... }: let
|
||||||
|
hostfqdn = "${config.networking.hostName}.lava.moe";
|
||||||
|
altfqdn = "fluorite.${hostfqdn}";
|
||||||
|
# TODO: HACK
|
||||||
|
listenAddr = if (config.networking.hostName == "alyssum")
|
||||||
|
then [ "100.67.2.1" ]
|
||||||
|
else [ "10.0.0.1" "[fd0d::1]" "100.67.1.1" ];
|
||||||
|
in {
|
||||||
networking.nat = {
|
networking.nat = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableIPv6 = true;
|
enableIPv6 = true;
|
||||||
|
|
@ -38,8 +47,16 @@
|
||||||
services.nginx.virtualHosts."${fqdn}" = {
|
services.nginx.virtualHosts."${fqdn}" = {
|
||||||
useACMEHost = "lava.moe";
|
useACMEHost = "lava.moe";
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
locations."/".proxyPass = "http://[${client}]:5030";
|
locations."/".proxyPass = "http://${clientTun}:5030";
|
||||||
listenAddresses = [ "10.0.0.1" "[fd0d::1]" "100.67.1.1" ];
|
listenAddresses = listenAddr;
|
||||||
|
};
|
||||||
|
|
||||||
|
security.acme.certs.${hostfqdn} = { extraDomainNames = [ "*.${hostfqdn}" ]; };
|
||||||
|
services.nginx.virtualHosts."${altfqdn}" = {
|
||||||
|
useACMEHost = hostfqdn;
|
||||||
|
forceSSL = true;
|
||||||
|
locations."/".proxyPass = "http://${clientTun}:5030";
|
||||||
|
listenAddresses = listenAddr;
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
|
|
@ -49,6 +66,7 @@
|
||||||
containers.${name} = {
|
containers.${name} = {
|
||||||
autoStart = true;
|
autoStart = true;
|
||||||
privateNetwork = true;
|
privateNetwork = true;
|
||||||
|
enableTun = true;
|
||||||
hostAddress = host4;
|
hostAddress = host4;
|
||||||
localAddress = client4;
|
localAddress = client4;
|
||||||
hostAddress6 = host;
|
hostAddress6 = host;
|
||||||
|
|
@ -82,6 +100,11 @@
|
||||||
mountPoint = "/binds/slskd_env";
|
mountPoint = "/binds/slskd_env";
|
||||||
isReadOnly = true;
|
isReadOnly = true;
|
||||||
};
|
};
|
||||||
|
bindMounts."tailscale_auth" = {
|
||||||
|
hostPath = config.age.secrets.tailscale_auth.path;
|
||||||
|
mountPoint = "/binds/tailscale_auth";
|
||||||
|
isReadOnly = true;
|
||||||
|
};
|
||||||
# flake = "path:" + ./.;
|
# flake = "path:" + ./.;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
age.secrets = {
|
age.secrets = {
|
||||||
acme_dns.file = ../../secrets/acme_dns.age;
|
acme_dns.file = ../../secrets/acme_dns.age;
|
||||||
|
slskd_env.file = ../../secrets/slskd_env.age;
|
||||||
wpa_conf = {
|
wpa_conf = {
|
||||||
file = ../../secrets/wpa_conf.age;
|
file = ../../secrets/wpa_conf.age;
|
||||||
path = "/etc/wpa_supplicant/imperative.conf";
|
path = "/etc/wpa_supplicant/imperative.conf";
|
||||||
|
|
@ -24,8 +25,10 @@
|
||||||
tailscale
|
tailscale
|
||||||
|
|
||||||
modules.services.nginx
|
modules.services.nginx
|
||||||
|
modules.services.soulbeet
|
||||||
modules.services.syncthing
|
modules.services.syncthing
|
||||||
|
|
||||||
|
inputs.c-fluorite.nixosModule
|
||||||
inputs.c-garnet.nixosModule
|
inputs.c-garnet.nixosModule
|
||||||
|
|
||||||
./filesystem.nix
|
./filesystem.nix
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@
|
||||||
inputs.c-citrine.nixosModule
|
inputs.c-citrine.nixosModule
|
||||||
inputs.c-diamond.nixosModule
|
inputs.c-diamond.nixosModule
|
||||||
inputs.c-emerald.nixosModule
|
inputs.c-emerald.nixosModule
|
||||||
inputs.c-fluorite.nixosModule
|
|
||||||
|
|
||||||
./filesystem.nix
|
./filesystem.nix
|
||||||
./kernel.nix
|
./kernel.nix
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ in {
|
||||||
./services/nginx.nix
|
./services/nginx.nix
|
||||||
./services/postgres.nix
|
./services/postgres.nix
|
||||||
./services/sonarr.nix
|
./services/sonarr.nix
|
||||||
|
./services/soulbeet.nix
|
||||||
./services/synapse.nix
|
./services/synapse.nix
|
||||||
./services/syncthing.nix
|
./services/syncthing.nix
|
||||||
./services/tmptsync.nix
|
./services/tmptsync.nix
|
||||||
|
|
|
||||||
32
modules/services/soulbeet.nix
Normal file
32
modules/services/soulbeet.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
{ ... }:
|
||||||
|
let
|
||||||
|
dir_data = "/persist/services/soulbeet/data";
|
||||||
|
dir_downloads = "/persist/containers/fluorite/slskd/downloads";
|
||||||
|
dir_music = "/persist/media/music";
|
||||||
|
in {
|
||||||
|
systemd.tmpfiles.rules = [
|
||||||
|
"d ${dir_data} 700 root root"
|
||||||
|
"d ${dir_downloads} 755 root users"
|
||||||
|
"d ${dir_music} 075 nobody users"
|
||||||
|
];
|
||||||
|
virtualisation.oci-containers.backend = "docker";
|
||||||
|
virtualisation.oci-containers.containers = {
|
||||||
|
container-name = {
|
||||||
|
image = "docker.io/docccccc/soulbeet:latest";
|
||||||
|
autoStart = true;
|
||||||
|
ports = [ "9765:9765" ];
|
||||||
|
environment = {
|
||||||
|
DATABASE_URL = "sqlite:/data/soulbeet.db";
|
||||||
|
DOWNLOAD_PATH = "/downloads";
|
||||||
|
SECRET_KEY = "change-me-in-production";
|
||||||
|
NAVIDROME_URL = "http://navidrome:4533";
|
||||||
|
BEETS_CONFIG = "/config/config.yaml";
|
||||||
|
};
|
||||||
|
volumes = [
|
||||||
|
"${dir_data}:/data"
|
||||||
|
"${dir_downloads}:/downloads"
|
||||||
|
"${dir_music}:/music"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -4,6 +4,19 @@
|
||||||
networking.firewall.trustedInterfaces = [ "tailscale0" ];
|
networking.firewall.trustedInterfaces = [ "tailscale0" ];
|
||||||
networking.firewall.allowedUDPPorts = lib.mkIf (config.me.environment == "headless") [ 123 ];
|
networking.firewall.allowedUDPPorts = lib.mkIf (config.me.environment == "headless") [ 123 ];
|
||||||
|
|
||||||
|
networking.nat = lib.mkIf (config.networking.hostName == "dandelion") {
|
||||||
|
enable = true;
|
||||||
|
externalInterface = "enp0s6";
|
||||||
|
internalInterfaces = [ "tailscale0" ];
|
||||||
|
forwardPorts = [
|
||||||
|
{
|
||||||
|
sourcePort = 50300;
|
||||||
|
proto = "tcp";
|
||||||
|
destination = "100.67.2.101:50300";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
networking.firewall.allowedTCPPorts = [ 50300 ];
|
||||||
services.tailscale = {
|
services.tailscale = {
|
||||||
enable = true;
|
enable = true;
|
||||||
authKeyFile = config.age.secrets.tailscale_auth.path;
|
authKeyFile = config.age.secrets.tailscale_auth.path;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ in {
|
||||||
|
|
||||||
"secrets/acme_dns.age".publicKeys = [ alyssum dandelion hazel rin ];
|
"secrets/acme_dns.age".publicKeys = [ alyssum dandelion hazel rin ];
|
||||||
"secrets/navidrome_env.age".publicKeys = [ anemone dandelion rin ];
|
"secrets/navidrome_env.age".publicKeys = [ anemone dandelion rin ];
|
||||||
"secrets/slskd_env.age".publicKeys = [ anemone dandelion rin ];
|
"secrets/slskd_env.age".publicKeys = [ alyssum anemone dandelion rin ];
|
||||||
"secrets/tailscale_auth.age".publicKeys = [ alyssum anemone blossom dandelion rin ];
|
"secrets/tailscale_auth.age".publicKeys = [ alyssum anemone blossom dandelion rin ];
|
||||||
"secrets/warden_admin.age".publicKeys = [ rin ];
|
"secrets/warden_admin.age".publicKeys = [ rin ];
|
||||||
"secrets/wg_anemone.age".publicKeys = [ anemone rin ];
|
"secrets/wg_anemone.age".publicKeys = [ anemone rin ];
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue