mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-28 08:31:59 +00:00
51 lines
1.1 KiB
Nix
51 lines
1.1 KiB
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.services.couchpotato;
|
|
|
|
in
|
|
{
|
|
options = {
|
|
services.couchpotato = {
|
|
enable = mkEnableOption "CouchPotato Server";
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
systemd.services.couchpotato = {
|
|
description = "CouchPotato Server";
|
|
after = [ "network.target" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
preStart = ''
|
|
mkdir -p /var/lib/couchpotato
|
|
chown -R couchpotato:couchpotato /var/lib/couchpotato
|
|
'';
|
|
|
|
serviceConfig = {
|
|
Type = "simple";
|
|
User = "couchpotato";
|
|
Group = "couchpotato";
|
|
PermissionsStartOnly = "true";
|
|
ExecStart = "${pkgs.couchpotato}/bin/couchpotato";
|
|
Restart = "on-failure";
|
|
};
|
|
};
|
|
|
|
users.extraUsers = singleton
|
|
{ name = "couchpotato";
|
|
group = "couchpotato";
|
|
home = "/var/lib/couchpotato/";
|
|
description = "CouchPotato daemon user";
|
|
uid = config.ids.uids.couchpotato;
|
|
};
|
|
|
|
users.extraGroups = singleton
|
|
{ name = "couchpotato";
|
|
gid = config.ids.gids.couchpotato;
|
|
};
|
|
};
|
|
}
|