diff --git a/nixos/viridian/services/default.nix b/nixos/viridian/services/default.nix index 085e7f7..d4e83aa 100644 --- a/nixos/viridian/services/default.nix +++ b/nixos/viridian/services/default.nix @@ -9,6 +9,7 @@ ./minecraft ./mpd ./murmur + ./opengist ./traefik ]; } diff --git a/nixos/viridian/services/opengist/assets/pikachu.png b/nixos/viridian/services/opengist/assets/pikachu.png new file mode 100644 index 0000000..c59433f Binary files /dev/null and b/nixos/viridian/services/opengist/assets/pikachu.png differ diff --git a/nixos/viridian/services/opengist/assets/pokeball.png b/nixos/viridian/services/opengist/assets/pokeball.png new file mode 100644 index 0000000..99096b5 Binary files /dev/null and b/nixos/viridian/services/opengist/assets/pokeball.png differ diff --git a/nixos/viridian/services/opengist/default.nix b/nixos/viridian/services/opengist/default.nix new file mode 100644 index 0000000..a5f7a5b --- /dev/null +++ b/nixos/viridian/services/opengist/default.nix @@ -0,0 +1,62 @@ +{...}: let + port = "6157"; +in { + # OpenGist service configuration + virtualisation.oci-containers.containers = { + opengist = { + image = "ghcr.io/thomiceli/opengist:1.10"; + ports = [ + "${port}:${port}" + ]; + volumes = [ + "/var/lib/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}";} + ]; + }; + }; + + # 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 + ''; +} diff --git a/nixos/viridian/services/traefik/default.nix b/nixos/viridian/services/traefik/default.nix index 8bb91f0..0eb9050 100644 --- a/nixos/viridian/services/traefik/default.nix +++ b/nixos/viridian/services/traefik/default.nix @@ -118,6 +118,11 @@ main = "sajkbd.io"; sans = ["*.sajkbd.io"]; } + { + # Pastes + main = "ps7e.xyz"; + sans = ["*.ps7e.xyz"]; + } ]; }; };