feat: try rework
This commit is contained in:
parent
1ddbd3b8b6
commit
ecf10628c3
51 changed files with 1941 additions and 445 deletions
51
validation/service/qbittorrent.nix
Normal file
51
validation/service/qbittorrent.nix
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
let
|
||||
common = import ./common.nix;
|
||||
in
|
||||
rec {
|
||||
getQbittorrent = serviceData:
|
||||
let
|
||||
qbt =
|
||||
if serviceData ? qbittorrent then
|
||||
common.ensureAttrset "config/services.nix qbittorrent" serviceData.qbittorrent
|
||||
else
|
||||
throw "config/services.nix must define qbittorrent attrset.";
|
||||
|
||||
webPort =
|
||||
if qbt ? port then
|
||||
common.ensureInt "config/services.nix qbittorrent.port" qbt.port
|
||||
else
|
||||
throw "config/services.nix qbittorrent.port must exist.";
|
||||
|
||||
rootDir =
|
||||
if qbt ? root_dir then
|
||||
common.ensureNonEmptyString "config/services.nix qbittorrent.root_dir" qbt.root_dir
|
||||
else
|
||||
throw "config/services.nix qbittorrent.root_dir must exist.";
|
||||
|
||||
vpn =
|
||||
if qbt ? vpn then
|
||||
common.ensureAttrset "config/services.nix qbittorrent.vpn" qbt.vpn
|
||||
else
|
||||
throw "config/services.nix qbittorrent.vpn must exist.";
|
||||
|
||||
usernameFile =
|
||||
if vpn ? username_file then
|
||||
common.ensureNonEmptyString "config/services.nix qbittorrent.vpn.username_file" vpn.username_file
|
||||
else
|
||||
throw "config/services.nix qbittorrent.vpn.username_file must exist.";
|
||||
|
||||
passwordFile =
|
||||
if vpn ? password_file then
|
||||
common.ensureNonEmptyString "config/services.nix qbittorrent.vpn.password_file" vpn.password_file
|
||||
else
|
||||
throw "config/services.nix qbittorrent.vpn.password_file must exist.";
|
||||
in
|
||||
{
|
||||
port = webPort;
|
||||
root_dir = rootDir;
|
||||
vpn = {
|
||||
username_file = usernameFile;
|
||||
password_file = passwordFile;
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue