Files
nixos-config/hosts/cepheus/couchdb.nix

38 lines
1.1 KiB
Nix
Raw Normal View History

2025-08-20 18:24:02 +03:00
{ pkgs, lib, ... }: {
containers.couchdb = {
autoStart = true;
bindMounts = {
"/var/lib/couchdb" = { hostPath = "/nix/persist/services/couchdb"; isReadOnly = false; };
};
hostAddress = "192.168.105.10";
localAddress = "192.168.105.11";
privateNetwork = true;
config = { ... }: {
services.couchdb = {
enable = true;
bindAddress = "192.168.105.11";
port = 5984;
databaseDir = "/var/lib/couchdb";
viewIndexDir = "/var/lib/couchdb";
adminUser = lib.removeSuffix "\n" ("admin_" + pkgs.lib.readFile "${pkgs.runCommand "timestamp" {} "echo `head -c 12 /dev/urandom | base64 | sed 's/[+=\\/A-Z]//g'` > $out"}");
adminPass = pkgs.lib.readFile "${pkgs.runCommand "timestamp" {} "echo `head -c 32 /dev/urandom | base64 | sed 's/[+=\\/A-Z]//g'` > $out"}";
};
networking.firewall = {
enable = true;
allowedTCPPorts = [ 5984 ];
};
system.stateVersion = "25.05";
};
};
services.caddy.virtualHosts = {
"couchdb.nothing.run".extraConfig = ''
reverse_proxy http://192.168.105.11:5984
'';
};
}