Skip to content

Commit 57812df

Browse files
committed
Hydra, update lock, other stuffs
1 parent 8d3f30f commit 57812df

10 files changed

Lines changed: 61 additions & 27 deletions

File tree

flake.lock

Lines changed: 24 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@
103103
};
104104
in
105105
{
106+
hydraJobs = {
107+
vps = self.nixosConfigurations.vps.config.system.build.toplevel;
108+
};
109+
106110
nixosConfigurations = {
107111
"vps" = nixpkgs.lib.nixosSystem (
108112
let

nixos/hosts/vps/config/services/caddy/Caddyfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ https://*.polyfrost.org {
129129
@dex host dex.polyfrost.org
130130
@plus-staging host plus-staging.polyfrost.org
131131
@plus-admin host plus-admin.polyfrost.org
132+
@hydra host hydra.polyfrost.org
132133

133134
# Handle all other containers
134135
handle @grafana {
@@ -166,6 +167,10 @@ https://*.polyfrost.org {
166167
}
167168
}
168169

170+
handle @hydra {
171+
reverse_proxy host.containers:3000
172+
}
173+
169174
# Handle all unmatched requests as a 404
170175
handle {
171176
error "Not Found" 404

nixos/hosts/vps/config/services/caddy/container.nix

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
containerIps:
1414
lib.mapAttrs' (name: value: lib.attrsets.nameValuePair value [ "${name}.containers" ]) containerIps;
1515
in
16-
(mkHosts ips.v4.containers) // (mkHosts ips.v6.containers);
16+
(mkHosts ips.v4.containers) // (mkHosts ips.v6.containers) // {
17+
"${ips.v4.host}" = [ "host.containers" ];
18+
"${ips.v6.host}" = [ "host.containers" ];
19+
};
1720

1821
services.caddy = {
1922
enable = true;
@@ -23,7 +26,7 @@
2326
"github.com/caddy-dns/cloudflare@v0.2.2-0.20250506153119-35fb8474f57d"
2427
"github.com/WeidiDeng/caddy-cloudflare-ip@v0.0.0-20231130002422-f53b62aa13cb"
2528
];
26-
hash = "sha256-MhLXRQd6EjQ/yfOpMbr6X/sIXgdhQwXaxkIBmUKAK2I=";
29+
hash = "sha256-ldD2gIlEthnLbRckH+BPKKde95gNPEJbXHTQEjBnE0Q=";
2730
};
2831

2932
configFile = ./Caddyfile;

nixos/hosts/vps/config/services/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
./backend
77
./caddy
8+
./hydra
89
./monitoring
910
./plus
1011
./polyhelper
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{ config, ... }:
2+
{
3+
services.hydra = {
4+
enable = true;
5+
hydraURL = "https://hydra.polyfrost.org";
6+
useSubstitutes = true;
7+
dbi = "dbi:Pg:dbname=hydra;host=${config.custom.nixos-containers.networking.addresses.v6.containers.postgres};user=hydra";
8+
port = 3000;
9+
listenHost = "*";
10+
notificationSender = "hydra@localhost";
11+
extraConfig = ''
12+
allow_import_from_derivation = true
13+
'';
14+
};
15+
}

nixos/hosts/vps/config/services/monitoring/container/grafana.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
};
3131

3232
analytics.reporting_enabled = false;
33+
34+
security.secret_key = "SW2YcwTIb9zpOOhoPsMm"; # yes this is the default from nix. no i don't care. anyone can decrypt the database if they get access to it
3335
};
3436

3537
provision = {

nixos/hosts/vps/config/services/networking.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ in
3636
networking = {
3737
# Let containers access host ports conditionally
3838
firewall.extraInputRules = ''
39+
ip saddr ${containerIps.v4.containers.caddy} tcp dport 3000 accept comment "Allow caddy to access hydra"
40+
ip6 saddr ${containerIps.v6.containers.caddy} tcp dport 3000 accept comment "Allow caddy to access hydra"
41+
3942
ip saddr ${containerIps.v4.containers.monitoring} tcp dport 9100 accept comment "Allow monitoring to access node exporter"
4043
ip6 saddr ${containerIps.v6.containers.monitoring} tcp dport 9100 accept comment "Allow monitoring to access node exporter"
4144
'';

nixos/hosts/vps/config/services/postgres/container.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ let
1111
"forgejo" = ips.v6.containers.forgejo;
1212
"dex" = ips.v6.containers.dex;
1313
"plus" = ips.v6.containers.plus;
14+
"hydra" = ips.v6.host;
1415
};
1516
mkAuthEntry =
1617
{ name, value }:

nixos/hosts/vps/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
(final: prev: {
4040
inherit (prev.lixPackageSets.stable)
4141
nixpkgs-review
42-
nix-eval-jobs
42+
# nix-eval-jobs
4343
nix-fast-build
4444
colmena
4545
;

0 commit comments

Comments
 (0)