spoolman: init service (#435272)
This commit is contained in:
@@ -102,6 +102,8 @@
|
||||
|
||||
- [KMinion](https://github.com/redpanda-data/kminion), feature-rich Prometheus exporter for Apache Kafka. Available as [services.prometheus.exporters.kafka](options.html#opt-services.prometheus.exporters.kafka).
|
||||
|
||||
- [Spoolman](https://github.com/Donkie/Spoolman), a inventory management system for Filament spools. Available as [services.spoolman](#opt-services.spoolman.enable).
|
||||
|
||||
- [Temporal](https://temporal.io/), a durable execution platform that enables
|
||||
developers to build scalable applications without sacrificing productivity or
|
||||
reliability. Available as [services.temporal](#opt-services.temporal.enable).
|
||||
|
||||
@@ -930,6 +930,7 @@
|
||||
./services/misc/spice-autorandr.nix
|
||||
./services/misc/spice-vdagentd.nix
|
||||
./services/misc/spice-webdavd.nix
|
||||
./services/misc/spoolman.nix
|
||||
./services/misc/sssd.nix
|
||||
./services/misc/subsonic.nix
|
||||
./services/misc/sundtek.nix
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.services.spoolman;
|
||||
in
|
||||
{
|
||||
|
||||
options.services.spoolman = {
|
||||
|
||||
enable = lib.mkEnableOption "Spoolman, a filament spool inventory management system.";
|
||||
|
||||
environment = lib.mkOption {
|
||||
type = lib.types.attrs;
|
||||
default = { };
|
||||
example = {
|
||||
SPOOLMAN_DB_TYPE = "sqlite";
|
||||
SPOOLMAN_LOGGING_LEVEL = "DEBUG";
|
||||
SPOOLMAN_AUTOMATIC_BACKUP = "TRUE";
|
||||
SPOOLMAN_BASE_PATH = "/spoolman";
|
||||
SPOOLMAN_METRICS_ENABLED = "TRUE";
|
||||
SPOOLMAN_CORS_ORIGIN = "source1.domain.com:p1, source2.domain.com:p2";
|
||||
};
|
||||
description = ''
|
||||
Environment variables to be passed to the spoolman service.
|
||||
Refer to https://github.com/Donkie/Spoolman/blob/master/.env.example for details on supported variables.
|
||||
'';
|
||||
};
|
||||
|
||||
openFirewall = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Open the appropriate ports in the firewall for spoolman.
|
||||
'';
|
||||
};
|
||||
|
||||
listen = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "127.0.0.1";
|
||||
example = "0.0.0.0";
|
||||
description = "The IP address to bind the spoolman server to.";
|
||||
};
|
||||
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 7912;
|
||||
description = ''
|
||||
TCP port where spoolman web-gui listens.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
systemd.services.spoolman = {
|
||||
description = "A self-hosted filament spool inventory management system";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
environment = {
|
||||
SPOOLMAN_DIR_DATA = "/var/lib/spoolman";
|
||||
}
|
||||
// cfg.environment;
|
||||
serviceConfig = lib.mkMerge [
|
||||
{
|
||||
DynamicUser = true;
|
||||
ExecStart = "${pkgs.spoolman}/bin/spoolman --host ${cfg.listen} --port ${toString cfg.port}";
|
||||
StateDirectory = "spoolman";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
networking.firewall = lib.mkIf cfg.openFirewall {
|
||||
allowedTCPPorts = lib.optional (cfg.listen != "127.0.0.1") cfg.port;
|
||||
};
|
||||
|
||||
};
|
||||
meta = {
|
||||
maintainers = with lib.maintainers; [ MayNiklas ];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user