This commit is contained in:
Robert Perce 2026-02-09 22:15:08 -06:00
parent 8e0385b2d6
commit 5747872651
5 changed files with 153 additions and 9 deletions

View file

@ -34,7 +34,7 @@ get-ip() {
deploy() { deploy() {
ip=$(get-ip "$1") ip=$(get-ip "$1")
nix-shell -p '(nixos{}).nixos-rebuild' --run \ TMPDIR=/tmp nix-shell -p '(nixos{}).nixos-rebuild' --run \
'nixos-rebuild switch --flake .#'"$1"' --target-host admin@"'"$ip"'" --use-remote-sudo' 'nixos-rebuild switch --flake .#'"$1"' --target-host admin@"'"$ip"'" --use-remote-sudo'
} }

14
flake.lock generated
View file

@ -23,11 +23,11 @@
"systems": "systems" "systems": "systems"
}, },
"locked": { "locked": {
"lastModified": 1770172907, "lastModified": 1770520993,
"narHash": "sha256-rqYl9B+4shcM5b6OYjT+qdsdQNJ7SY64/xcPIb96NzU=", "narHash": "sha256-ks1ZFBYlBmQ4CAM4WSmCFUtkUJzbmJ0VJH/JkKVMPqY=",
"owner": "Infinidoge", "owner": "Infinidoge",
"repo": "nix-minecraft", "repo": "nix-minecraft",
"rev": "8958a5a4259e1aebf4916823bf463faaf2538566", "rev": "b32f4325880b4fac47b8736161a8f032dd248b70",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -54,16 +54,16 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1767313136, "lastModified": 1770464364,
"narHash": "sha256-16KkgfdYqjaeRGBaYsNrhPRRENs0qzkQVUooNHtoy2w=", "narHash": "sha256-z5NJPSBwsLf/OfD8WTmh79tlSU8XgIbwmk6qB1/TFzY=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "ac62194c3917d5f474c1a844b6fd6da2db95077d", "rev": "23d72dabcb3b12469f57b37170fcbc1789bd7457",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-25.05", "ref": "nixos-25.11",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }

View file

@ -1,6 +1,6 @@
{ {
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
nix-minecraft.url = "github:Infinidoge/nix-minecraft"; nix-minecraft.url = "github:Infinidoge/nix-minecraft";
}; };
@ -31,6 +31,7 @@ outputs = { self, nixpkgs, ... }@inputs:
homelab = nixos-vma ./vm-homelab.nix; homelab = nixos-vma ./vm-homelab.nix;
metrics = nixos-lxc ./lxc-metrics.nix; metrics = nixos-lxc ./lxc-metrics.nix;
forge-runner = nixos-lxc ./lxc-forge-runner.nix; forge-runner = nixos-lxc ./lxc-forge-runner.nix;
ergo = nixos-lxc ./lxc-ergo.nix;
}; };
packages.${system} = { packages.${system} = {
@ -38,6 +39,7 @@ outputs = { self, nixpkgs, ... }@inputs:
homelab = image "homelab"; homelab = image "homelab";
metrics = lxc "metrics"; metrics = lxc "metrics";
forge-runner = lxc "forge-runner"; forge-runner = lxc "forge-runner";
ergo = lxc "ergo";
}; };
}; };
} }

132
lxc-ergo.nix Normal file
View file

@ -0,0 +1,132 @@
{
pkgs,
lib,
...
}:
{
imports = [
./lxc-base.nix
];
config = {
my.vm = {
name = "ergo01";
ip4 = "192.168.0.8";
};
environment.systemPackages = with pkgs; [
certbot
];
networking.firewall.trustedInterfaces = [ "br-+" ];
networking.firewall.allowedTCPPorts = [
6667
6697
443
80
];
virtualisation.docker = {
enable = true;
daemon.settings = {
fixed-cidr-v6 = "fd00::/80";
ipv6 = true;
};
};
security.acme = {
acceptTerms = true;
defaults.email = "admin+acme@dukeceph.xyz";
};
services.nginx = {
enable = true;
virtualHosts."irc.dukeceph.xyz" = {
addSSL = true;
enableACME = true;
locations."/webirc" = {
proxyPass = "http://unix:/run/ergo/websocket";
proxyWebsockets = true;
extraConfig = ''
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 10m;
'';
};
};
};
users.groups."ergo" = {};
users.users."ergo" = {
group = "ergo";
isSystemUser = true;
};
services.ergochat = {
enable = true;
settings = {
network = {
name = "dukeceph.xyz";
};
server = {
name = "dukeceph.xyz";
enforce-utf8 = true;
ip-cloaking = {
enabled = true;
netname = "dukeceph.xyz";
};
listeners = {
":6697" = {
tls = {
cert = "/etc/letsencrypt/live/irc.dukeceph.xyz/fullchain.pem";
key = "/etc/letsencrypt/live/irc.dukeceph.xyz/privkey.pem";
};
};
};
};
oper-classes = {
chat-moderator = {
title = "Chat Moderator";
capabilities = [
"kill" # disconnect user sessions
"ban" # ban IPs, CIDRs, NUH masks, and suspend accounts (UBAN / DLINE / KLINE)
"nofakelag" # exempted from "fakelag" restrictions on rate of message sending
"relaymsg" # use RELAYMSG in any channel (see the `relaymsg` config block)
"vhosts" # add and remove vhosts from users
"sajoin" # join arbitrary channels, including private channels
"samode" # modify arbitrary channel and user modes
"snomasks" # subscribe to arbitrary server notice masks
"roleplay" # use the (deprecated) roleplay commands in any channel
];
};
server-admin = {
title = "Server Admin";
extends = "chat-moderator";
capabilities = [
"rehash" # rehash the server, i.e. reload the config at runtime
"accreg" # modify arbitrary account registrations
"chanreg" # modify arbitrary channel registrations
"history" # modify or delete history messages
"defcon" # use the DEFCON command (restrict server capabilities)
"massmessage" # message all users on the server
"metadata" # modify arbitrary metadata on channels and users
];
};
};
opers = {
duke = {
class = "server-admin";
whois-line = "is the server administrator";
password = "$2a$04$eEXmtfM76.qp3D7kJna7k.dF7xeeACwvxwxUM4.ysW5Kndk/S.drG";
};
};
};
};
systemd.services.ergochat.serviceConfig.DynamicUser = lib.mkForce false;
systemd.services.ergochat.serviceConfig.User = "ergo";
systemd.services.ergochat.serviceConfig.Group = "ergo";
};
}

View file

@ -26,6 +26,10 @@ in
services.caddy = { services.caddy = {
enable = true; enable = true;
virtualHosts = { virtualHosts = {
"dukeceph.xyz".extraConfig = ''
root * /mnt/nfs/public
file_server browse
'';
"feed.rperce.net".extraConfig = '' "feed.rperce.net".extraConfig = ''
reverse_proxy http://192.168.0.5:8080 reverse_proxy http://192.168.0.5:8080
''; '';
@ -70,6 +74,12 @@ in
"grist.rperce.net".extraConfig = '' "grist.rperce.net".extraConfig = ''
reverse_proxy http://192.168.0.2:8484 reverse_proxy http://192.168.0.2:8484
''; '';
"irc.dukeceph.xyz".extraConfig = ''
reverse_proxy 192.168.0.8
'';
"irc.dukeceph.xyz/webirc".extraConfig = ''
reverse_proxy 192.168.0.8:8067
'';
}; };
}; };