mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-22 05:33:23 +00:00
64 lines
1.2 KiB
Nix
64 lines
1.2 KiB
Nix
# NixOS module for Transmission BitTorrent daemon
|
|
|
|
{ config, pkgs, ... }:
|
|
|
|
with pkgs.lib;
|
|
|
|
let
|
|
|
|
cfg = config.services.freenet;
|
|
varDir = "/var/lib/freenet";
|
|
|
|
in
|
|
|
|
{
|
|
|
|
### configuration
|
|
|
|
options = {
|
|
|
|
services.freenet = {
|
|
|
|
enable = mkOption {
|
|
type = types.uniq types.bool;
|
|
default = false;
|
|
description = "Enable the Freenet daemon";
|
|
};
|
|
|
|
nice = mkOption {
|
|
type = types.uniq types.int;
|
|
default = 10;
|
|
description = "Set the nice level for the Freenet daemon";
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
### implementation
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.services.freenet = {
|
|
description = "Freenet daemon";
|
|
after = [ "network.target" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
serviceConfig.ExecStart = "${pkgs.freenet}/bin/freenet";
|
|
serviceConfig.User = "freenet";
|
|
serviceConfig.UMask = "0007";
|
|
serviceConfig.WorkingDirectory = varDir;
|
|
serviceConfig.Nice = cfg.nice;
|
|
};
|
|
|
|
users.extraUsers.freenet = {
|
|
group = "freenet";
|
|
description = "Psyced daemon user";
|
|
home = varDir;
|
|
createHome = true;
|
|
};
|
|
|
|
users.extraGroups.freenet = {};
|
|
};
|
|
|
|
}
|