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 | |
parent | 4440cf6d8169e9171b87f11475a518a658fa4dae (diff) | |
download | nixpkgs-47d81ed3473f33cfb48f2be079f50cdfac60f1e7.tar nixpkgs-47d81ed3473f33cfb48f2be079f50cdfac60f1e7.tar.gz nixpkgs-47d81ed3473f33cfb48f2be079f50cdfac60f1e7.tar.bz2 nixpkgs-47d81ed3473f33cfb48f2be079f50cdfac60f1e7.tar.lz nixpkgs-47d81ed3473f33cfb48f2be079f50cdfac60f1e7.tar.xz nixpkgs-47d81ed3473f33cfb48f2be079f50cdfac60f1e7.tar.zst nixpkgs-47d81ed3473f33cfb48f2be079f50cdfac60f1e7.zip |
leaps: 0.5.1 + add a service + test
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/misc/ids.nix | 2 | ||||
-rw-r--r-- | nixos/modules/module-list.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/misc/leaps.nix | 62 | ||||
-rw-r--r-- | nixos/release.nix | 1 | ||||
-rw-r--r-- | nixos/tests/leaps.nix | 29 |
5 files changed, 95 insertions, 0 deletions
diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix index 8c0f0c2624b..c75c22472bd 100644 --- a/nixos/modules/misc/ids.nix +++ b/nixos/modules/misc/ids.nix @@ -277,6 +277,7 @@ gitlab-runner = 257; postgrey = 258; hound = 259; + leaps = 260; # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399! @@ -524,6 +525,7 @@ gitlab-runner = 257; postgrey = 258; hound = 259; + leaps = 260; # When adding a gid, make sure it doesn't match an existing # uid. Users and groups with the same name should have equal diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 08d73970408..356cb5a92ed 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -251,6 +251,7 @@ ./services/misc/gitolite.nix ./services/misc/gpsd.nix ./services/misc/ihaskell.nix + ./services/misc/leaps.nix ./services/misc/mantisbt.nix ./services/misc/mathics.nix ./services/misc/matrix-synapse.nix diff --git a/nixos/modules/services/misc/leaps.nix b/nixos/modules/services/misc/leaps.nix new file mode 100644 index 00000000000..b92cf27f58d --- /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}"; + }; + }; + }; +} diff --git a/nixos/release.nix b/nixos/release.nix index fbd3efd16ff..639ee45b38d 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -275,6 +275,7 @@ in rec { tests.networkingProxy = callTest tests/networking-proxy.nix {}; tests.nfs3 = callTest tests/nfs.nix { version = 3; }; tests.nfs4 = callTest tests/nfs.nix { version = 4; }; + tests.leaps = callTest tests/leaps.nix { }; tests.nsd = callTest tests/nsd.nix {}; tests.openssh = callTest tests/openssh.nix {}; #tests.panamax = hydraJob (import tests/panamax.nix { system = "x86_64-linux"; }); diff --git a/nixos/tests/leaps.nix b/nixos/tests/leaps.nix new file mode 100644 index 00000000000..3c390e1a169 --- /dev/null +++ b/nixos/tests/leaps.nix @@ -0,0 +1,29 @@ +import ./make-test.nix ({ pkgs, ... }: + +{ + name = "leaps"; + meta = with pkgs.stdenv.lib.maintainers; { + maintainers = [ qknight ]; + }; + + nodes = + { + client = { }; + + server = + { services.leaps = { + enable = true; + port = 6666; + path = "/leaps/"; + }; + networking.firewall.enable = false; + }; + }; + + testScript = + '' + startAll; + $server->waitForOpenPort(6666); + $client->succeed("curl http://server:6666/leaps/ | grep -i 'leaps'"); + ''; +}) |