diff options
author | Joachim Schiele <js@lastlog.de> | 2016-11-06 10:33:21 +0100 |
---|---|---|
committer | Joachim Schiele <js@lastlog.de> | 2016-11-06 10:34:42 +0100 |
commit | 47d81ed3473f33cfb48f2be079f50cdfac60f1e7 (patch) | |
tree | 96160cee6a4491334af5d7d83096ca41d1247070 /nixos/modules/services | |
parent | 4440cf6d8169e9171b87f11475a518a658fa4dae (diff) | |
download | nixlib-47d81ed3473f33cfb48f2be079f50cdfac60f1e7.tar nixlib-47d81ed3473f33cfb48f2be079f50cdfac60f1e7.tar.gz nixlib-47d81ed3473f33cfb48f2be079f50cdfac60f1e7.tar.bz2 nixlib-47d81ed3473f33cfb48f2be079f50cdfac60f1e7.tar.lz nixlib-47d81ed3473f33cfb48f2be079f50cdfac60f1e7.tar.xz nixlib-47d81ed3473f33cfb48f2be079f50cdfac60f1e7.tar.zst nixlib-47d81ed3473f33cfb48f2be079f50cdfac60f1e7.zip |
leaps: 0.5.1 + add a service + test
Diffstat (limited to 'nixos/modules/services')
-rw-r--r-- | nixos/modules/services/misc/leaps.nix | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/nixos/modules/services/misc/leaps.nix b/nixos/modules/services/misc/leaps.nix new file mode 100644 index 000000000000..b92cf27f58dc --- /dev/null +++ b/nixos/modules/services/misc/leaps.nix @@ -0,0 +1,62 @@ +{ config, pkgs, lib, ... } @ args: + +with lib; + +let + cfg = config.services.leaps; + stateDir = "/var/lib/leaps/"; +in +{ + options = { + services.leaps = { + enable = mkEnableOption "leaps"; + port = mkOption { + type = types.int; + default = 8080; + description = "A port where leaps listens for incoming http requests"; + }; + address = mkOption { + default = ""; + type = types.str; + example = "127.0.0.1"; + description = "Hostname or IP-address to listen to. By default it will listen on all interfaces."; + }; + path = mkOption { + default = "/"; + type = types.path; + description = "Subdirectory used for reverse proxy setups"; + }; + }; + }; + + config = mkIf cfg.enable { + users = { + users.leaps = { + uid = config.ids.uids.leaps; + description = "Leaps server user"; + group = "leaps"; + home = stateDir; + createHome = true; + }; + + groups.leaps = { + gid = config.ids.gids.leaps; + }; + }; + + systemd.services.leaps = { + description = "leaps service"; + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" ]; + + serviceConfig = { + User = "leaps"; + Group = "leaps"; + Restart = "on-failure"; + WorkingDirectory = stateDir; + PrivateTmp = true; + ExecStart = "${pkgs.leaps.bin}/bin/leaps -path ${toString cfg.path} -address ${cfg.address}:${toString cfg.port}"; + }; + }; + }; +} |