From b336cdb0cdcdeff54bb7c28d11762d9be71d5de2 Mon Sep 17 00:00:00 2001 From: seth Date: Sun, 23 Apr 2023 03:20:24 -0400 Subject: feat: add nix module --- nix/module.nix | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'nix') diff --git a/nix/module.nix b/nix/module.nix index 0dff2d0..e615561 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -5,9 +5,21 @@ ... }: let cfg = config.services.guzzle-api; - inherit (lib) mkDefault mkEnableOption mkIf; + inherit (lib) mkDefault mkEnableOption mkOption mkIf types; in { - options.services.guzzle-api.enable = mkEnableOption "enable guzzle-api"; + options.services.guzzle-api = { + enable = mkEnableOption "enable guzzle-api"; + url = mkOption { + type = types.string; + default = ""; + description = "url string for guzzle-api"; + }; + port = mkOption { + type = types.int; + default = 8080; + description = "port for guzzle-api"; + }; + }; config.systemd.services.guzzle-api = mkIf cfg.enable { guzzle-api = { @@ -16,7 +28,7 @@ in { wantedBy = ["multi-user.target"]; after = ["network.target"]; script = '' - ${pkgs.guzzle-api-server} --host 0.0.0.0 --port 8000 + URL=${cfg.url} ${pkgs.guzzle-api-server} --host 0.0.0.0 --port "${cfg.port}" ''; serviceConfig = mkDefault { Restart = "always"; -- cgit v1.2.3