Compare commits

...

1 commit

Author SHA1 Message Date
Domen Kožar
17d8091b6b
Add ngrok service 2019-06-07 18:06:21 +02:00
2 changed files with 33 additions and 0 deletions

View file

@ -17,6 +17,7 @@ let
./modules/service/image.nix
./modules/service/nixos.nix
./modules/service/nixos-init.nix
./modules/service/ngrok.nix
];
argsModule = {

View file

@ -0,0 +1,32 @@
{ pkgs, lib, config, ... }:
let
inherit (lib) types;
ngrokConfig = pkgs.writeText "ngrok-tunnels.yml" (builtins.toJSON config.ngrok.config);
in
{
options.ngrok = {
enable = lib.mkOption {
description = "Turn on ngrok service";
type = types.bool;
default = false;
};
config = lib.mkOption {
type = types.attrs;
description = "ngrok.conf configuration";
};
userConfigFile = lib.mkOption {
type = types.path;
default = ~/.ngrok2/ngrok.yml;
description = "path to ngrok.conf user configuration";
};
};
config = lib.mkIf (config.ngrok.enable) {
service.command = [ "${pkgs.ngrok}/bin/ngrok" "start" "--all" "--config" "${ngrokConfig}" "--config" "${config.ngrok.userConfigFile}" ];
service.ports = [ "4040:4040" ];
ngrok.config.web_addr = "0.0.0.0:4040";
};
}