Compare commits
1 commit
main
...
service-ng
Author | SHA1 | Date | |
---|---|---|---|
|
17d8091b6b |
2 changed files with 33 additions and 0 deletions
|
@ -17,6 +17,7 @@ let
|
|||
./modules/service/image.nix
|
||||
./modules/service/nixos.nix
|
||||
./modules/service/nixos-init.nix
|
||||
./modules/service/ngrok.nix
|
||||
];
|
||||
|
||||
argsModule = {
|
||||
|
|
32
src/nix/modules/service/ngrok.nix
Normal file
32
src/nix/modules/service/ngrok.nix
Normal 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";
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue