nix-config/nixos/viridian/services/opengist/default.nix
jasmine b0bfb37d3c
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
2025-10-06 13:07:46 +08:00

61 lines
1.5 KiB
Nix

{config, ...}: let
hostname = config.networking.hostName;
port = "6157";
in {
# OpenGist service configuration
virtualisation.oci-containers.containers = {
opengist = {
image = "ghcr.io/thomiceli/opengist:1.10";
ports = [
"${port}:${port}"
];
volumes = [
"/srv/opengist:/opengist"
];
# Environment variables for OpenGist
environment = {
PUID = "1000";
PGID = "100";
# Custom OpenGist configuration
OG_CUSTOM_LOGO = "pikachu.png";
OG_CUSTOM_FAVICON = "pokeball.png";
OG_CUSTOM_NAME = "PokeGist";
# Disable SSH Git support
OG_SSH_GIT_ENABLED = "false";
};
};
};
# Traefik configuration
services.traefik.dynamicConfigOptions.http = {
# OpenGist Router
routers.opengist = {
rule = "Host(`ps7e.xyz`)";
entryPoints = [
"websecure"
];
service = "opengist";
};
# OpenGist Service
services.opengist = {
loadBalancer.servers = [
{url = "http://127.0.0.1:${port}";}
];
};
};
# Activation script to create symlinks for custom assets
system.activationScripts.opengist-symlink = ''
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"
];
};
}