fixed hydra

added a firewall rule to allow tcp
This commit is contained in:
Jakub Kropáček 2024-12-22 22:23:10 +01:00
parent 141c841c29
commit 8000e2d632
3 changed files with 58 additions and 2 deletions

View file

@ -1,9 +1,19 @@
{ ... }:
{
kropcloud = {
kropcloud =
let
serverIp = "192.168.1.160";
in {
services = {
hydra = {
enable = true;
listenHost = serverIp;
port = 3000;
};
};
networking = {
ipv4 = {
address = "192.168.1.160";
address = serverIp;
prefixLength = 24;
defaultGateway = "192.168.1.1";
};

View file

@ -3,5 +3,6 @@
imports = [
./ssh
./tailscale
./hydra
];
}

View file

@ -0,0 +1,45 @@
{
config,
lib,
...
}:
let
cfg = config.kropcloud.services.hydra;
in
{
options.kropcloud.services.hydra = {
enable = lib.mkEnableOption "Whence to enable hydra service.";
listenHost = lib.mkOption {
description = "Which host should hydra listen at";
type = lib.types.str;
default = "localhost";
example = "192.168.1.160";
};
port = lib.mkOption {
description = "Which port should hydra listen at";
type = lib.types.port;
default = 3000;
example = 3000;
};
hydraURL = lib.mkOption {
description = "Which host should hydra listen at";
type = lib.types.nullOr lib.types.str;
default = null;
example = "http://192.168.1.160:3000";
};
};
config = lib.mkIf cfg.enable {
services.hydra = {
enable = true;
useSubstitutes = true;
hydraURL = if (cfg.hydraURL != null) then cfg.hydraURL else "http://${cfg.listenHost}:${builtins.toString cfg.port}";
notificationSender = "hydra@localhost";
listenHost = cfg.listenHost;
port = cfg.port;
};
networking.firewall.allowedTCPPorts = [
cfg.port
];
};
}