rename to ptouch-remote

This commit is contained in:
Robin Appelman 2025-10-28 19:25:09 +01:00
commit 1422f9b8be
12 changed files with 43 additions and 40 deletions

View file

@ -5,14 +5,14 @@
...
}:
with lib; let
cfg = config.services.ptouch-api;
cfg = config.services.ptouch-remote;
in {
options.services.ptouch-api = {
enable = mkEnableOption "Enables the ptouch-api service";
options.services.ptouch-remote = {
enable = mkEnableOption "Enables the ptouch-remote service";
socket = mkOption rec {
type = types.str;
default = "/run/ptouch-api/ptouch-api.sock";
default = "/run/ptouch-remote/ptouch-remote.sock";
description = "The socket to listen on";
};
@ -29,17 +29,17 @@ in {
};
config = mkIf cfg.enable {
users.users.ptouch-api = {
users.users.ptouch-remote = {
isSystemUser = true;
group = "ptouch-api";
group = "ptouch-remote";
};
users.groups.ptouch-api = {};
users.groups.ptouch-remote = {};
services.udev.packages = [cfg.package];
systemd.services.ptouch-api = {
wants = ["ptouch-api.socket"];
after = ["ptouch-api.socket"];
systemd.services.ptouch-remote = {
wants = ["ptouch-remote.socket"];
after = ["ptouch-remote.socket"];
environment = {
RUST_LOG = cfg.logLevel;
};
@ -47,7 +47,7 @@ in {
serviceConfig = {
Restart = "on-failure";
ExecStart = getExe cfg.package;
User = "ptouch-api";
User = "ptouch-remote";
PrivateUsers = true;
PrivateTmp = true;
ProtectSystem = "strict";
@ -67,12 +67,12 @@ in {
RestrictRealtime = true;
SystemCallFilter = ["~@reboot" "~@cpu-emulation" "~@obsolete" "~@debug" "~@swap" "~@clock" "~@module"];
RestrictNamespaces = ["~cgroup"];
RuntimeDirectory = "ptouch-api";
RuntimeDirectory = "ptouch-remote";
UMask = "0007";
};
};
systemd.sockets.ptouch-api = {
systemd.sockets.ptouch-remote = {
enable = true;
wantedBy = ["sockets.target"];

View file

@ -1,3 +1,3 @@
final: prev: {
ptouch-api = final.callPackage ./package.nix {};
ptouch-remote = final.callPackage ./package.nix {};
}

View file

@ -9,7 +9,7 @@
version = (fromTOML (readFile ../Cargo.toml)).package.version;
in
rustPlatform.buildRustPackage rec {
pname = "ptouch-api";
pname = "ptouch-remote";
inherit src version;
@ -19,8 +19,8 @@ in
postInstall = ''
mkdir -p $out/lib/udev/rules.d/
cp ./51-ptouch-api.rules $out/lib/udev/rules.d/
cp ./51-ptouch-remote.rules $out/lib/udev/rules.d/
'';
meta.mainProgram = "ptouch-api";
meta.mainProgram = "ptouch-remote";
}