diff --git a/common/_containers/obsidian_sync.nix b/common/_containers/obsidian_sync.nix new file mode 100644 index 0000000..c5c9b54 --- /dev/null +++ b/common/_containers/obsidian_sync.nix @@ -0,0 +1,55 @@ +{ + config, + pkgs, + ... +}: +let + cfg = config.services.obsidian_sync; +in +{ + options.services.obsidian_sync = + let + lib = pkgs.lib; + in + { + port = lib.mkOption { + type = lib.types.port; + default = 5984; + description = "Port number for Obsidian Sync CouchDB server"; + }; + dataDir = lib.mkOption { + type = lib.types.path; + default = "/var/lib/obsidian_sync"; + description = "Directory to store Obsidian Sync data"; + }; + serverUrl = lib.mkOption { + type = lib.types.str; + description = "URL of the Obsidian Sync server"; + }; + }; + + config = { + virtualisation.oci-containers.containers = { + ############# + # obsidian_sync # + ############# + obsidian_sync = { + user = "root"; + image = "ghcr.io/danny-avila/obsidian_sync-dev:latest"; + ports = [ + "${toString cfg.port}:${toString cfg.port}" + ]; + environment = { + SERVER_URL = cfg.serverUrl; + COUCHDB_USER = "adminu"; + COUCHDB_PASSWORD = "Password123"; # TODO move to a secret and link to it via envFiles + COUCHDB_DATABASE = "obsidian_sync"; + }; + # environmentFiles = [ "${cfg.dataDir}/.env" ]; $ TODO see above todo + volumes = [ + "${cfg.dataDir}/data:/opt/couchdb/data" + ]; + }; + }; + }; +} diff --git a/common/flake.nix b/common/flake.nix index 2dcfc0e..d6f164c 100644 --- a/common/flake.nix +++ b/common/flake.nix @@ -43,6 +43,7 @@ containers = { librechat = import ./_containers/librechat.nix; forgejo = import ./_containers/forgejo.nix; + obsidian_sync = import ./_containers/obsidian_sync.nix; }; }; homeManagerModules = {