From 26267569eb681d92373741d1d2d341366b88a4fa Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Sat, 22 Jun 2024 19:31:50 +0200 Subject: [PATCH] add some new services to orbi --- machines/orbi/configuration.nix | 2 + .../hardware-configuration/disko-config.nix | 37 ++++++++--- machines/orbi/service-surrealdb.nix | 24 ++++++++ machines/orbi/service-vikunja.nix | 61 +++++++++++++++++++ 4 files changed, 115 insertions(+), 9 deletions(-) create mode 100644 machines/orbi/service-surrealdb.nix create mode 100644 machines/orbi/service-vikunja.nix diff --git a/machines/orbi/configuration.nix b/machines/orbi/configuration.nix index 0ef64e9..afe8a73 100644 --- a/machines/orbi/configuration.nix +++ b/machines/orbi/configuration.nix @@ -13,6 +13,8 @@ ./service-photoprism.nix ./service-taskserver.nix ./service-vaultwarden.nix + ./service-surrealdb.nix + ./service-vikunja.nix ./nginx-ingolf-wagner-de.nix ./nginx-wkd.nix diff --git a/machines/orbi/hardware-configuration/disko-config.nix b/machines/orbi/hardware-configuration/disko-config.nix index ec7074a..af553dd 100644 --- a/machines/orbi/hardware-configuration/disko-config.nix +++ b/machines/orbi/hardware-configuration/disko-config.nix @@ -108,8 +108,8 @@ in compression = "lz4"; "com.sun:auto-snapshot:hourly" = toString true; "com.sun:auto-snapshot:daily" = toString true; - #"com.sun:auto-snapshot:weekly" = false; - #"com.sun:auto-snapshot:monthly" = false; + # "com.sun:auto-snapshot:weekly" = toString true; + # "com.sun:auto-snapshot:monthly" = toString true; }; }; "matrix-terranix" = { @@ -120,8 +120,32 @@ in compression = "lz4"; "com.sun:auto-snapshot:hourly" = toString true; "com.sun:auto-snapshot:daily" = toString true; - #"com.sun:auto-snapshot:weekly" = false; - #"com.sun:auto-snapshot:monthly" = false; + # "com.sun:auto-snapshot:weekly" = toString true; + # "com.sun:auto-snapshot:monthly" = toString true; + }; + }; + "surrealdb" = { + type = "zfs_fs"; + mountpoint = "/var/lib/nixos-containers/surrealdb"; + options = { + mountpoint = "legacy"; + compression = "lz4"; + "com.sun:auto-snapshot:hourly" = toString true; + #"com.sun:auto-snapshot:daily" = toString true; + #"com.sun:auto-snapshot:weekly" = toString true; + #"com.sun:auto-snapshot:monthly" = toString true; + }; + }; + "vikunja" = { + type = "zfs_fs"; + mountpoint = "/var/lib/nixos-containers/vikunja"; + options = { + mountpoint = "legacy"; + compression = "lz4"; + "com.sun:auto-snapshot:hourly" = toString true; + "com.sun:auto-snapshot:daily" = toString true; + #"com.sun:auto-snapshot:weekly" = toString true; + #"com.sun:auto-snapshot:monthly" = toString true; }; }; }; @@ -141,9 +165,6 @@ in options = { mountpoint = "legacy"; compression = "lz4"; - #"com.sun:auto-snapshot:daily" = false; - #"com.sun:auto-snapshot:weekly" = false; - #"com.sun:auto-snapshot:monthly" = false; }; }; photoprism = { @@ -154,8 +175,6 @@ in compression = "lz4"; "com.sun:auto-snapshot:hourly" = toString true; "com.sun:auto-snapshot:daily" = toString true; - #"com.sun:auto-snapshot:weekly" = false; - #"com.sun:auto-snapshot:monthly" = false; }; }; }; diff --git a/machines/orbi/service-surrealdb.nix b/machines/orbi/service-surrealdb.nix new file mode 100644 index 0000000..756258a --- /dev/null +++ b/machines/orbi/service-surrealdb.nix @@ -0,0 +1,24 @@ +{ config, pkgs, lib, ... }: +{ + + containers.surrealdb = { + privateNetwork = false; + autoStart = true; + + config = { config, lib, ... }: { + nixpkgs.pkgs = pkgs; + imports = [ ../../components/monitor/container.nix ]; + system.stateVersion = "24.05"; + + # Photoprism + # ---------- + services.surrealdb = { + enable = true; + host = "0.0.0.0"; + }; + + }; + }; + + +} diff --git a/machines/orbi/service-vikunja.nix b/machines/orbi/service-vikunja.nix new file mode 100644 index 0000000..cc76a2a --- /dev/null +++ b/machines/orbi/service-vikunja.nix @@ -0,0 +1,61 @@ +{ config, pkgs, lib, ... }: +let + vikunjaPort = 3456; + mysqlPort = 3337; +in +{ + + networking.firewall.interfaces.wg0.allowedTCPPorts = [ vikunjaPort ]; + + containers.vikunja = { + privateNetwork = false; + autoStart = true; + + config = { config, lib, ... }: { + nixpkgs.pkgs = pkgs; + imports = [ ../../components/monitor/container.nix ]; + system.stateVersion = "24.05"; + + # Vikunja + # ---------- + services.vikunja = { + enable = true; + port = vikunjaPort; + frontendScheme = "http"; + frontendHostname = "vikunja.ingolf-wagner.de"; + database.type = "sqlite"; + #database = { + # type = "mysql"; + # host = "localhost:${toString mysqlPort}"; + # user = "vikunja"; + #}; + }; + + # MySQL Database + # -------------- + services.mysql = { + enable = false; + package = pkgs.mariadb; + settings.mysqld.port = mysqlPort; + ensureDatabases = [ "vikunja" ]; + ensureUsers = [{ + name = "vikunja"; + ensurePermissions = { + "vikunja.*" = "ALL PRIVILEGES"; + }; + }]; + }; + + # Backup Database + # --------------- + services.mysqlBackup = { + enable = false; + databases = config.services.mysql.ensureDatabases; + singleTransaction = true; + }; + + }; + }; + + +}