more progress
This commit is contained in:
parent
a03240d99d
commit
f1c89a0ec1
31 changed files with 256 additions and 487 deletions
Binary file not shown.
Before Width: | Height: | Size: 11 KiB |
|
@ -1,36 +0,0 @@
|
|||
{ config, lib, pkgs, user, ... }:
|
||||
let
|
||||
inherit (lib) mkIf mkDefault;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) nullOr enum;
|
||||
|
||||
cfg = config.modules.${user}.themes;
|
||||
in {
|
||||
options.modules.${user}.themes = {
|
||||
enable = mkEnableOption "Theming (Stylix)";
|
||||
|
||||
theme = mkOption {
|
||||
type = nullOr (enum [ "everforest" "catppuccin-latte" "chalk" ]);
|
||||
default = "everforest";
|
||||
description = "The theme to set the system to";
|
||||
example = "everforest";
|
||||
};
|
||||
|
||||
polarity = mkOption {
|
||||
type = nullOr (enum [ "dark" "light" ]);
|
||||
default = "dark";
|
||||
description = "determine if system is in dark or light mode";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf (cfg.enable) {
|
||||
modules.theming.enable = true;
|
||||
|
||||
stylix = {
|
||||
base16Scheme = "${pkgs.base16-schemes}/share/themes/${cfg.theme}.yaml";
|
||||
image = ./${cfg.theme}.jpg;
|
||||
polarity = cfg.polarity;
|
||||
targets.qt.platform = mkDefault "kde6";
|
||||
};
|
||||
};
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 183 KiB |
|
@ -1,144 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.qbittorrent;
|
||||
UID = 888;
|
||||
GID = 888;
|
||||
in
|
||||
{
|
||||
options.services.qbittorrent = {
|
||||
enable = mkEnableOption (lib.mdDoc "qBittorrent headless");
|
||||
|
||||
dataDir = mkOption {
|
||||
type = types.path;
|
||||
default = "/var/lib/qbittorrent";
|
||||
description = lib.mdDoc ''
|
||||
The directory where qBittorrent stores its data files.
|
||||
'';
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
default = "qbittorrent";
|
||||
description = lib.mdDoc ''
|
||||
User account under which qBittorrent runs.
|
||||
'';
|
||||
};
|
||||
|
||||
group = mkOption {
|
||||
type = types.str;
|
||||
default = "qbittorrent";
|
||||
description = lib.mdDoc ''
|
||||
Group under which qBittorrent runs.
|
||||
'';
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
default = 8080;
|
||||
description = lib.mdDoc ''
|
||||
qBittorrent web UI port.
|
||||
'';
|
||||
};
|
||||
|
||||
openFirewall = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = lib.mdDoc ''
|
||||
Open services.qBittorrent.port to the outside network.
|
||||
'';
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.qbittorrent-nox;
|
||||
defaultText = literalExpression "pkgs.qbittorrent-nox";
|
||||
description = lib.mdDoc ''
|
||||
The qbittorrent package to use.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (let
|
||||
configFile = pkgs.writeText "qBittorrent.conf" ''
|
||||
[BitTorrent]
|
||||
Session\Port=53271
|
||||
Session\SSL\Port=45846
|
||||
Session\QueueingSystemEnabled=false
|
||||
Session\MaxUploads=-1
|
||||
Session\MaxUploadsPerTorrent=-1
|
||||
|
||||
[Meta]
|
||||
MigrationVersion=8
|
||||
|
||||
[Network]
|
||||
Cookies=@Invalid()
|
||||
|
||||
[Preferences]
|
||||
WebUI\Port=5000
|
||||
WebUI\Username=admin
|
||||
WebUI\Password_PBKDF2="@ByteArray(Clgb2+ZyS3PDRVqtYpj0Ow==:kjN301CJife6g5ou8N2mk6ydQWPQIGgrTAWg5ByWCqAv0jDLphR/IaVQ1tu9KtA+il1udi48xSXZ3AUpjK/fRw==)"
|
||||
|
||||
[RSS]
|
||||
AutoDownloader\DownloadRepacks=true
|
||||
AutoDownloader\SmartEpisodeFilter=s(\\d+)e(\\d+), (\\d+)x(\\d+), "(\\d{4}[.\\-]\\d{1,2}[.\\-]\\d{1,2})", "(\\d{1,2}[.\\-]\\d{1,2}[.\\-]\\d{4})"
|
||||
'';
|
||||
in {
|
||||
networking.firewall = mkIf cfg.openFirewall {
|
||||
allowedTCPPorts = [ cfg.port ];
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
# https://www.mankier.com/5/tmpfiles.d
|
||||
"d '${cfg.dataDir}' 0700 ${cfg.user} ${cfg.group} - -"
|
||||
"d '${cfg.dataDir}/__config' 0700 ${cfg.user} ${cfg.group} - -"
|
||||
"L+ '${cfg.dataDir}/__config/qBittorrent.conf' - - - - ${configFile}"
|
||||
];
|
||||
|
||||
systemd.services.qbittorrent = {
|
||||
description = "qBittorrent-nox service";
|
||||
documentation = [ "man:qbittorrent-nox(1)" ];
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
User = cfg.user;
|
||||
Group = cfg.group;
|
||||
|
||||
ExecStartPre = let
|
||||
preStartScript = pkgs.writeScript "qbittorrent-run-prestart" ''
|
||||
#!${pkgs.bash}/bin/bash
|
||||
|
||||
# Create data directory if it doesn't exist
|
||||
if ! test -d "$QBT_PROFILE"; then
|
||||
echo "Creating initial qBittorrent data directory in: $QBT_PROFILE"
|
||||
install -d -m 0755 -o "${cfg.user}" -g "${cfg.group}" "$QBT_PROFILE"
|
||||
fi
|
||||
'';
|
||||
in
|
||||
"!${preStartScript}";
|
||||
|
||||
ExecStart = "${cfg.package}/bin/qbittorrent-nox";
|
||||
};
|
||||
|
||||
environment = {
|
||||
QBT_PROFILE = cfg.dataDir;
|
||||
QBT_WEBUI_PORT = toString cfg.port;
|
||||
};
|
||||
};
|
||||
|
||||
users.users = mkIf (cfg.user == "qbittorrent") {
|
||||
qbittorrent = {
|
||||
group = cfg.group;
|
||||
uid = UID;
|
||||
};
|
||||
};
|
||||
|
||||
users.groups = mkIf (cfg.group == "qbittorrent") {
|
||||
qbittorrent = { gid = GID; };
|
||||
};
|
||||
});
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{ config, options, lib, pkgs, ... }:
|
||||
let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
in
|
||||
{
|
||||
options.modules.virtualisation = {};
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
{ config, options, lib, pkgs, ... }:
|
||||
let
|
||||
inherit (lib.modules) mkIf;
|
||||
|
||||
cfg = config.modules.virtualisation.podman;
|
||||
in
|
||||
{
|
||||
options.modules.virtualisation.podman = let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
in
|
||||
{
|
||||
enable = mkEnableOption "enable podman";
|
||||
};
|
||||
|
||||
config = mkIf config.modules.virtualisation.podman.enable {
|
||||
virtualisation = {
|
||||
containers.enable = true;
|
||||
|
||||
podman = {
|
||||
enable = true;
|
||||
dockerCompat = true;
|
||||
defaultNetwork.settings.dns_enabled = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue