diff options
Diffstat (limited to 'Biz/Devalloc.nix')
-rw-r--r-- | Biz/Devalloc.nix | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Biz/Devalloc.nix b/Biz/Devalloc.nix new file mode 100644 index 0000000..0fd1550 --- /dev/null +++ b/Biz/Devalloc.nix @@ -0,0 +1,46 @@ +{ options +, lib +, config +, pkgs +, modulesPath +}: + +let + cfg = config.services.devalloc; +in +{ + options.services.devalloc = { + enable = lib.mkEnableOption "Enable the devalloc service"; + port = lib.mkOption { + type = lib.types.int; + default = 3000; + description = '' + The port on which devalloc will listen for + incoming HTTP traffic. + ''; + }; + package = lib.mkOption { + type = lib.types.package; + description = "devalloc package to use"; + }; + }; + config = lib.mkIf cfg.enable { + systemd.services.devalloc = { + path = [ cfg.package ]; + wantedBy = [ "multi-user.target" ]; + script = '' + ${cfg.package}/bin/devalloc + ''; + description = '' + Devalloc + ''; + serviceConfig = { + Environment = ["PORT=${toString cfg.port}"]; + KillSignal = "INT"; + Type = "simple"; + Restart = "on-abort"; + RestartSec = "1"; + }; + }; + }; +} |