Some changes

This commit is contained in:
baduhai 2023-01-04 13:19:12 -03:00
parent 67faa4a5a8
commit 39eee39807
6 changed files with 26 additions and 132 deletions

View file

@ -33,7 +33,6 @@
kmonad.nixosModules.default
agenix.nixosModule
home-manager.nixosModules.home-manager
self.nixosModules.flood
{ nixpkgs.overlays = [ nur.overlay agenix.overlay ]; }
];
};
@ -65,8 +64,6 @@
};
};
nixosModules.flood = import ./modules/flood.nix;
packages.x86_64-linux = {
install-iso = nixos-generators.nixosGenerate {
system = "x86_64-linux";

View file

@ -2,39 +2,6 @@
{
services = {
transmission = {
enable = true;
group = "hosted";
settings = {
download-dir = "/data/torrent_storage/completed";
incomplete-dir = "/data/torrent_storage/incomplete";
incomplete-dir-enabled = true;
rpc-authentication-required = false;
rpc-host-whitelist-enabled = true;
rpc-whitelist-enabled = true;
peer-port = 57298;
speed-limit-down = 5000;
speed-limit-down-enabled = true;
speed-limit-up = 500;
speed-limit-up-enabled = true;
alt-speed-down = 5000;
alt-speed-enabled = false;
alt-speed-time-begin = 240;
alt-speed-time-day = 127;
alt-speed-time-enabled = true;
alt-speed-time-end = 480;
alt-speed-up = 1500;
utp-enabled = false;
};
};
flood = {
enable = true;
user = "transmission";
group = "hosted";
port = "${config.ports.flood}";
};
jellyfin = {
enable = true;
group = "hosted";

View file

@ -18,7 +18,7 @@
"librespeed" = {
image = "lscr.io/linuxserver/librespeed:latest";
environment = {
TZ = "Europe/Berlin";
TZ = "America/Bahia";
};
ports = [
"${config.ports.librespeed}:80"
@ -27,12 +27,32 @@
"--pull=always"
];
};
"qflood" = {
image = "cr.hotio.dev/hotio/qflood";
environment = {
PUID = "1000";
PGID = "100";
UMASK = "002";
TZ = "America/Bahia";
FLOOD_AUTH = "false";
};
volumes = [
"/data/qflood:/config"
];
ports = [
"${config.ports.flood}:3000"
"${config.ports.qbittorrent}:8080"
];
extraOptions = [
"--pull=always"
];
};
"syncthing" = {
image = "lscr.io/linuxserver/syncthing:1.20.4";
environment = {
PUID = "1000";
PGID = "100";
TZ = "Europe/Berlin";
TZ = "America/Bahia";
};
volumes = [
"/data/syncthing/config:/config"

View file

@ -25,7 +25,7 @@
group = "hosted";
behindProxy = true;
datastorePath = "/data/changedetection";
port = "${config.ports.changedetection-io}";
port = lib.toInt "${config.ports.changedetection-io}";
baseURL = "https://detect.baduhai.me";
};
@ -34,7 +34,7 @@
dataDir = "/data/paperless/data";
mediaDir = "/data/paperless/media";
passwordFile = config.age.secrets.paperless-pass.path;
port = "${config.ports.paperless}";
port = lib.toInt "${config.ports.paperless}";
consumptionDirIsPublic = true;
extraConfig = {
PAPERLESS_OCR_LANGUAGE = "eng+por+deu";
@ -43,7 +43,7 @@
shiori = {
enable = true;
port = "${config.ports.shiori}";
port = lib.toInt "${config.ports.shiori}";
};
n8n.enable = true;

View file

@ -22,6 +22,7 @@ in
jellyfin = mkStringOption "8096";
whoogle = mkStringOption "8007";
flood = mkStringOption "8008";
qbittorrent = mkStringOption "8009";
sonarr = mkStringOption "8989";
prowlarr = mkStringOption "9696";
};

View file

@ -1,91 +0,0 @@
{ config, pkgs, lib, ... }:
with lib;
let cfg = config.services.flood;
in {
options = {
services.flood = {
enable = mkEnableOption (lib.mdDoc "Flood");
runDir = mkOption {
type = types.str;
default = "/var/lib/flood";
};
port = mkOption {
type = types.port;
default = 3030;
description = ''
The port for the Flood web interface
'';
};
openFirewall = mkOption {
type = types.bool;
default = false;
description = lib.mdDoc ''
Open ports in the firewall for the Flood web interface
'';
};
user = mkOption {
type = types.str;
default = "flood";
description = lib.mdDoc "User account under which Flood runs.";
};
group = mkOption {
type = types.str;
default = "flood";
description = lib.mdDoc "Group under which Flood runs.";
};
package = mkOption {
type = types.package;
default = pkgs.flood;
defaultText = literalExpression "pkgs.flood";
description = lib.mdDoc ''
Flood package to use.
'';
};
};
};
config = mkIf cfg.enable {
systemd.tmpfiles.rules =
[ "d '${cfg.runDir}' 0700 ${cfg.user} ${cfg.group} - -" ];
systemd.services.flood = {
enable = true;
description = "Flood torrent UI";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
ExecStart = lib.concatStringsSep " " [
"${pkgs.flood}/bin/flood"
"--port ${toString cfg.port}"
"--host 0.0.0.0"
"--rundir ${cfg.runDir}"
];
User = cfg.user;
Group = cfg.group;
Restart = "on-failure";
};
};
networking.firewall =
mkIf cfg.openFirewall { allowedTCPPorts = [ cfg.port ]; };
users.users = mkIf (cfg.user == "flood") {
flood = {
group = cfg.group;
home = cfg.runDir;
uid = config.ids.uids.flood;
};
};
users.groups =
mkIf (cfg.group == "flood") { flood.gid = config.ids.gids.flood; };
};
}