mirror of
https://github.com/RichieCahill/dotfiles.git
synced 2026-04-21 06:39:09 -04:00
Compare commits
6 Commits
feature/cr
...
d6eec926e7
| Author | SHA1 | Date | |
|---|---|---|---|
| d6eec926e7 | |||
| 5ddf1c4cab | |||
| 5a2171b9c7 | |||
| 95c6ade154 | |||
| a0bbc2896a | |||
| 736596c387 |
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@@ -40,7 +40,6 @@
|
|||||||
"cgroupdriver",
|
"cgroupdriver",
|
||||||
"charliermarsh",
|
"charliermarsh",
|
||||||
"Checkpointing",
|
"Checkpointing",
|
||||||
"cloudflared",
|
|
||||||
"codellama",
|
"codellama",
|
||||||
"codezombiech",
|
"codezombiech",
|
||||||
"compactmode",
|
"compactmode",
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
{ inputs, ... }:
|
{ inputs, pkgs, ... }:
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
"${inputs.self}/users/richie"
|
"${inputs.self}/users/richie"
|
||||||
|
"${inputs.self}/users/math"
|
||||||
"${inputs.self}/common/global"
|
"${inputs.self}/common/global"
|
||||||
"${inputs.self}/common/optional/desktop.nix"
|
|
||||||
"${inputs.self}/common/optional/docker.nix"
|
"${inputs.self}/common/optional/docker.nix"
|
||||||
"${inputs.self}/common/optional/scanner.nix"
|
"${inputs.self}/common/optional/scanner.nix"
|
||||||
"${inputs.self}/common/optional/steam.nix"
|
"${inputs.self}/common/optional/steam.nix"
|
||||||
@@ -19,6 +19,11 @@
|
|||||||
./llms.nix
|
./llms.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
boot = {
|
||||||
|
kernelPackages = pkgs.linuxPackages_6_18;
|
||||||
|
zfs.package = pkgs.zfs_2_4;
|
||||||
|
};
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
hostName = "bob";
|
hostName = "bob";
|
||||||
hostId = "7c678a41";
|
hostId = "7c678a41";
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ in
|
|||||||
"${inputs.self}/common/optional/zerotier.nix"
|
"${inputs.self}/common/optional/zerotier.nix"
|
||||||
./docker
|
./docker
|
||||||
./services
|
./services
|
||||||
|
./web_services
|
||||||
./hardware.nix
|
./hardware.nix
|
||||||
./networking.nix
|
./networking.nix
|
||||||
./programs.nix
|
./programs.nix
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
{ pkgs, ... }:
|
|
||||||
let
|
|
||||||
vars = import ../vars.nix;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
systemd.services.cloud_flare_tunnel = {
|
|
||||||
description = "cloud_flare_tunnel proxy's traffic through cloudflare";
|
|
||||||
after = [ "network.target" ];
|
|
||||||
wantedBy = [ "multi-user.target" ];
|
|
||||||
serviceConfig = {
|
|
||||||
Type = "simple";
|
|
||||||
EnvironmentFile = "${vars.secrets}/docker/cloud_flare_tunnel";
|
|
||||||
ExecStart = "${pkgs.cloudflared}/bin/cloudflared --no-autoupdate tunnel run";
|
|
||||||
Restart = "on-failure";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -2,7 +2,10 @@ let
|
|||||||
vars = import ../vars.nix;
|
vars = import ../vars.nix;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
networking.firewall.allowedTCPPorts = [ 6443 ];
|
networking.firewall.allowedTCPPorts = [
|
||||||
|
6443
|
||||||
|
2223
|
||||||
|
];
|
||||||
|
|
||||||
services.gitea = {
|
services.gitea = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -24,7 +27,7 @@ in
|
|||||||
ROOT_URL = "https://gitea.tmmworkshop.com/";
|
ROOT_URL = "https://gitea.tmmworkshop.com/";
|
||||||
HTTP_PORT = 6443;
|
HTTP_PORT = 6443;
|
||||||
SSH_PORT = 2223;
|
SSH_PORT = 2223;
|
||||||
SSH_LISTEN_PORT = 2224;
|
SSH_LISTEN_PORT = 2223;
|
||||||
START_SSH_SERVER = true;
|
START_SSH_SERVER = true;
|
||||||
PUBLIC_URL_DETECTION = "auto";
|
PUBLIC_URL_DETECTION = "auto";
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
zpool = ["root_pool", "storage", "media"]
|
zpool = ["root_pool", "storage", "media"]
|
||||||
services = [
|
services = [
|
||||||
"audiobookshelf",
|
"audiobookshelf",
|
||||||
"cloud_flare_tunnel",
|
|
||||||
"haproxy",
|
"haproxy",
|
||||||
"docker",
|
"docker",
|
||||||
"home-assistant",
|
"home-assistant",
|
||||||
|
|||||||
62
systems/jeeves/web_services/acme.nix
Normal file
62
systems/jeeves/web_services/acme.nix
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
let
|
||||||
|
domains = [
|
||||||
|
"audiobookshelf"
|
||||||
|
"cache"
|
||||||
|
"gitea"
|
||||||
|
"jellyfin"
|
||||||
|
"share"
|
||||||
|
];
|
||||||
|
|
||||||
|
makeCert = name: {
|
||||||
|
name = "${name}.tmmworkshop.com";
|
||||||
|
value = {
|
||||||
|
webroot = "/var/lib/acme/.challenges";
|
||||||
|
group = "acme";
|
||||||
|
reloadServices = [ "haproxy.service" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
acmeServices = map (domain: "acme-${domain}.tmmworkshop.com.service") domains;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
users.users.haproxy.extraGroups = [ "acme" ];
|
||||||
|
|
||||||
|
security.acme = {
|
||||||
|
acceptTerms = true;
|
||||||
|
defaults.email = "Richie@tmmworkshop.com";
|
||||||
|
certs = builtins.listToAttrs (map makeCert domains);
|
||||||
|
};
|
||||||
|
|
||||||
|
# Minimal nginx to serve ACME HTTP-01 challenge files for HAProxy
|
||||||
|
services.nginx = {
|
||||||
|
enable = true;
|
||||||
|
virtualHosts."acme-challenge" = {
|
||||||
|
listen = [
|
||||||
|
{
|
||||||
|
addr = "127.0.0.1";
|
||||||
|
port = 8402;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
locations."/.well-known/acme-challenge/" = {
|
||||||
|
root = "/var/lib/acme/.challenges";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Ensure the challenge directory exists with correct permissions
|
||||||
|
systemd.tmpfiles.rules = [
|
||||||
|
"d /var/lib/acme/.challenges 0750 acme acme - -"
|
||||||
|
"d /var/lib/acme/.challenges/.well-known 0750 acme acme - -"
|
||||||
|
"d /var/lib/acme/.challenges/.well-known/acme-challenge 0750 acme acme - -"
|
||||||
|
];
|
||||||
|
|
||||||
|
users.users.nginx.extraGroups = [ "acme" ];
|
||||||
|
|
||||||
|
# HAProxy needs certs to exist before it can bind :443.
|
||||||
|
# NixOS's acme module generates self-signed placeholders on first boot
|
||||||
|
# via acme-<domain>.service — just make HAProxy wait for them.
|
||||||
|
systemd.services.haproxy = {
|
||||||
|
after = acmeServices;
|
||||||
|
wants = acmeServices;
|
||||||
|
};
|
||||||
|
}
|
||||||
9
systems/jeeves/web_services/default.nix
Normal file
9
systems/jeeves/web_services/default.nix
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{ lib, ... }:
|
||||||
|
{
|
||||||
|
imports =
|
||||||
|
let
|
||||||
|
files = builtins.attrNames (builtins.readDir ./.);
|
||||||
|
nixFiles = builtins.filter (name: lib.hasSuffix ".nix" name && name != "default.nix") files;
|
||||||
|
in
|
||||||
|
map (file: ./. + "/${file}") nixFiles;
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ global
|
|||||||
defaults
|
defaults
|
||||||
log global
|
log global
|
||||||
mode http
|
mode http
|
||||||
|
option httplog
|
||||||
retries 3
|
retries 3
|
||||||
maxconn 2000
|
maxconn 2000
|
||||||
timeout connect 5s
|
timeout connect 5s
|
||||||
@@ -22,25 +23,37 @@ defaults
|
|||||||
#Application Setup
|
#Application Setup
|
||||||
frontend ContentSwitching
|
frontend ContentSwitching
|
||||||
bind *:80 v4v6
|
bind *:80 v4v6
|
||||||
bind *:443 v4v6 ssl crt /zfs/storage/secrets/docker/cloudflare.pem
|
bind *:443 v4v6 ssl crt /var/lib/acme/audiobookshelf.tmmworkshop.com/full.pem crt /var/lib/acme/cache.tmmworkshop.com/full.pem crt /var/lib/acme/jellyfin.tmmworkshop.com/full.pem crt /var/lib/acme/share.tmmworkshop.com/full.pem crt /var/lib/acme/gitea.tmmworkshop.com/full.pem
|
||||||
mode http
|
mode http
|
||||||
|
|
||||||
|
# ACME challenge routing (must be first)
|
||||||
|
acl is_acme path_beg /.well-known/acme-challenge/
|
||||||
|
use_backend acme_challenge if is_acme
|
||||||
|
|
||||||
# tmmworkshop.com
|
# tmmworkshop.com
|
||||||
acl host_audiobookshelf hdr(host) -i audiobookshelf.tmmworkshop.com
|
acl host_audiobookshelf hdr(host) -i audiobookshelf.tmmworkshop.com
|
||||||
acl host_cache hdr(host) -i cache.tmmworkshop.com
|
acl host_cache hdr(host) -i cache.tmmworkshop.com
|
||||||
acl host_jellyfin hdr(host) -i jellyfin.tmmworkshop.com
|
acl host_jellyfin hdr(host) -i jellyfin.tmmworkshop.com
|
||||||
acl host_share hdr(host) -i share.tmmworkshop.com
|
acl host_share hdr(host) -i share.tmmworkshop.com
|
||||||
acl host_gcw hdr(host) -i gcw.tmmworkshop.com
|
|
||||||
acl host_n8n hdr(host) -i n8n.tmmworkshop.com
|
|
||||||
acl host_gitea hdr(host) -i gitea.tmmworkshop.com
|
acl host_gitea hdr(host) -i gitea.tmmworkshop.com
|
||||||
|
|
||||||
|
# Hosts allowed to serve plain HTTP (add entries to skip the HTTPS redirect)
|
||||||
|
acl allow_http hdr(host) -i __none__
|
||||||
|
# acl allow_http hdr(host) -i example.tmmworkshop.com
|
||||||
|
|
||||||
|
# Redirect all HTTP to HTTPS unless on the allow list or ACME challenge
|
||||||
|
http-request redirect scheme https code 301 if !{ ssl_fc } !allow_http !is_acme
|
||||||
|
|
||||||
use_backend audiobookshelf_nodes if host_audiobookshelf
|
use_backend audiobookshelf_nodes if host_audiobookshelf
|
||||||
use_backend cache_nodes if host_cache
|
use_backend cache_nodes if host_cache
|
||||||
use_backend jellyfin if host_jellyfin
|
use_backend jellyfin if host_jellyfin
|
||||||
use_backend share_nodes if host_share
|
use_backend share_nodes if host_share
|
||||||
use_backend gcw_nodes if host_gcw
|
|
||||||
use_backend n8n if host_n8n
|
|
||||||
use_backend gitea if host_gitea
|
use_backend gitea if host_gitea
|
||||||
|
|
||||||
|
backend acme_challenge
|
||||||
|
mode http
|
||||||
|
server acme 127.0.0.1:8402
|
||||||
|
|
||||||
backend audiobookshelf_nodes
|
backend audiobookshelf_nodes
|
||||||
mode http
|
mode http
|
||||||
server server 127.0.0.1:8000
|
server server 127.0.0.1:8000
|
||||||
@@ -60,14 +73,6 @@ backend share_nodes
|
|||||||
mode http
|
mode http
|
||||||
server server 127.0.0.1:8091
|
server server 127.0.0.1:8091
|
||||||
|
|
||||||
backend gcw_nodes
|
|
||||||
mode http
|
|
||||||
server server 127.0.0.1:8092
|
|
||||||
|
|
||||||
backend n8n
|
|
||||||
mode http
|
|
||||||
server server 127.0.0.1:5678
|
|
||||||
|
|
||||||
backend gitea
|
backend gitea
|
||||||
mode http
|
mode http
|
||||||
server server 127.0.0.1:6443
|
server server 127.0.0.1:6443
|
||||||
5
users/math/systems/bob.nix
Normal file
5
users/math/systems/bob.nix
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
imports = [
|
||||||
|
../home/global.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../home/global.nix
|
../home/global.nix
|
||||||
../home/gui
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user