2024-05-07 18:02:59 -04:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
home-manager,
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
...
|
|
|
|
}:
|
2024-02-29 09:53:34 -05:00
|
|
|
let
|
2024-05-07 18:02:59 -04:00
|
|
|
start-haven = pkgs.writeShellScriptBin "start-haven" (builtins.readFile ./start-haven.sh);
|
2024-05-19 14:33:15 -04:00
|
|
|
|
|
|
|
subdomains = map (subdomain: subdomain + ".${config.secrets.networking.primaryDomain}") [
|
|
|
|
"code"
|
|
|
|
"music"
|
|
|
|
];
|
2024-02-29 09:53:34 -05:00
|
|
|
in
|
|
|
|
{
|
2024-05-07 18:02:59 -04:00
|
|
|
imports = [ ./hardware-configuration.nix ];
|
|
|
|
|
|
|
|
system.stateVersion = "24.05";
|
|
|
|
system.autoUpgrade.enable = lib.mkForce false;
|
2024-02-29 09:53:34 -05:00
|
|
|
|
2024-05-07 18:02:59 -04:00
|
|
|
host = {
|
|
|
|
role = "server";
|
|
|
|
apps.development.kubernetes.enable = true;
|
|
|
|
services = {
|
2024-05-20 20:52:57 -04:00
|
|
|
acme = {
|
|
|
|
enable = true;
|
2024-05-20 20:56:48 -04:00
|
|
|
defaultEmail = config.secrets.users.aires.email;
|
2024-05-20 20:52:57 -04:00
|
|
|
certs = {
|
|
|
|
"${config.secrets.networking.primaryDomain}" = {
|
|
|
|
dnsProvider = "namecheap";
|
|
|
|
extraDomainNames = subdomains;
|
|
|
|
webroot = null; # Required in order to prevent a failed assertion
|
|
|
|
credentialFiles = {
|
|
|
|
"NAMECHEAP_API_USER_FILE" = "${pkgs.writeText "namecheap-api-user" ''
|
|
|
|
${config.secrets.networking.namecheap.api.user}
|
|
|
|
''}";
|
|
|
|
"NAMECHEAP_API_KEY_FILE" = "${pkgs.writeText "namecheap-api-key" ''
|
|
|
|
${config.secrets.networking.namecheap.api.key}
|
|
|
|
''}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-05-21 09:22:03 -04:00
|
|
|
apcupsd = {
|
|
|
|
enable = true;
|
|
|
|
configText = builtins.readFile ./etc/apcupsd.conf;
|
|
|
|
};
|
2024-05-20 12:27:01 -04:00
|
|
|
airsonic = {
|
|
|
|
enable = true;
|
|
|
|
domain = config.secrets.networking.primaryDomain;
|
|
|
|
home = "/storage/services/airsonic-advanced";
|
|
|
|
};
|
2024-05-20 20:52:57 -04:00
|
|
|
boinc.enable = true;
|
2024-05-07 18:02:59 -04:00
|
|
|
duplicacy-web = {
|
|
|
|
enable = true;
|
|
|
|
autostart = false;
|
2024-05-22 10:43:26 -04:00
|
|
|
environment = "/storage/backups/Haven";
|
2024-05-07 18:02:59 -04:00
|
|
|
};
|
2024-05-20 12:27:01 -04:00
|
|
|
forgejo = {
|
|
|
|
enable = true;
|
|
|
|
domain = config.secrets.networking.primaryDomain;
|
|
|
|
home = "/storage/services/forgejo";
|
|
|
|
};
|
2024-05-07 18:02:59 -04:00
|
|
|
msmtp.enable = true;
|
2024-05-20 20:52:57 -04:00
|
|
|
nginx = {
|
|
|
|
enable = true;
|
|
|
|
autostart = false;
|
|
|
|
virtualHosts = {
|
|
|
|
"${config.secrets.networking.primaryDomain}" = {
|
|
|
|
default = true;
|
|
|
|
enableACME = true; # Enable Let's Encrypt
|
|
|
|
locations."/" = {
|
|
|
|
# Catchall vhost, will redirect users to Forgejo
|
|
|
|
return = "301 https://code.${config.secrets.networking.primaryDomain}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
ssh = {
|
|
|
|
enable = true;
|
|
|
|
ports = [ config.secrets.hosts.haven.ssh.port ];
|
|
|
|
};
|
2024-05-07 18:02:59 -04:00
|
|
|
};
|
2024-05-21 09:22:03 -04:00
|
|
|
users.aires = {
|
|
|
|
enable = true;
|
|
|
|
services.syncthing = {
|
2024-05-07 18:02:59 -04:00
|
|
|
enable = true;
|
2024-05-21 09:22:03 -04:00
|
|
|
autostart = false;
|
2024-05-07 18:02:59 -04:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-02-29 09:53:34 -05:00
|
|
|
|
2024-05-20 20:52:57 -04:00
|
|
|
# TODO: VPN (Check out Wireguard)
|
2024-05-19 14:33:15 -04:00
|
|
|
|
2024-05-20 12:27:01 -04:00
|
|
|
# Add Haven's startup script
|
|
|
|
environment.systemPackages = [ start-haven ];
|
2024-05-19 14:33:15 -04:00
|
|
|
|
|
|
|
# Allow Haven to be a build target for other architectures (mainly ARM64)
|
|
|
|
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
|
2024-04-01 12:30:07 -04:00
|
|
|
}
|