readme updates

This commit is contained in:
Robin Appelman 2025-09-19 00:53:45 +02:00
commit 678fdf5185
2 changed files with 51 additions and 0 deletions

View file

@ -29,6 +29,20 @@ provided socket.
ptouch-api [--config config.toml]
```
## Permissions
You'll need to either run `ptouch-api` as root or setup a udev rule to change
the owner or permissions to allow `ptouch-api` to access the label printer over
usb.
See [51-ptouch-api.rules](./51-ptouch-api.rules) for an example udev rule,
placing this into `/etc/udev/rules.d` and adjusting the username as desired
should give the specified user access to the ptouch printer.
Alternatively you can use
[51-ptouch-api-everyone.rules](./51-ptouch-api-everyone.rules) to give all users
on the system access to the label printer.
## API
- GET `/status`: get printer and tape status for details about the fields.
@ -71,3 +85,39 @@ The following printers are currently supported
- PT-D600
- PT-D610BT
- PT-P710BT
## NixOs module
For NixOs users, a module is available as a flake that includes everything
needed run the api.
```nix
{
inputs.ptouch-api.url = "git+ssh://git@codeberg.org/icewind/ptouch-api.git";
outputs = { self, nixpkgs, ptouch-api }: {
nixosConfigurations.my-machine = nixpkgs.lib.nixosSystem {
modules =
[
ptouch-api.nixosModules.default
({config, ...}: {
# enable the api service and setup the udev rules
services.ptouch-api = {
enable = true;
# socket = "/path/for/socket/to/listen"; # defaults to /run/ptouch-api/ptouch-api.sock
};
# expose the api to the outside world
services.nginx = {
virtualHosts."ptouch.example.com" = {
locations."/" = {
proxyPass = "http://unix://${config.services.ptouch-api.socket}";
};
};
};
})
# ... other configuration ...
];
};
};
}
```