2023-06-26 15:25:26 +01:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
{
|
|
|
|
imports =
|
|
|
|
[ # Include the results of the hardware scan.
|
|
|
|
./hardware.nix
|
|
|
|
];
|
2023-07-14 16:32:54 +01:00
|
|
|
|
2023-06-26 15:25:26 +01:00
|
|
|
nix = {
|
|
|
|
settings = {
|
|
|
|
auto-optimise-store = true;
|
|
|
|
experimental-features = ["nix-command" "flakes"];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
boot = {
|
|
|
|
tmp.cleanOnBoot = true;
|
|
|
|
loader = {
|
|
|
|
systemd-boot.enable = true;
|
|
|
|
efi.canTouchEfiVariables = true;
|
|
|
|
};
|
|
|
|
supportedFilesystems = ["zfs"];
|
|
|
|
kernelModules = [ "coretemp" "kvm-amd" "it87" ];
|
|
|
|
zfs.extraPools = ["Primary"];
|
|
|
|
};
|
|
|
|
|
|
|
|
services = {
|
2023-08-05 12:05:53 +01:00
|
|
|
coredns = {
|
|
|
|
enable = true;
|
|
|
|
config =
|
|
|
|
''
|
|
|
|
.:53 {
|
2023-08-05 13:15:42 +01:00
|
|
|
health
|
|
|
|
file /var/src/dns.db git.gmem.ca
|
|
|
|
forward . 45.90.28.116 45.90.30.116
|
2023-08-05 12:05:53 +01:00
|
|
|
bind tailscale0
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
pipewire = {
|
|
|
|
enable = true;
|
|
|
|
alsa.enable = true;
|
|
|
|
alsa.support32Bit = true;
|
|
|
|
pulse.enable = true;
|
|
|
|
jack.enable = true;
|
|
|
|
};
|
2023-06-26 15:25:26 +01:00
|
|
|
zfs.autoScrub.enable = true;
|
|
|
|
tailscale.enable = true;
|
|
|
|
openssh.enable = true;
|
|
|
|
xserver.videoDrivers = [ "nvidia" ];
|
|
|
|
nfs.server.enable = true;
|
|
|
|
samba-wsdd.enable = true;
|
|
|
|
samba = {
|
|
|
|
enable = true;
|
|
|
|
securityType = "user";
|
2023-08-15 09:13:41 +01:00
|
|
|
openFirewall = true;
|
2023-06-26 15:25:26 +01:00
|
|
|
extraConfig = ''
|
|
|
|
workgroup = WORKGROUP
|
|
|
|
server string = smbnix
|
|
|
|
netbios name = smbnix
|
|
|
|
security = user
|
|
|
|
#use sendfile = yes
|
|
|
|
#max protocol = smb2
|
|
|
|
# note: localhost is the ipv6 localhost ::1
|
|
|
|
hosts allow = 100. 192.168.50. 127.0.0.1 localhost
|
|
|
|
hosts deny = 0.0.0.0/0
|
|
|
|
guest account = nobody
|
|
|
|
map to guest = bad user
|
|
|
|
'';
|
|
|
|
shares = {
|
|
|
|
media = {
|
|
|
|
path = "/Primary/media";
|
|
|
|
browseable = "yes";
|
|
|
|
"read only" = "no";
|
|
|
|
"guest ok" = "yes";
|
|
|
|
"create mask" = "0644";
|
|
|
|
"directory mask" = "0755";
|
|
|
|
};
|
|
|
|
becki = {
|
|
|
|
path = "/Primary/becki";
|
|
|
|
browseable = "yes";
|
|
|
|
"read only" = "no";
|
|
|
|
"guest ok" = "no";
|
|
|
|
"create mask" = "0644";
|
|
|
|
"directory mask" = "0755";
|
|
|
|
"admin users" = "becki";
|
|
|
|
};
|
|
|
|
shared = {
|
|
|
|
path = "/Primary/shared";
|
|
|
|
browseable = "yes";
|
|
|
|
"read only" = "no";
|
|
|
|
"guest ok" = "no";
|
|
|
|
"create mask" = "0644";
|
|
|
|
"directory mask" = "0755";
|
|
|
|
};
|
|
|
|
gabriel = {
|
|
|
|
path = "/Primary/gabriel";
|
|
|
|
browseable = "yes";
|
|
|
|
"read only" = "no";
|
|
|
|
"guest ok" = "no";
|
|
|
|
"create mask" = "0644";
|
|
|
|
"directory mask" = "0755";
|
|
|
|
"admin users" = "gsimmer";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
plex = {
|
|
|
|
enable = true;
|
|
|
|
openFirewall = true;
|
|
|
|
};
|
2023-06-28 16:57:26 +01:00
|
|
|
nginx = {
|
|
|
|
enable = true;
|
2023-07-15 12:03:11 +01:00
|
|
|
recommendedGzipSettings = true;
|
|
|
|
recommendedBrotliSettings = true;
|
|
|
|
recommendedZstdSettings = true;
|
|
|
|
recommendedOptimisation = true;
|
2023-08-05 12:05:53 +01:00
|
|
|
recommendedTlsSettings = true;
|
2023-07-14 16:32:54 +01:00
|
|
|
# We can only proxy one port with Tailscale Funnel so we abuse locations instead.
|
|
|
|
virtualHosts."vancouver.gmem.ca" = {
|
|
|
|
default = true;
|
2023-08-05 12:05:53 +01:00
|
|
|
enableACME = true;
|
|
|
|
addSSL = true;
|
|
|
|
acmeRoot = null;
|
2023-07-15 12:03:11 +01:00
|
|
|
locations."/" = {
|
|
|
|
root = "/var/www/";
|
|
|
|
extraConfig = ''
|
|
|
|
error_page 404 /404.html;
|
|
|
|
'';
|
|
|
|
};
|
2023-07-14 16:32:54 +01:00
|
|
|
};
|
2023-08-05 12:05:53 +01:00
|
|
|
virtualHosts."git.gmem.ca" = {
|
|
|
|
enableACME = true;
|
|
|
|
addSSL = true;
|
|
|
|
acmeRoot = null;
|
|
|
|
locations."/" = {
|
|
|
|
extraConfig =
|
|
|
|
''
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
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;
|
2023-08-15 09:14:14 +01:00
|
|
|
|
|
|
|
client_max_body_size 100M;
|
2023-08-05 12:05:53 +01:00
|
|
|
'';
|
|
|
|
proxyPass = "http://127.0.0.1:8973/";
|
|
|
|
};
|
|
|
|
};
|
2023-08-15 09:14:14 +01:00
|
|
|
virtualHosts."request-media.gmem.ca" = {
|
|
|
|
enableACME = true;
|
|
|
|
addSSL = true;
|
|
|
|
acmeRoot = null;
|
|
|
|
locations."/" = {
|
|
|
|
extraConfig =
|
|
|
|
''
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
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;
|
|
|
|
|
|
|
|
client_max_body_size 100M;
|
|
|
|
'';
|
|
|
|
proxyPass = "http://127.0.0.1:5055/";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
virtualHosts."flood.gmem.ca" = {
|
|
|
|
enableACME = true;
|
|
|
|
addSSL = true;
|
|
|
|
acmeRoot = null;
|
|
|
|
locations."/" = {
|
|
|
|
extraConfig =
|
|
|
|
''
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
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;
|
|
|
|
|
|
|
|
client_max_body_size 100M;
|
|
|
|
'';
|
|
|
|
proxyPass = "http://192.168.50.187:3000/";
|
|
|
|
};
|
|
|
|
};
|
2023-07-14 16:32:54 +01:00
|
|
|
};
|
|
|
|
gitea = {
|
|
|
|
enable = true;
|
|
|
|
stateDir = "/Primary/gitea";
|
|
|
|
package = pkgs.forgejo;
|
|
|
|
settings = {
|
2023-08-15 09:14:14 +01:00
|
|
|
DEFAULT = {
|
|
|
|
APP_NAME = "Arch's Git Forge";
|
|
|
|
};
|
2023-07-14 16:32:54 +01:00
|
|
|
server = {
|
2023-08-05 12:05:53 +01:00
|
|
|
ROOT_URL = "https://git.gmem.ca/";
|
2023-07-14 16:32:54 +01:00
|
|
|
HTTP_PORT = 8973;
|
|
|
|
};
|
|
|
|
service = {
|
|
|
|
DISABLE_REGISTRATION = true;
|
|
|
|
COOKIE_SECURE = true;
|
2023-06-28 16:57:26 +01:00
|
|
|
};
|
2023-07-15 12:03:11 +01:00
|
|
|
actions = {
|
|
|
|
ENABLED = true;
|
|
|
|
};
|
2023-07-19 11:59:28 +01:00
|
|
|
federation = {
|
|
|
|
ENABLED = true;
|
|
|
|
};
|
2023-06-28 16:57:26 +01:00
|
|
|
};
|
|
|
|
};
|
2023-07-15 18:30:28 +01:00
|
|
|
gitea-actions-runner = {
|
2023-09-01 20:19:14 +01:00
|
|
|
package = pkgs.forgejo-actions-runner;
|
2023-07-15 18:30:28 +01:00
|
|
|
instances = {
|
|
|
|
vancouver = {
|
|
|
|
name = "vancouver";
|
|
|
|
enable = true;
|
|
|
|
labels = [
|
|
|
|
"debian-latest:docker://node:18-bullseye"
|
2023-08-15 21:38:06 +01:00
|
|
|
"docker:docker://gitea/act_runner:nightly-dind-rootless"
|
2023-07-19 11:59:28 +01:00
|
|
|
"nix:docker://nixos/nix"
|
2023-07-15 18:30:28 +01:00
|
|
|
];
|
2023-08-05 12:05:53 +01:00
|
|
|
url = "https://git.gmem.ca/";
|
2023-08-15 21:38:06 +01:00
|
|
|
settings = {
|
|
|
|
cache.port = 4328;
|
|
|
|
};
|
2023-07-15 18:30:28 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-08-25 21:15:33 +01:00
|
|
|
sanoid = {
|
|
|
|
enable = true;
|
|
|
|
datasets = {
|
|
|
|
"Primary/becki" = {
|
|
|
|
autoprune = true;
|
|
|
|
autosnap = true;
|
|
|
|
daily = 4;
|
|
|
|
monthly = 3;
|
|
|
|
yearly = 1;
|
|
|
|
};
|
|
|
|
"Primary/gabriel" = {
|
|
|
|
autoprune = true;
|
|
|
|
autosnap = true;
|
|
|
|
daily = 4;
|
|
|
|
monthly = 3;
|
|
|
|
yearly = 1;
|
|
|
|
};
|
|
|
|
"Primary/shared" = {
|
|
|
|
autoprune = true;
|
|
|
|
autosnap = true;
|
|
|
|
daily = 2;
|
|
|
|
monthly = 2;
|
|
|
|
};
|
|
|
|
"Primary/k3scluster" = {
|
|
|
|
autoprune = true;
|
|
|
|
autosnap = true;
|
|
|
|
daily = 2;
|
|
|
|
monthly = 2;
|
|
|
|
};
|
|
|
|
"Primary/gitea" = {
|
|
|
|
autoprune = true;
|
|
|
|
autosnap = true;
|
|
|
|
daily = 2;
|
|
|
|
monthly = 2;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-06-28 16:57:26 +01:00
|
|
|
};
|
|
|
|
|
2023-06-26 15:25:26 +01:00
|
|
|
networking = {
|
|
|
|
hostId = "e1e29bf4";
|
|
|
|
hostName = "vancouver";
|
|
|
|
domain = "gmem.ca";
|
|
|
|
firewall = {
|
2023-08-15 09:14:14 +01:00
|
|
|
trustedInterfaces = ["tailscale0" "virbr0"];
|
2023-06-26 15:25:26 +01:00
|
|
|
checkReversePath = "loose";
|
2023-08-05 12:05:53 +01:00
|
|
|
enable = true;
|
2023-08-15 21:38:06 +01:00
|
|
|
allowedTCPPorts = [ 22 53 80 443 2049 4328 ];
|
2023-08-06 00:04:21 +01:00
|
|
|
allowedUDPPorts = [ 53 41641 ];
|
2023-06-26 15:25:26 +01:00
|
|
|
};
|
2023-08-15 09:14:14 +01:00
|
|
|
useDHCP = false;
|
|
|
|
bridges = {
|
|
|
|
"br0" = {
|
|
|
|
interfaces = [ "eno1" ];
|
|
|
|
};
|
|
|
|
};
|
2023-09-01 20:19:14 +01:00
|
|
|
interfaces.br0.ipv4.addresses = [
|
|
|
|
{
|
|
|
|
address = "192.168.50.229";
|
|
|
|
prefixLength = 24;
|
|
|
|
}
|
|
|
|
];
|
2023-08-15 09:14:14 +01:00
|
|
|
defaultGateway = "192.168.50.1";
|
2023-09-01 20:19:14 +01:00
|
|
|
nameservers = ["45.90.28.116" "45.90.30.116"];
|
2023-06-26 15:25:26 +01:00
|
|
|
nftables.enable = true;
|
|
|
|
};
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
vim
|
|
|
|
wget
|
|
|
|
git
|
|
|
|
htop
|
|
|
|
tailscale
|
|
|
|
home-manager
|
|
|
|
lm_sensors
|
|
|
|
screen
|
|
|
|
nix-output-monitor
|
2023-07-14 16:32:54 +01:00
|
|
|
cifs-utils
|
2023-08-05 12:05:53 +01:00
|
|
|
cloudflared
|
|
|
|
bat
|
2023-08-15 09:14:14 +01:00
|
|
|
virtiofsd
|
2023-06-26 15:25:26 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
time.timeZone = "Europe/London";
|
|
|
|
nixpkgs.config.allowUnfree = true;
|
|
|
|
hardware = {
|
|
|
|
opengl.enable = true;
|
|
|
|
nvidia.modesetting.enable = true;
|
|
|
|
pulseaudio.enable = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
programs = {
|
|
|
|
zsh.enable = true;
|
|
|
|
fish.enable = true;
|
|
|
|
};
|
|
|
|
environment.shells = with pkgs; [ zsh fish ];
|
|
|
|
|
|
|
|
users.users = {
|
|
|
|
gsimmer = {
|
|
|
|
shell = pkgs.fish;
|
|
|
|
isNormalUser = true;
|
|
|
|
home = "/Primary/gabriel";
|
|
|
|
extraGroups = [ "wheel" "libvirtd" "qemu-libvirtd" ];
|
2023-07-30 22:40:43 +01:00
|
|
|
openssh.authorizedKeys.keys = let
|
|
|
|
authorizedKeys = pkgs.fetchurl {
|
|
|
|
url = "https://gmem.ca/ssh";
|
2023-08-25 21:15:57 +01:00
|
|
|
sha256 = "0vm0q5fzx55mmgw7md430c20rvywmknmpvnkffx9szlm0l74bypc";
|
2023-07-30 22:40:43 +01:00
|
|
|
};
|
|
|
|
in pkgs.lib.splitString "\n" (builtins.readFile
|
|
|
|
authorizedKeys);
|
2023-06-26 15:25:26 +01:00
|
|
|
};
|
|
|
|
becki = {
|
|
|
|
shell = pkgs.fish;
|
|
|
|
isNormalUser = true;
|
|
|
|
home = "/Primary/becki";
|
|
|
|
};
|
2023-08-05 12:05:53 +01:00
|
|
|
root.openssh.authorizedKeys.keys = let
|
|
|
|
authorizedKeys = pkgs.fetchurl {
|
|
|
|
url = "https://gmem.ca/ssh";
|
|
|
|
sha256 = "0iwrm80hsadr0midy0h3da4x0sbci76a92g8f9wnz5pj38gimdi9";
|
|
|
|
};
|
|
|
|
in pkgs.lib.splitString "\n" (builtins.readFile
|
|
|
|
authorizedKeys);
|
2023-06-26 15:25:26 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
home-manager.users.gsimmer = { pkgs, ... }: {
|
|
|
|
programs.git = {
|
|
|
|
userName = "Gabriel Simmer";
|
|
|
|
userEmail = "git@gmem.ca";
|
|
|
|
};
|
|
|
|
programs.bash.enable = false;
|
|
|
|
|
|
|
|
home.stateVersion = "23.05";
|
|
|
|
};
|
|
|
|
|
|
|
|
virtualisation = {
|
|
|
|
docker = {
|
|
|
|
enable = true;
|
2023-08-05 13:16:29 +01:00
|
|
|
rootless = {
|
|
|
|
enable = true;
|
|
|
|
setSocketVariable = true;
|
|
|
|
};
|
2023-06-26 15:25:26 +01:00
|
|
|
};
|
|
|
|
libvirtd.enable = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
sound.enable = true;
|
|
|
|
security.rtkit.enable = true;
|
2023-08-05 12:05:53 +01:00
|
|
|
|
|
|
|
security.acme.acceptTerms = true;
|
|
|
|
security.acme.defaults.email = "acme@gmem.ca";
|
|
|
|
security.acme.certs."git.gmem.ca" = {
|
2023-08-05 13:15:42 +01:00
|
|
|
domain = "*.gmem.ca";
|
2023-08-05 12:05:53 +01:00
|
|
|
dnsProvider = "route53";
|
|
|
|
credentialsFile = "/var/lib/secrets/credentials";
|
2023-06-26 15:25:26 +01:00
|
|
|
};
|
2023-08-05 12:05:53 +01:00
|
|
|
security.acme.certs."vancouver.gmem.ca" = {
|
|
|
|
domain = "vancouver.gmem.ca";
|
|
|
|
dnsProvider = "route53";
|
|
|
|
credentialsFile = "/var/lib/secrets/credentials";
|
|
|
|
};
|
2023-08-15 09:14:14 +01:00
|
|
|
security.acme.certs."request-media.gmem.ca" = {
|
|
|
|
domain = "request-media.gmem.ca";
|
|
|
|
dnsProvider = "route53";
|
|
|
|
credentialsFile = "/var/lib/secrets/credentials";
|
|
|
|
};
|
|
|
|
security.acme.certs."flood.gmem.ca" = {
|
|
|
|
domain = "flood.gmem.ca";
|
|
|
|
dnsProvider = "route53";
|
|
|
|
credentialsFile = "/var/lib/secrets/credentials";
|
|
|
|
};
|
2023-08-05 12:05:53 +01:00
|
|
|
|
2023-06-26 15:25:26 +01:00
|
|
|
system.stateVersion = "23.05";
|
|
|
|
}
|