mirror of
https://codeberg.org/icewind/evtype.git
synced 2026-06-03 09:34:11 +02:00
add nixos module
This commit is contained in:
parent
df58365973
commit
a8575345e4
4 changed files with 72 additions and 2 deletions
53
nix/module.nix
Normal file
53
nix/module.nix
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.services.evtype;
|
||||
in {
|
||||
options.services.evtype = {
|
||||
enable = mkEnableOption "Enables the evtype service";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
description = "package to use";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [cfg.package];
|
||||
|
||||
systemd.services.evtype = {
|
||||
wantedBy = ["multi-user.target"];
|
||||
description = "EvType daemon";
|
||||
|
||||
serviceConfig = {
|
||||
Restart = "on-failure";
|
||||
ExecStart = "${cfg.package}/bin/evtype_daemon";
|
||||
DynamicUser = true;
|
||||
PrivateTmp = true;
|
||||
ProtectSystem = "strict";
|
||||
ProtectHome = true;
|
||||
NoNewPrivileges = true;
|
||||
ProtectClock = true;
|
||||
CapabilityBoundingSet = true;
|
||||
ProtectKernelLogs = true;
|
||||
ProtectControlGroups = true;
|
||||
SystemCallArchitectures = "native";
|
||||
ProtectKernelModules = true;
|
||||
RestrictNamespaces = true;
|
||||
MemoryDenyWriteExecute = true;
|
||||
ProtectHostname = true;
|
||||
LockPersonality = true;
|
||||
ProtectKernelTunables = true;
|
||||
RestrictAddressFamilies = ["AF_UNIX"];
|
||||
RestrictRealtime = true;
|
||||
SystemCallFilter = ["@system-service" "~@resources" "~@privileged"];
|
||||
IPAddressDeny = "any";
|
||||
RuntimeDirectory = "evtype";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -4,10 +4,11 @@
|
|||
lib,
|
||||
}: let
|
||||
inherit (lib.sources) sourceByRegex;
|
||||
inherit (builtins) fromTOML readFile;
|
||||
in
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "evtype";
|
||||
version = "0.1.0";
|
||||
version = (fromTOML (readFile ../Cargo.toml)).package.version;
|
||||
|
||||
src = sourceByRegex ../. ["Cargo.*" "(src)(/.*)?"];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue