This commit is contained in:
2025-07-20 19:35:20 +02:00
parent ca04fbc930
commit c13ec6cac4
3 changed files with 26 additions and 8 deletions

View File

@@ -3,6 +3,8 @@
enable = true; enable = true;
email = "adam@cnst.dev"; email = "adam@cnst.dev";
domain = "cnst.dev"; domain = "cnst.dev";
uid = 994;
gid = 994;
caddy = { caddy = {
enable = true; enable = true;
}; };

View File

@@ -7,7 +7,7 @@
cfg = config.server; cfg = config.server;
in { in {
options.server = { options.server = {
enable = lib.mkEnableOption "The homelab services and configuration variables"; enable = lib.mkEnableOption "The server services and configuration variables";
email = mkOption { email = mkOption {
default = ""; default = "";
type = types.str; type = types.str;
@@ -26,31 +26,46 @@ in {
default = "share"; default = "share";
type = lib.types.str; type = lib.types.str;
description = '' description = ''
User to run the homelab services as User to run the server services as
''; '';
}; };
group = lib.mkOption { group = lib.mkOption {
default = "share"; default = "share";
type = lib.types.str; type = lib.types.str;
description = '' description = ''
Group to run the homelab services as Group to run the server services as
''; '';
}; };
uid = lib.mkOption {
default = 1000;
type = lib.types.int;
description = ''
UID to run the server services as
'';
};
gid = lib.mkOption {
default = 1000;
type = lib.types.int;
description = ''
GID to run the server services as
'';
};
timeZone = lib.mkOption { timeZone = lib.mkOption {
default = "Europe/Stockholm"; default = "Europe/Stockholm";
type = lib.types.str; type = lib.types.str;
description = '' description = ''
Time zone to be used for the homelab services Time zone to be used for the server services
''; '';
}; };
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
users = { users = {
groups.${cfg.group} = { groups.${cfg.group} = {
gid = 993; gid = cfg.gid;
}; };
users.${cfg.user} = { users.${cfg.user} = {
uid = 994; uid = cfg.uid;
isSystemUser = true; isSystemUser = true;
group = cfg.group; group = cfg.group;
}; };

View File

@@ -3,6 +3,7 @@
lib, lib,
... ...
}: let }: let
srv = config.server;
cfg = config.server.qbittorrent; cfg = config.server.qbittorrent;
in { in {
options.server.qbittorrent = { options.server.qbittorrent = {
@@ -64,8 +65,8 @@ in {
config.age.secrets.gluetunEnv.path config.age.secrets.gluetunEnv.path
]; ];
environment = { environment = {
PUID = "1000"; PUID = "${srv.uid}";
PGID = "1000"; PGID = "${srv.gid}";
TZ = "Etc/UTC"; TZ = "Etc/UTC";
WEBUI_PORT = "${builtins.toString cfg.port}"; WEBUI_PORT = "${builtins.toString cfg.port}";
}; };