mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-06-08 02:09:04 +02:00
chore(gustave): intro readeck
This commit is contained in:
parent
3343c41223
commit
3fb9c26b9f
7 changed files with 176 additions and 0 deletions
71
modules/readeck/default.nix
Normal file
71
modules/readeck/default.nix
Normal file
|
@ -0,0 +1,71 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.readeck;
|
||||
in
|
||||
{
|
||||
|
||||
meta.maintainers = [ lib.maintainers.julienmalka ];
|
||||
|
||||
options = {
|
||||
services.readeck = {
|
||||
enable = mkEnableOption "Readeck";
|
||||
|
||||
package = mkPackageOption pkgs "readeck" { };
|
||||
|
||||
configPath = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = "Path to file containing config.";
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.services.readeck = {
|
||||
description = "Readeck";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
StateDirectory = "readeck";
|
||||
LoadCredential = "config:${cfg.configPath}";
|
||||
WorkingDirectory = "/var/lib/readeck";
|
||||
DynamicUser = true;
|
||||
ExecStart = "${lib.getExe cfg.package} serve -config \${CREDENTIALS_DIRECTORY}/config";
|
||||
ProtectSystem = "full";
|
||||
SystemCallArchitectures = "native";
|
||||
MemoryDenyWriteExecute = true;
|
||||
NoNewPrivileges = true;
|
||||
PrivateTmp = true;
|
||||
PrivateDevices = true;
|
||||
RestrictAddressFamilies = [
|
||||
"AF_INET"
|
||||
"AF_INET6"
|
||||
"AF_UNIX"
|
||||
"AF_NETLINK"
|
||||
];
|
||||
RestrictNamespaces = true;
|
||||
RestrictRealtime = true;
|
||||
DevicePolicy = "closed";
|
||||
ProtectClock = true;
|
||||
ProtectHostname = true;
|
||||
ProtectProc = "invisible";
|
||||
ProtectControlGroups = true;
|
||||
ProtectKernelModules = true;
|
||||
ProtectKernelTunables = true;
|
||||
LockPersonality = true;
|
||||
Restart = "on-failure";
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue