mirror of
https://codeberg.org/muon/home.git
synced 2026-03-09 03:53:11 +00:00
Merge remote-tracking branch 'refs/remotes/origin/main'
This commit is contained in:
commit
8fbcb14ebf
7 changed files with 319 additions and 107 deletions
|
|
@ -1,5 +1,11 @@
|
||||||
{ config, lib, pkgs, inputs, system, ... }:
|
{
|
||||||
let
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
inputs,
|
||||||
|
system,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
cfg = config.mods;
|
cfg = config.mods;
|
||||||
keys = [
|
keys = [
|
||||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKEio+Y5wBVD1wILaH2R3wV10FvVjiqy/4gGBWHOITTB muon@muon"
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKEio+Y5wBVD1wILaH2R3wV10FvVjiqy/4gGBWHOITTB muon@muon"
|
||||||
|
|
@ -45,6 +51,7 @@ in {
|
||||||
mods.server.lemmy.enable = true;
|
mods.server.lemmy.enable = true;
|
||||||
mods.server.audio.enable = true;
|
mods.server.audio.enable = true;
|
||||||
mods.server.atuin.enable = true;
|
mods.server.atuin.enable = true;
|
||||||
|
mods.server.seedbox.enable = true;
|
||||||
|
|
||||||
mods.server.dash.enable = false;
|
mods.server.dash.enable = false;
|
||||||
mods.server.nginx.ports.dash = 3009;
|
mods.server.nginx.ports.dash = 3009;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,9 @@
|
||||||
{ pkgs, lib, config, ... }: {
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
options.mods.server = with lib; {
|
options.mods.server = with lib; {
|
||||||
local.ports = mkOption {
|
local.ports = mkOption {
|
||||||
type = types.attrsOf (types.ints.u16);
|
type = types.attrsOf (types.ints.u16);
|
||||||
|
|
@ -19,6 +24,7 @@
|
||||||
ntfy = 3010;
|
ntfy = 3010;
|
||||||
audio = 3011;
|
audio = 3011;
|
||||||
atuin = 3012;
|
atuin = 3012;
|
||||||
|
stream = 3013;
|
||||||
|
|
||||||
search = 8081;
|
search = 8081;
|
||||||
videos = 8082;
|
videos = 8082;
|
||||||
|
|
@ -33,6 +39,7 @@
|
||||||
prowlarr = 5006;
|
prowlarr = 5006;
|
||||||
flaresolverr = 5007;
|
flaresolverr = 5007;
|
||||||
torrent = 5008;
|
torrent = 5008;
|
||||||
|
seedbox = 5009;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
pavucontrol
|
pavucontrol
|
||||||
|
|
||||||
# Video
|
# Video
|
||||||
(callPackage ./packages/stremio-linux-shell.nix {})
|
# (callPackage ./packages/stremio-linux-shell.nix {})
|
||||||
|
|
||||||
# Podcasts
|
# Podcasts
|
||||||
gpodder
|
gpodder
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ in
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
# ISO downloader
|
# ISO downloader
|
||||||
qbittorrent
|
qbittorrent
|
||||||
xd
|
# xd
|
||||||
biglybt
|
# biglybt
|
||||||
# transmission_4-gtk
|
# transmission_4-gtk
|
||||||
|
|
||||||
# email
|
# email
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,13 @@
|
||||||
{ pkgs, lib, config, ... }:
|
{
|
||||||
|
pkgs,
|
||||||
let
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
cfg = config.mods;
|
cfg = config.mods;
|
||||||
wg = cfg.wireguard;
|
wg = cfg.wireguard;
|
||||||
|
in
|
||||||
in with lib; {
|
with lib; {
|
||||||
options.mods = {
|
options.mods = {
|
||||||
i2p.enable = mkEnableOption "enables i2p network";
|
i2p.enable = mkEnableOption "enables i2p network";
|
||||||
tailscale.enable = mkEnableOption "enables tailscale";
|
tailscale.enable = mkEnableOption "enables tailscale";
|
||||||
|
|
@ -19,7 +22,8 @@ in with lib; {
|
||||||
username = "${config.mods.user.name}";
|
username = "${config.mods.user.name}";
|
||||||
folder = "${config.users.users.${username}.home}/documents/openvpn/";
|
folder = "${config.users.users.${username}.home}/documents/openvpn/";
|
||||||
file = "${config.mods.user.name}.ovpn";
|
file = "${config.mods.user.name}.ovpn";
|
||||||
in mkOption {
|
in
|
||||||
|
mkOption {
|
||||||
description = "the config location";
|
description = "the config location";
|
||||||
default = "${folder}${file}";
|
default = "${folder}${file}";
|
||||||
};
|
};
|
||||||
|
|
@ -72,20 +76,21 @@ in with lib; {
|
||||||
"10.0.0.${toString wg.id}/24"
|
"10.0.0.${toString wg.id}/24"
|
||||||
"fdc9:281f:04d7:9ee9::${toString wg.id}/64"
|
"fdc9:281f:04d7:9ee9::${toString wg.id}/64"
|
||||||
];
|
];
|
||||||
dns = [ "10.0.0.1" "fdc9:281f:04d7:9ee9::1" ];
|
# dns = ["10.0.0.1" "fdc9:281f:04d7:9ee9::1"];
|
||||||
mtu = 1500;
|
mtu = 1500;
|
||||||
privateKeyFile = "/home/muon/wireguard-keys/private";
|
privateKeyFile = "/home/muon/wireguard-keys/private";
|
||||||
|
|
||||||
peers = [{
|
peers = [
|
||||||
|
{
|
||||||
publicKey = "2RF8GmTZwQdzVm2l2piYy6U0qiMU3wSxC7Lt8urAjwA=";
|
publicKey = "2RF8GmTZwQdzVm2l2piYy6U0qiMU3wSxC7Lt8urAjwA=";
|
||||||
presharedKeyFile =
|
presharedKeyFile = "/home/muon/wireguard-keys/psk-${config.networking.hostName}";
|
||||||
"/home/muon/wireguard-keys/psk-${config.networking.hostName}";
|
|
||||||
allowedIPs = ["10.0.0.${toString wg.id}/24"];
|
allowedIPs = ["10.0.0.${toString wg.id}/24"];
|
||||||
# allowedIPs = [ "0.0.0.0/0" ];
|
# allowedIPs = [ "0.0.0.0/0" ];
|
||||||
# ip route add 93.95.230.11 via 192.168.0.1
|
# ip route add 93.95.230.11 via 192.168.0.1
|
||||||
endpoint = "93.95.230.11:51820";
|
endpoint = "93.95.230.11:51820";
|
||||||
persistentKeepalive = 25;
|
persistentKeepalive = 25;
|
||||||
}];
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -98,6 +103,5 @@ in with lib; {
|
||||||
|
|
||||||
# gateway =
|
# gateway =
|
||||||
# "${pkgs.networkmanager}/bin/nmcli dev show ${interface} | ${pkgs.gnugrep}/bin/fgrep IP4.GATEWAY | ${pkgs.awk}/bin/awk {print $2}";
|
# "${pkgs.networkmanager}/bin/nmcli dev show ${interface} | ${pkgs.gnugrep}/bin/fgrep IP4.GATEWAY | ${pkgs.awk}/bin/awk {print $2}";
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,9 @@
|
||||||
{ pkgs, lib, config, ... }: {
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
options.mods.containers = {
|
options.mods.containers = {
|
||||||
enable = lib.mkEnableOption {
|
enable = lib.mkEnableOption {
|
||||||
default = false;
|
default = false;
|
||||||
|
|
@ -6,7 +11,10 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
imports = [ ./steam.nix ];
|
imports = [
|
||||||
|
./steam.nix
|
||||||
|
./seedbox.nix
|
||||||
|
];
|
||||||
|
|
||||||
config = lib.mkIf config.mods.containers.enable {
|
config = lib.mkIf config.mods.containers.enable {
|
||||||
virtualisation.docker.enable = true;
|
virtualisation.docker.enable = true;
|
||||||
|
|
|
||||||
186
modules/nixos/server/containers/seedbox.nix
Normal file
186
modules/nixos/server/containers/seedbox.nix
Normal file
|
|
@ -0,0 +1,186 @@
|
||||||
|
# Auto-generated by compose2nix.
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
cfg = config.mods.server.seedbox;
|
||||||
|
port = config.mods.server.nginx.ports.stream;
|
||||||
|
backend-port = config.mods.server.local.ports.seedbox;
|
||||||
|
in
|
||||||
|
with lib; {
|
||||||
|
options.mods.server.seedbox = {
|
||||||
|
enable = mkEnableOption {
|
||||||
|
default = false;
|
||||||
|
description = "enables seedbox-lite containers";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
# Runtime
|
||||||
|
virtualisation.podman = {
|
||||||
|
enable = true;
|
||||||
|
autoPrune.enable = true;
|
||||||
|
dockerCompat = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Enable container name DNS for all Podman networks.
|
||||||
|
networking.firewall.interfaces = let
|
||||||
|
matchAll =
|
||||||
|
if !config.networking.nftables.enable
|
||||||
|
then "podman+"
|
||||||
|
else "podman*";
|
||||||
|
in {
|
||||||
|
"${matchAll}".allowedUDPPorts = [53];
|
||||||
|
};
|
||||||
|
|
||||||
|
virtualisation.oci-containers.backend = "podman";
|
||||||
|
|
||||||
|
# Containers
|
||||||
|
virtualisation.oci-containers.containers."seedbox-backend" = {
|
||||||
|
image = "localhost/compose2nix/seedbox-backend";
|
||||||
|
volumes = [
|
||||||
|
"seedbox-lite_seedbox_cache:/app/cache:rw"
|
||||||
|
"seedbox-lite_seedbox_data:/app/data:rw"
|
||||||
|
];
|
||||||
|
ports = [
|
||||||
|
"${backend-port}:3001/tcp"
|
||||||
|
];
|
||||||
|
log-driver = "journald";
|
||||||
|
extraOptions = [
|
||||||
|
"--network-alias=seedbox-backend"
|
||||||
|
"--network=seedbox-lite_seedbox-network"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
systemd.services."podman-seedbox-backend" = {
|
||||||
|
serviceConfig = {
|
||||||
|
Restart = lib.mkOverride 90 "always";
|
||||||
|
};
|
||||||
|
after = [
|
||||||
|
"podman-network-seedbox-lite_seedbox-network.service"
|
||||||
|
"podman-volume-seedbox-lite_seedbox_cache.service"
|
||||||
|
"podman-volume-seedbox-lite_seedbox_data.service"
|
||||||
|
];
|
||||||
|
requires = [
|
||||||
|
"podman-network-seedbox-lite_seedbox-network.service"
|
||||||
|
"podman-volume-seedbox-lite_seedbox_cache.service"
|
||||||
|
"podman-volume-seedbox-lite_seedbox_data.service"
|
||||||
|
];
|
||||||
|
partOf = [
|
||||||
|
"podman-compose-seedbox-lite-root.target"
|
||||||
|
];
|
||||||
|
wantedBy = [
|
||||||
|
"podman-compose-seedbox-lite-root.target"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
virtualisation.oci-containers.containers."seedbox-frontend" = {
|
||||||
|
image = "localhost/compose2nix/seedbox-frontend";
|
||||||
|
ports = [
|
||||||
|
"${port}:80/tcp"
|
||||||
|
];
|
||||||
|
dependsOn = [
|
||||||
|
"seedbox-backend"
|
||||||
|
];
|
||||||
|
log-driver = "journald";
|
||||||
|
extraOptions = [
|
||||||
|
"--network-alias=seedbox-frontend"
|
||||||
|
"--network=seedbox-lite_seedbox-network"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
systemd.services."podman-seedbox-frontend" = {
|
||||||
|
serviceConfig = {
|
||||||
|
Restart = lib.mkOverride 90 "always";
|
||||||
|
};
|
||||||
|
after = [
|
||||||
|
"podman-network-seedbox-lite_seedbox-network.service"
|
||||||
|
];
|
||||||
|
requires = [
|
||||||
|
"podman-network-seedbox-lite_seedbox-network.service"
|
||||||
|
];
|
||||||
|
partOf = [
|
||||||
|
"podman-compose-seedbox-lite-root.target"
|
||||||
|
];
|
||||||
|
wantedBy = [
|
||||||
|
"podman-compose-seedbox-lite-root.target"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Networks
|
||||||
|
systemd.services."podman-network-seedbox-lite_seedbox-network" = {
|
||||||
|
path = [pkgs.podman];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
RemainAfterExit = true;
|
||||||
|
ExecStop = "podman network rm -f seedbox-lite_seedbox-network";
|
||||||
|
};
|
||||||
|
script = ''
|
||||||
|
podman network inspect seedbox-lite_seedbox-network || podman network create seedbox-lite_seedbox-network --driver=bridge
|
||||||
|
'';
|
||||||
|
partOf = ["podman-compose-seedbox-lite-root.target"];
|
||||||
|
wantedBy = ["podman-compose-seedbox-lite-root.target"];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Volumes
|
||||||
|
systemd.services."podman-volume-seedbox-lite_seedbox_cache" = {
|
||||||
|
path = [pkgs.podman];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
RemainAfterExit = true;
|
||||||
|
};
|
||||||
|
script = ''
|
||||||
|
podman volume inspect seedbox-lite_seedbox_cache || podman volume create seedbox-lite_seedbox_cache --driver=local
|
||||||
|
'';
|
||||||
|
partOf = ["podman-compose-seedbox-lite-root.target"];
|
||||||
|
wantedBy = ["podman-compose-seedbox-lite-root.target"];
|
||||||
|
};
|
||||||
|
systemd.services."podman-volume-seedbox-lite_seedbox_data" = {
|
||||||
|
path = [pkgs.podman];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
RemainAfterExit = true;
|
||||||
|
};
|
||||||
|
script = ''
|
||||||
|
podman volume inspect seedbox-lite_seedbox_data || podman volume create seedbox-lite_seedbox_data --driver=local
|
||||||
|
'';
|
||||||
|
partOf = ["podman-compose-seedbox-lite-root.target"];
|
||||||
|
wantedBy = ["podman-compose-seedbox-lite-root.target"];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Builds
|
||||||
|
systemd.services."podman-build-seedbox-backend" = {
|
||||||
|
path = [pkgs.podman pkgs.git];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
TimeoutSec = 300;
|
||||||
|
};
|
||||||
|
script = ''
|
||||||
|
cd /home/muon/projects/seedbox-lite/server
|
||||||
|
podman build -t compose2nix/seedbox-backend .
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
systemd.services."podman-build-seedbox-frontend" = {
|
||||||
|
path = [pkgs.podman pkgs.git];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
TimeoutSec = 300;
|
||||||
|
};
|
||||||
|
script = ''
|
||||||
|
cd /tmp
|
||||||
|
git clone https://github.com/hotheadhacker/seedbox-lite.git
|
||||||
|
cd seedbox-lite/client
|
||||||
|
podman build -t compose2nix/seedbox-frontend --build-arg VITE_API_BASE_URL=http://localhost:${backend-port} .
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# Root service
|
||||||
|
# When started, this will automatically create all resources and start
|
||||||
|
# the containers. When stopped, this will teardown all resources.
|
||||||
|
systemd.targets."podman-compose-seedbox-lite-root" = {
|
||||||
|
unitConfig = {
|
||||||
|
Description = "Root target generated by compose2nix.";
|
||||||
|
};
|
||||||
|
wantedBy = ["multi-user.target"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue