lol

spoolman: init service (#435272)

authored by

lassulus and committed by
GitHub
71acfb3c 227e81d2

+87
+2
nixos/doc/manual/release-notes/rl-2511.section.md
··· 102 102 103 103 - [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). 104 104 105 + - [Spoolman](https://github.com/Donkie/Spoolman), a inventory management system for Filament spools. Available as [services.spoolman](#opt-services.spoolman.enable). 106 + 105 107 - [Temporal](https://temporal.io/), a durable execution platform that enables 106 108 developers to build scalable applications without sacrificing productivity or 107 109 reliability. Available as [services.temporal](#opt-services.temporal.enable).
+1
nixos/modules/module-list.nix
··· 930 930 ./services/misc/spice-autorandr.nix 931 931 ./services/misc/spice-vdagentd.nix 932 932 ./services/misc/spice-webdavd.nix 933 + ./services/misc/spoolman.nix 933 934 ./services/misc/sssd.nix 934 935 ./services/misc/subsonic.nix 935 936 ./services/misc/sundtek.nix
+84
nixos/modules/services/misc/spoolman.nix
··· 1 + { 2 + lib, 3 + pkgs, 4 + config, 5 + ... 6 + }: 7 + let 8 + cfg = config.services.spoolman; 9 + in 10 + { 11 + 12 + options.services.spoolman = { 13 + 14 + enable = lib.mkEnableOption "Spoolman, a filament spool inventory management system."; 15 + 16 + environment = lib.mkOption { 17 + type = lib.types.attrs; 18 + default = { }; 19 + example = { 20 + SPOOLMAN_DB_TYPE = "sqlite"; 21 + SPOOLMAN_LOGGING_LEVEL = "DEBUG"; 22 + SPOOLMAN_AUTOMATIC_BACKUP = "TRUE"; 23 + SPOOLMAN_BASE_PATH = "/spoolman"; 24 + SPOOLMAN_METRICS_ENABLED = "TRUE"; 25 + SPOOLMAN_CORS_ORIGIN = "source1.domain.com:p1, source2.domain.com:p2"; 26 + }; 27 + description = '' 28 + Environment variables to be passed to the spoolman service. 29 + Refer to https://github.com/Donkie/Spoolman/blob/master/.env.example for details on supported variables. 30 + ''; 31 + }; 32 + 33 + openFirewall = lib.mkOption { 34 + type = lib.types.bool; 35 + default = false; 36 + description = '' 37 + Open the appropriate ports in the firewall for spoolman. 38 + ''; 39 + }; 40 + 41 + listen = lib.mkOption { 42 + type = lib.types.str; 43 + default = "127.0.0.1"; 44 + example = "0.0.0.0"; 45 + description = "The IP address to bind the spoolman server to."; 46 + }; 47 + 48 + port = lib.mkOption { 49 + type = lib.types.port; 50 + default = 7912; 51 + description = '' 52 + TCP port where spoolman web-gui listens. 53 + ''; 54 + }; 55 + 56 + }; 57 + 58 + config = lib.mkIf cfg.enable { 59 + 60 + systemd.services.spoolman = { 61 + description = "A self-hosted filament spool inventory management system"; 62 + wantedBy = [ "multi-user.target" ]; 63 + environment = { 64 + SPOOLMAN_DIR_DATA = "/var/lib/spoolman"; 65 + } 66 + // cfg.environment; 67 + serviceConfig = lib.mkMerge [ 68 + { 69 + DynamicUser = true; 70 + ExecStart = "${pkgs.spoolman}/bin/spoolman --host ${cfg.listen} --port ${toString cfg.port}"; 71 + StateDirectory = "spoolman"; 72 + } 73 + ]; 74 + }; 75 + 76 + networking.firewall = lib.mkIf cfg.openFirewall { 77 + allowedTCPPorts = lib.optional (cfg.listen != "127.0.0.1") cfg.port; 78 + }; 79 + 80 + }; 81 + meta = { 82 + maintainers = with lib.maintainers; [ MayNiklas ]; 83 + }; 84 + }