mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-config.git
synced 2024-11-29 22:11:27 +00:00
44 lines
1.2 KiB
Nix
44 lines
1.2 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
selfprivacy-api = pkgs.callPackage ./api-package.nix { };
|
|
cfg = config.services.selfprivacy-api;
|
|
directionArg =
|
|
if cfg.direction == ""
|
|
then ""
|
|
else "--direction=${cfg.direction}";
|
|
in
|
|
{
|
|
options.services.selfprivacy-api = {
|
|
enable = mkOption {
|
|
default = false;
|
|
type = types.bool;
|
|
description = ''
|
|
Enable SelfPrivacy API service
|
|
'';
|
|
};
|
|
};
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
systemd.services.selfprivacy-api = {
|
|
description = "API Server used to control system from the mobile application";
|
|
environment = config.nix.envVars // {
|
|
inherit (config.environment.sessionVariables) NIX_PATH;
|
|
HOME = "/root";
|
|
PYTHONUNBUFFERED = "1";
|
|
} // config.networking.proxy.envVars;
|
|
path = [ "/var/" "/var/dkim/" pkgs.coreutils pkgs.gnutar pkgs.xz.bin pkgs.gzip pkgs.gitMinimal config.nix.package.out pkgs.nixos-rebuild pkgs.restic pkgs.mkpasswd ];
|
|
after = [ "network-online.target" ];
|
|
wantedBy = [ "network-online.target" ];
|
|
serviceConfig = {
|
|
User = "root";
|
|
ExecStart = "${selfprivacy-api}/bin/app.py";
|
|
Restart = "always";
|
|
RestartSec = "5";
|
|
};
|
|
};
|
|
};
|
|
}
|