36 lines
1.1 KiB
Nix
36 lines
1.1 KiB
Nix
|
{ username, pkgs, ... }: {
|
||
|
systemd.services.qbittorrent-nox = let
|
||
|
port = 1999;
|
||
|
in {
|
||
|
enable = true;
|
||
|
description = "QBitTorrent server";
|
||
|
wants = [ "network-online.target" ];
|
||
|
after = [ "network-online.target" ];
|
||
|
serviceConfig = {
|
||
|
Type = "exec";
|
||
|
User = username;
|
||
|
ExecStart = "${pkgs.qbittorrent-nox}/bin/qbittorrent-nox --profile=\"/home/${username}/Torrent\" --configuration=\"/home/${username}/Torrent/config\" --webui-port=${toString port}";
|
||
|
};
|
||
|
wantedBy = [ "multi-user.target" ];
|
||
|
};
|
||
|
# WebUI\LocalHostAuth=false
|
||
|
|
||
|
imp.home.dirs = [ "Torrent" ];
|
||
|
|
||
|
systemd.services.gdisk = {
|
||
|
enable = true;
|
||
|
description = "Automounting additional disk";
|
||
|
serviceConfig = {
|
||
|
Type = "oneshot";
|
||
|
User = "root";
|
||
|
ExecStart = pkgs.writeShellScript "mount-gdisk.sh" ''
|
||
|
systemd-cryptsetup attach gd /dev/sda /nix/disks/gd/key header=/nix/disks/gd/header
|
||
|
mkdir -p /mnt/gd
|
||
|
mount /dev/mapper/gd /mnt/gd -o compress=zstd:2
|
||
|
'';
|
||
|
RemainAfterExit = true;
|
||
|
ExecStop = "umount /dev/gd && systemd-cryptsetup detach gd";
|
||
|
};
|
||
|
};
|
||
|
}
|