refactor(viridian): migrate service data to dedicated BTRFS subvolumes

Migrate from path-based persistence (/persist/var/lib/*) to dedicated
BTRFS subvolumes for better data isolation and snapshot capabilities.

- Move valuable user-facing services to /srv/* with srv-* subvolumes:
  - forgejo: git repositories and database
  - opengist: paste data
  - minecraft: game world data
  - lighttpd: static web content
  - containers: OCI container volumes

- Update home directory to use hm-sajenim subvolume on viridian disk
- Remove jupyterhub service (no longer in use)
- Update borgbackup paths to match new service locations
- Follow upstream service defaults where possible for maintainability

Services kept on /persist (disposable state):
- traefik, crowdsec, murmur
This commit is contained in:
♥ Minnie ♥ 2025-10-06 13:07:46 +08:00
parent 28ba8186bb
commit b0bfb37d3c
Signed by: jasmine
GPG key ID: 8563E358D4E8040E
10 changed files with 64 additions and 94 deletions

View file

@ -1,4 +1,5 @@
{...}: let
{config, ...}: let
hostname = config.networking.hostName;
port = "6157";
in {
# OpenGist service configuration
@ -9,7 +10,7 @@ in {
"${port}:${port}"
];
volumes = [
"/var/lib/opengist:/opengist"
"/srv/opengist:/opengist"
];
# Environment variables for OpenGist
environment = {
@ -43,20 +44,18 @@ in {
};
};
# Persist data for OpenGist
environment.persistence."/persist" = {
directories = [
{
directory = "/var/lib/opengist";
user = "sajenim";
group = "users";
}
];
};
# Activation script to create symlinks for custom assets
system.activationScripts.opengist-symlink = ''
cp ${toString ./assets/pikachu.png} /var/lib/opengist/custom/pikachu.png
cp ${toString ./assets/pokeball.png} /var/lib/opengist/custom/pokeball.png
cp ${toString ./assets/pikachu.png} /srv/opengist/custom/pikachu.png
cp ${toString ./assets/pokeball.png} /srv/opengist/custom/pokeball.png
'';
fileSystems."/srv/opengist" = {
device = "/dev/disk/by-label/${hostname}";
fsType = "btrfs";
options = [
"subvol=srv-opengist"
"compress=zstd"
];
};
}