-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodule.nix
64 lines (60 loc) · 1.73 KB
/
module.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.pacrat;
settingsFormat = pkgs.formats.toml {};
settingsFile = settingsFormat.generate "pacrat.toml" cfg.settings;
in
{
options = {
services.pacrat = {
enable = mkEnableOption (mdDoc "A simple Arch Linux custom repository manager");
settings = mkOption {
type = types.submodule {
freeformType = settingsFormat.type;
options = {};
};
};
};
};
config = mkIf cfg.enable {
systemd.services.pacrat = {
description = "A simple Arch Linux custom repository manager";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.pacrat-server}/bin/pacrat-server -c ${settingsFile}";
WorkingDirectory = "/var/lib/pacrat";
NoNewPrivileges = true;
LockPersonality = true;
MemoryDenyWriteExecute = true;
PrivateMounts = "yes";
PrivateTmp = "yes";
ProtectSystem = "strict";
ProtectHome = "yes";
ProtectControlGroups = true;
ProtectHostname = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
ReadWritePaths = [
"/var/lib/pacrat"
];
RemoveIPC = true;
RestrictAddressFamilies = [ "AF_INET" "AF_INET6" ];
RestrictNamespaces = true;
RestrictRealtime = true;
RestrictSUIDSGID = true;
SystemCallFilter = "@system-service";
SystemCallArchitectures = "native";
User = "pacrat";
Group = "pacrat";
};
};
users.users.pacrat = {
group = "pacrat";
isSystemUser = true;
};
users.groups.pacrat = {};
};
}