Compare commits
7 Commits
2812e85976
...
main
Author | SHA1 | Date | |
---|---|---|---|
3e718fadfc
|
|||
763ee6312a
|
|||
5704ebe712
|
|||
70b5d5fd4d
|
|||
c29acb0902
|
|||
a545b4a45c
|
|||
c839811b9f
|
42
hosts/pi4/actual.nix
Normal file
42
hosts/pi4/actual.nix
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
{ config, common, ... }:
|
||||||
|
let
|
||||||
|
domain = "beta.budget.${common.domain}";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
networking.nat = {
|
||||||
|
enable = true;
|
||||||
|
internalInterfaces = [ "ve-*" ];
|
||||||
|
externalInterface = "wlan0";
|
||||||
|
# Lazy IPv6 connectivity for the container
|
||||||
|
enableIPv6 = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
containers.actual = {
|
||||||
|
autoStart = true;
|
||||||
|
privateNetwork = true;
|
||||||
|
hostAddress = "192.168.10.188";
|
||||||
|
localAddress = "192.168.10.11";
|
||||||
|
config =
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
services = {
|
||||||
|
actual = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
port = 8084;
|
||||||
|
loginMethod = "password";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
system.stateVersion = common.system.version;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
services.nginx.virtualHosts.${domain} = {
|
||||||
|
forceSSL = true;
|
||||||
|
enableACME = true;
|
||||||
|
locations."/" = {
|
||||||
|
proxyPass = "http://${config.containers.actual.localAddress}:8084";
|
||||||
|
proxyWebsockets = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
@ -3,14 +3,17 @@
|
|||||||
{
|
{
|
||||||
imports = with lib.custom; [
|
imports = with lib.custom; [
|
||||||
(relativeToBase "modules")
|
(relativeToBase "modules")
|
||||||
|
./actual.nix
|
||||||
./boot.nix
|
./boot.nix
|
||||||
./caddy.nix
|
./caddy.nix
|
||||||
./forgejo.nix
|
./forgejo.nix
|
||||||
./hardware.nix
|
./hardware.nix
|
||||||
|
./headscale.nix
|
||||||
./mailserver.nix
|
./mailserver.nix
|
||||||
./nextcloud.nix
|
./nextcloud.nix
|
||||||
./nginx.nix
|
./nginx.nix
|
||||||
./podman.nix
|
./podman.nix
|
||||||
|
./postgres.nix
|
||||||
./security
|
./security
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
|
systemConfig,
|
||||||
common,
|
common,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
@ -26,6 +27,9 @@ in
|
|||||||
database.type = "postgres";
|
database.type = "postgres";
|
||||||
# Enable support for Git Large File Storage
|
# Enable support for Git Large File Storage
|
||||||
lfs.enable = true;
|
lfs.enable = true;
|
||||||
|
|
||||||
|
secrets.mailer.PASSWD = config.sops.secrets."mailserver/password-hash".path;
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
server = {
|
server = {
|
||||||
DOMAIN = domain;
|
DOMAIN = domain;
|
||||||
@ -48,10 +52,9 @@ in
|
|||||||
PROTOCOL = "smtps";
|
PROTOCOL = "smtps";
|
||||||
SMTP_ADDR = config.mailserver.fqdn;
|
SMTP_ADDR = config.mailserver.fqdn;
|
||||||
FROM = "noreply-forgejo@${common.domain}";
|
FROM = "noreply-forgejo@${common.domain}";
|
||||||
USER = "noreply@${common.domain}";
|
USER = "${systemConfig.username}@${common.domain}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
#mailerPasswordFile = config.sops.secrets."forgejo/mailer-password".path;
|
|
||||||
};
|
};
|
||||||
gitea-actions-runner = {
|
gitea-actions-runner = {
|
||||||
package = pkgs.forgejo-actions-runner;
|
package = pkgs.forgejo-actions-runner;
|
||||||
|
66
hosts/pi4/headscale.nix
Normal file
66
hosts/pi4/headscale.nix
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
common,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.services.headscale;
|
||||||
|
|
||||||
|
domain = "beta.vpn.${common.domain}";
|
||||||
|
dnsDomain = "secure.${common.domain}";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
networking.firewall = {
|
||||||
|
trustedInterfaces = [ config.services.tailscale.interfaceName ];
|
||||||
|
allowedUDPPorts = [ config.services.tailscale.port ];
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
headscale = {
|
||||||
|
enable = true;
|
||||||
|
address = "0.0.0.0";
|
||||||
|
port = 8083;
|
||||||
|
settings = {
|
||||||
|
database = {
|
||||||
|
postgres = {
|
||||||
|
host = "/run/postgresql";
|
||||||
|
name = "headscale";
|
||||||
|
port = config.services.postgresql.settings.port;
|
||||||
|
user = cfg.user;
|
||||||
|
};
|
||||||
|
type = "postgres";
|
||||||
|
};
|
||||||
|
dns = {
|
||||||
|
base_domain = dnsDomain;
|
||||||
|
magic_dns = true;
|
||||||
|
};
|
||||||
|
logtail.enabled = false;
|
||||||
|
server_url = "https://${domain}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nginx.virtualHosts.${domain} = {
|
||||||
|
forceSSL = true;
|
||||||
|
enableACME = true;
|
||||||
|
locations."/" = {
|
||||||
|
proxyPass = "http://localhost:${toString config.services.headscale.port}";
|
||||||
|
proxyWebsockets = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
postgresql =
|
||||||
|
let
|
||||||
|
psql = cfg.settings.database.postgres;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
ensureDatabases = [ psql.name ];
|
||||||
|
ensureUsers = [
|
||||||
|
{
|
||||||
|
name = psql.user;
|
||||||
|
ensureDBOwnership = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
@ -63,7 +63,6 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
postgresql = {
|
postgresql = {
|
||||||
enable = true;
|
|
||||||
ensureDatabases = [ dbname ];
|
ensureDatabases = [ dbname ];
|
||||||
ensureUsers = [
|
ensureUsers = [
|
||||||
{
|
{
|
||||||
|
@ -25,6 +25,7 @@ in
|
|||||||
{
|
{
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
enableReload = true;
|
||||||
recommendedProxySettings = true;
|
recommendedProxySettings = true;
|
||||||
recommendedTlsSettings = true;
|
recommendedTlsSettings = true;
|
||||||
|
|
||||||
@ -51,7 +52,20 @@ in
|
|||||||
# Headscale
|
# Headscale
|
||||||
"vpn.${domain}" = proxyLocations {
|
"vpn.${domain}" = proxyLocations {
|
||||||
"/web".proxyPass = "${homelab}:8084";
|
"/web".proxyPass = "${homelab}:8084";
|
||||||
"/".proxyPass = "${homelab}:8082";
|
"/" = {
|
||||||
|
proxyPass = "${homelab}:8082";
|
||||||
|
extraConfig = ''
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection $connection_upgrade;
|
||||||
|
proxy_redirect http:// https://;
|
||||||
|
proxy_buffering off;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
add_header Strict-Transport-Security "max-age=15552000; includeSubDomains" always;
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
# Headscale SmartDNS
|
# Headscale SmartDNS
|
||||||
"dns.${domain}" = homelabProxy 8082;
|
"dns.${domain}" = homelabProxy 8082;
|
||||||
|
11
hosts/pi4/postgres.nix
Normal file
11
hosts/pi4/postgres.nix
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
services.postgresql = {
|
||||||
|
enable = true;
|
||||||
|
authentication = pkgs.lib.mkOverride 10 ''
|
||||||
|
#type database DBuser auth-method
|
||||||
|
local all all trust
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
@ -1,3 +1,5 @@
|
|||||||
|
{ common, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
networking = {
|
networking = {
|
||||||
firewall = {
|
firewall = {
|
||||||
@ -6,14 +8,9 @@
|
|||||||
80
|
80
|
||||||
443
|
443
|
||||||
];
|
];
|
||||||
trustedInterfaces = [ "tailscale0" ];
|
extraInputRules = ''
|
||||||
extraInputRules =
|
ip saddr ${common.localIpRange} accept
|
||||||
let
|
'';
|
||||||
localIPv4Range = "192.168.10.0/24";
|
|
||||||
in
|
|
||||||
''
|
|
||||||
ip saddr ${localIPv4Range} accept
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
nftables.enable = true;
|
nftables.enable = true;
|
||||||
};
|
};
|
||||||
|
@ -16,6 +16,7 @@ rec {
|
|||||||
domain = "martials.no";
|
domain = "martials.no";
|
||||||
tailnetDomain = "dns.${domain}";
|
tailnetDomain = "dns.${domain}";
|
||||||
localIpPrefix = "192.168.10.";
|
localIpPrefix = "192.168.10.";
|
||||||
|
localIpRange = "${localIpPrefix}0/24";
|
||||||
localIpAddr = subAddr: "${localIpPrefix}${builtins.toString subAddr}";
|
localIpAddr = subAddr: "${localIpPrefix}${builtins.toString subAddr}";
|
||||||
tailnetAddr = host: "${host}.${tailnetDomain}";
|
tailnetAddr = host: "${host}.${tailnetDomain}";
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ sops:
|
|||||||
SGdNMnVlQlNEeVJkWmZEM1FRT2JJMGMKbZ/znJM6tFhzhHariRXMLgH/4CRZZKrb
|
SGdNMnVlQlNEeVJkWmZEM1FRT2JJMGMKbZ/znJM6tFhzhHariRXMLgH/4CRZZKrb
|
||||||
YtmSdeL/Pd5YIecCpjDHDn4vQ0TBAmLaX+zVbNbRKmMZoY7777ywfA==
|
YtmSdeL/Pd5YIecCpjDHDn4vQ0TBAmLaX+zVbNbRKmMZoY7777ywfA==
|
||||||
-----END AGE ENCRYPTED FILE-----
|
-----END AGE ENCRYPTED FILE-----
|
||||||
lastmodified: "2025-06-02T17:06:40Z"
|
lastmodified: "2025-06-23T17:39:10Z"
|
||||||
mac: ENC[AES256_GCM,data:gwYDPAicJCWdCwW5hikEUkByf0KtSBGNOzfqyTdtsMvTi2HCOiKL2JgBnqjDF82o2XfbHalzzYTstxfWla62lLzF/xPWWoWOtAVB7w2YcEkptr66qU4q3iQi7t878B/+VVHva35TEho8b2JL2vgJNpBp3l06XeWMYCpupc5P7pM=,iv:ZaTpfjfcMeeExySTfI2wMSmFBFi6aoH83yYiucZXRQM=,tag:XwAvMtrX1bUumEaRf3T7Cg==,type:str]
|
mac: ENC[AES256_GCM,data:+6X13vyCteJKZFo6RMI4rCo/gizcJO828xTL/gspgZemHcnqaf1P6nIntE5flin7IsfkxqoH8k25Xqzp6TLddsw8oYGA7fyDX7l28wFoxASTaZu2KChqGeRsEuVjuQGIAHKbB/4aI003NPT48l+uePOMNwUzlBrRnRYE5MMgQRI=,iv:UefKr2KL0+py7soUGjS0Onql/cAO+mXpvzJKJjtRppU=,tag:qcvB7rrdDRC3EfgjonM6uw==,type:str]
|
||||||
unencrypted_suffix: _unencrypted
|
unencrypted_suffix: _unencrypted
|
||||||
version: 3.10.2
|
version: 3.10.2
|
||||||
|
Reference in New Issue
Block a user