2024-10-18 11:39:07 -04:00
|
|
|
{ config, pkgs, ... }:
|
2024-07-06 12:50:45 -04:00
|
|
|
|
2024-09-04 10:39:03 -04:00
|
|
|
let
|
|
|
|
# Do not change this value! This tracks when NixOS was installed on your system.
|
|
|
|
stateVersion = "24.11";
|
|
|
|
hostName = "Hevana";
|
2024-05-19 14:33:15 -04:00
|
|
|
|
2024-09-04 10:39:03 -04:00
|
|
|
# Where to store service files
|
2024-06-19 14:00:17 -04:00
|
|
|
services-root = "/storage/services";
|
|
|
|
|
2024-09-04 10:39:03 -04:00
|
|
|
# Credentials for interacting with the Namecheap API
|
2024-06-25 14:27:58 -04:00
|
|
|
namecheapCredentials = {
|
|
|
|
"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-09-04 10:39:03 -04:00
|
|
|
|
|
|
|
# List of subdomains to add to the TLS certificate
|
2024-09-07 19:07:50 -04:00
|
|
|
subdomains = with config.secrets.services; [
|
2024-10-25 16:54:19 -04:00
|
|
|
dav.url
|
2024-09-07 19:07:50 -04:00
|
|
|
forgejo.url
|
|
|
|
gremlin-lab.url
|
|
|
|
jellyfin.url
|
2024-09-28 17:15:39 -04:00
|
|
|
languagetool.url
|
2024-09-07 19:07:50 -04:00
|
|
|
netdata.url
|
2024-09-10 20:14:40 -04:00
|
|
|
qbittorrent.url
|
2024-09-04 10:39:03 -04:00
|
|
|
];
|
2024-02-29 09:53:34 -05:00
|
|
|
in
|
|
|
|
{
|
2024-05-07 18:02:59 -04:00
|
|
|
imports = [ ./hardware-configuration.nix ];
|
|
|
|
|
2024-07-06 12:50:45 -04:00
|
|
|
system.stateVersion = stateVersion;
|
|
|
|
networking.hostName = hostName;
|
2024-02-29 09:53:34 -05:00
|
|
|
|
2024-09-04 10:39:03 -04:00
|
|
|
###*** Configure your system below this line. ***###
|
2024-09-08 13:42:01 -04:00
|
|
|
# Set your time zone.
|
|
|
|
# To see all available timezones, run `timedatectl list-timezones`.
|
|
|
|
time.timeZone = "America/New_York";
|
|
|
|
|
2024-09-04 10:39:03 -04:00
|
|
|
# Configure the system.
|
2024-06-24 11:38:28 -04:00
|
|
|
aux.system = {
|
2024-09-04 10:39:03 -04:00
|
|
|
# Enable to allow unfree (e.g. closed source) packages.
|
|
|
|
# Some settings may override this (e.g. enabling Nvidia GPU support).
|
|
|
|
# https://nixos.org/manual/nixpkgs/stable/#sec-allow-unfree
|
|
|
|
allowUnfree = true;
|
|
|
|
|
|
|
|
# Enable Secure Boot support.
|
2024-06-24 18:19:27 -04:00
|
|
|
bootloader = {
|
|
|
|
enable = true;
|
|
|
|
secureboot.enable = true;
|
|
|
|
tpm2.enable = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
# Change the default text editor. Options are "emacs", "nano", or "vim".
|
|
|
|
editor = "nano";
|
|
|
|
|
2024-09-04 10:39:03 -04:00
|
|
|
# Enable GPU support.
|
2024-06-24 13:08:18 -04:00
|
|
|
gpu.amd.enable = true;
|
2024-06-24 18:19:27 -04:00
|
|
|
|
2024-09-04 10:39:03 -04:00
|
|
|
# Enable support for primary RAID array
|
2024-09-17 10:42:09 -04:00
|
|
|
raid.storage = {
|
|
|
|
enable = true;
|
|
|
|
keyFile = config.secrets.devices.storage.keyFile.path;
|
|
|
|
mailAddr = config.secrets.users.aires.email;
|
|
|
|
};
|
2024-06-24 18:19:27 -04:00
|
|
|
|
2024-09-04 10:39:03 -04:00
|
|
|
# Change how long old generations are kept for.
|
|
|
|
retentionPeriod = "30d";
|
2024-06-24 18:19:27 -04:00
|
|
|
|
2024-05-07 18:02:59 -04:00
|
|
|
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 = {
|
2024-09-02 11:06:57 -04:00
|
|
|
"${config.secrets.networking.domains.primary}" = {
|
2024-05-20 20:52:57 -04:00
|
|
|
dnsProvider = "namecheap";
|
|
|
|
extraDomainNames = subdomains;
|
|
|
|
webroot = null; # Required in order to prevent a failed assertion
|
2024-06-25 14:27:58 -04:00
|
|
|
credentialFiles = namecheapCredentials;
|
2024-05-20 20:52:57 -04:00
|
|
|
};
|
2024-09-02 11:06:57 -04:00
|
|
|
"${config.secrets.networking.domains.blog}" = {
|
2024-06-19 14:00:17 -04:00
|
|
|
dnsProvider = "namecheap";
|
|
|
|
webroot = null; # Required in order to prevent a failed assertion
|
2024-06-25 14:27:58 -04:00
|
|
|
credentialFiles = namecheapCredentials;
|
2024-06-19 14:00:17 -04:00
|
|
|
};
|
2024-05-20 20:52:57 -04:00
|
|
|
};
|
|
|
|
};
|
2024-05-21 09:22:03 -04:00
|
|
|
apcupsd = {
|
|
|
|
enable = true;
|
|
|
|
configText = builtins.readFile ./etc/apcupsd.conf;
|
|
|
|
};
|
2024-06-24 12:24:21 -04:00
|
|
|
autoUpgrade = {
|
2024-09-08 23:54:10 -04:00
|
|
|
enable = true;
|
|
|
|
pushUpdates = true; # Update automatically and push updates back up to Forgejo
|
2024-06-24 12:24:21 -04:00
|
|
|
configDir = config.secrets.nixConfigFolder;
|
|
|
|
onCalendar = "daily";
|
|
|
|
user = config.users.users.aires.name;
|
|
|
|
};
|
2024-09-14 16:05:10 -04:00
|
|
|
boinc = {
|
|
|
|
enable = false;
|
|
|
|
home = "${services-root}/boinc";
|
|
|
|
};
|
2024-05-07 18:02:59 -04:00
|
|
|
duplicacy-web = {
|
|
|
|
enable = true;
|
2024-09-04 10:39:03 -04:00
|
|
|
home = "/storage/backups/settings/Haven";
|
2024-05-07 18:02:59 -04:00
|
|
|
};
|
2024-05-20 12:27:01 -04:00
|
|
|
forgejo = {
|
|
|
|
enable = true;
|
2024-06-19 14:00:17 -04:00
|
|
|
home = "${services-root}/forgejo";
|
2024-06-25 14:13:15 -04:00
|
|
|
url = config.secrets.services.forgejo.url;
|
2024-05-20 12:27:01 -04:00
|
|
|
};
|
2024-09-04 10:39:03 -04:00
|
|
|
jellyfin = {
|
|
|
|
enable = true;
|
|
|
|
home = "${services-root}/jellyfin";
|
|
|
|
url = config.secrets.services.jellyfin.url;
|
|
|
|
};
|
2024-09-28 16:39:57 -04:00
|
|
|
languagetool = {
|
|
|
|
enable = true;
|
|
|
|
url = config.secrets.services.languagetool.url;
|
2024-09-28 17:15:39 -04:00
|
|
|
port = 8100;
|
2024-09-28 16:39:57 -04:00
|
|
|
auth.user = config.secrets.services.languagetool.auth.user;
|
|
|
|
auth.password = config.secrets.services.languagetool.auth.password;
|
|
|
|
ngrams.enable = true;
|
|
|
|
};
|
2024-09-15 14:39:26 -04:00
|
|
|
msmtp = {
|
|
|
|
enable = true;
|
|
|
|
accounts.default = {
|
|
|
|
host = config.secrets.services.msmtp.host;
|
|
|
|
user = config.secrets.services.msmtp.user;
|
|
|
|
password = config.secrets.services.msmtp.password;
|
|
|
|
auth = true;
|
|
|
|
tls = true;
|
|
|
|
tls_starttls = true;
|
|
|
|
port = 587;
|
|
|
|
from = "${config.networking.hostName}@${config.secrets.networking.domains.primary}";
|
|
|
|
};
|
|
|
|
aliases = {
|
|
|
|
text = ''
|
|
|
|
default: ${config.secrets.users.aires.email}
|
|
|
|
'';
|
|
|
|
mode = "0644";
|
|
|
|
};
|
|
|
|
};
|
2024-09-04 10:39:03 -04:00
|
|
|
netdata = {
|
|
|
|
enable = true;
|
|
|
|
type = "parent";
|
|
|
|
url = config.secrets.services.netdata.url;
|
|
|
|
auth = {
|
|
|
|
user = config.users.users.aires.name;
|
|
|
|
password = config.secrets.services.netdata.password;
|
|
|
|
apiKey = config.secrets.services.netdata.apiKey;
|
|
|
|
};
|
|
|
|
};
|
2024-05-20 20:52:57 -04:00
|
|
|
nginx = {
|
|
|
|
enable = true;
|
|
|
|
virtualHosts = {
|
2024-09-02 11:06:57 -04:00
|
|
|
"${config.secrets.networking.domains.primary}" = {
|
2024-05-20 20:52:57 -04:00
|
|
|
default = true;
|
|
|
|
enableACME = true; # Enable Let's Encrypt
|
|
|
|
locations."/" = {
|
|
|
|
# Catchall vhost, will redirect users to Forgejo
|
2024-05-22 15:39:57 -04:00
|
|
|
return = "301 https://${config.secrets.services.forgejo.url}";
|
2024-05-20 20:52:57 -04:00
|
|
|
};
|
|
|
|
};
|
2024-09-14 12:33:52 -04:00
|
|
|
"${config.secrets.networking.domains.blog}" = {
|
2024-09-02 11:06:57 -04:00
|
|
|
useACMEHost = config.secrets.networking.domains.blog;
|
2024-06-19 14:00:17 -04:00
|
|
|
forceSSL = true;
|
2024-09-02 11:06:57 -04:00
|
|
|
root = "${services-root}/nginx/sites/${config.secrets.networking.domains.blog}";
|
2024-06-19 14:00:17 -04:00
|
|
|
};
|
2024-05-24 11:56:23 -04:00
|
|
|
"${config.secrets.services.gremlin-lab.url}" = {
|
2024-09-02 11:06:57 -04:00
|
|
|
useACMEHost = config.secrets.networking.domains.primary;
|
2024-05-24 11:56:23 -04:00
|
|
|
forceSSL = true;
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://${config.secrets.services.gremlin-lab.ip}";
|
|
|
|
proxyWebsockets = true;
|
|
|
|
extraConfig = "proxy_ssl_server_name on;";
|
|
|
|
};
|
|
|
|
};
|
2024-05-20 20:52:57 -04:00
|
|
|
};
|
|
|
|
};
|
2024-09-10 20:14:40 -04:00
|
|
|
qbittorrent = {
|
|
|
|
enable = true;
|
|
|
|
home = "${services-root}/qbittorrent";
|
|
|
|
url = config.secrets.services.qbittorrent.url;
|
2024-09-13 11:25:39 -04:00
|
|
|
port = "8090";
|
|
|
|
vpn = {
|
|
|
|
enable = true;
|
|
|
|
privateKey = config.secrets.services.protonvpn.privateKey;
|
2024-10-03 20:31:51 -04:00
|
|
|
countries = [
|
|
|
|
"Norway"
|
|
|
|
"Netherlands"
|
|
|
|
];
|
2024-09-13 11:25:39 -04:00
|
|
|
};
|
2024-09-10 20:14:40 -04:00
|
|
|
};
|
2024-05-20 20:52:57 -04:00
|
|
|
ssh = {
|
|
|
|
enable = true;
|
2024-10-18 11:39:07 -04:00
|
|
|
ports = [ config.secrets.hosts.hevana.ssh.port ];
|
2024-05-20 20:52:57 -04:00
|
|
|
};
|
2024-09-04 10:39:03 -04:00
|
|
|
virtualization.host = {
|
|
|
|
enable = true;
|
|
|
|
user = "aires";
|
|
|
|
vmBuilds = {
|
2024-06-25 14:13:15 -04:00
|
|
|
enable = true;
|
2024-09-04 10:39:03 -04:00
|
|
|
cores = 3;
|
|
|
|
ram = 4096;
|
2024-06-25 14:13:15 -04:00
|
|
|
};
|
2024-05-22 16:47:55 -04:00
|
|
|
};
|
2024-10-25 16:54:19 -04:00
|
|
|
webdav = {
|
|
|
|
enable = false;
|
|
|
|
home = "${services-root}/webdav";
|
|
|
|
url = config.secrets.services.webdav.url;
|
|
|
|
users = config.secrets.services.webdav.users;
|
|
|
|
};
|
2024-05-07 18:02:59 -04:00
|
|
|
};
|
2024-09-04 10:39:03 -04:00
|
|
|
|
2024-05-21 09:22:03 -04:00
|
|
|
users.aires = {
|
|
|
|
enable = true;
|
2024-09-04 10:39:03 -04:00
|
|
|
services = {
|
|
|
|
syncthing = {
|
|
|
|
enable = true;
|
2024-09-08 13:17:40 -04:00
|
|
|
home = "${services-root}/syncthing/aires";
|
2024-09-04 10:39:03 -04:00
|
|
|
};
|
2024-05-07 18:02:59 -04:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-04-01 12:30:07 -04:00
|
|
|
}
|