gosmee.nix (1117B)
1 { config, lib, pkgs, ... }: 2 3 with lib; 4 let 5 cfg = config.services.gosmee; 6 in 7 { 8 options = { 9 services.gosmee = { 10 enable = mkEnableOption '' 11 gosmee is a webhook forwader/relayer 12 ''; 13 package = mkOption { 14 type = types.package; 15 default = pkgs.gosmee; 16 description = '' 17 gosmee package to use. 18 ''; 19 }; 20 21 public-url = mkOption { 22 description = '' 23 Public URL to show to user, useful when you are behind a proxy. 24 ''; 25 type = types.str; 26 default = ""; 27 }; 28 }; 29 }; 30 config = mkIf cfg.enable { 31 systemd.packages = [ cfg.package ]; 32 systemd.services.gosmee = { 33 description = "Gosmee service"; 34 after = [ "network.target" ]; 35 wantedBy = [ "multi-user.target" ]; 36 serviceConfig = { 37 # User = cfg.user; 38 Restart = "on-failure"; 39 ExecStart = '' 40 ${cfg.package}/bin/gosmee server \ 41 ${optionalString (cfg.public-url != "") "--public-url ${escapeShellArg cfg.public-url}"} 42 ''; 43 }; 44 path = [ cfg.package ]; 45 }; 46 }; 47 } 48