summaryrefslogtreecommitdiff
path: root/nix/module.nix
diff options
context:
space:
mode:
authorseth <[email protected]>2023-04-23 03:20:24 -0400
committerseth <[email protected]>2023-04-23 03:20:24 -0400
commitb336cdb0cdcdeff54bb7c28d11762d9be71d5de2 (patch)
tree92ffa2dd081ce1f5324a4f7e5df3ac7d52002fd8 /nix/module.nix
parent740cff7a2fb641c4f26673710459b8bc86f448ab (diff)
feat: add nix module
Diffstat (limited to 'nix/module.nix')
-rw-r--r--nix/module.nix18
1 files changed, 15 insertions, 3 deletions
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";