Fix postgres, enable atuin

This commit is contained in:
Daniel Flanagan 2024-09-06 16:44:15 -05:00
parent 639aad8c8a
commit 379adc7ec6

View file

@ -362,6 +362,17 @@ sudo nix run nixpkgs#ipmitool -- raw 0x30 0x30 0x02 0xff 0x00
# }; # };
# } # }
{ {
# services.postgresql = {
# ensureDatabases = [
# "nextcloud"
# ];
# ensureUsers = [
# {
# name = "nextcloud";
# ensureDBOwnership = true;
# }
# ];
# };
# nextcloud # nextcloud
# users.users.nextcloud = { # users.users.nextcloud = {
# isSystemUser = true; # isSystemUser = true;
@ -369,8 +380,15 @@ sudo nix run nixpkgs#ipmitool -- raw 0x30 0x30 0x02 0xff 0x00
# group = "nextcloud"; # group = "nextcloud";
# }; # };
} }
{
# plausible
# ensureDatabases = ["plausible"];
# ensureUsers = [
# { # {
# # plausible # name = "plausible";
# ensureDBOwnership = true;
# }
# ];
# users.users.plausible = { # users.users.plausible = {
# isSystemUser = true; # isSystemUser = true;
# createHome = false; # createHome = false;
@ -439,7 +457,7 @@ sudo nix run nixpkgs#ipmitool -- raw 0x30 0x30 0x02 0xff 0x00
# reverse_proxy :${toString config.services.plausible.server.port} # reverse_proxy :${toString config.services.plausible.server.port}
# ''; # '';
# }; # };
# } }
# { # {
# # clickhouse # # clickhouse
# environment.etc = { # environment.etc = {
@ -562,46 +580,31 @@ sudo nix run nixpkgs#ipmitool -- raw 0x30 0x30 0x02 0xff 0x00
# }; # };
} }
{ {
systemd.tmpfiles.settings = {
"10-backups" = {
"/storage/postgres" = {
"d" = {
mode = "0770";
user = "postgres";
group = "postgres";
};
};
};
};
services.postgresql = { services.postgresql = {
enable = true; enable = true;
ensureDatabases = [
"daniel"
"plausible"
"nextcloud"
"atuin"
];
ensureUsers = [
{
name = "daniel";
ensureDBOwnership = true;
}
{
name = "plausible";
ensureDBOwnership = true;
}
{
name = "nextcloud";
ensureDBOwnership = true;
}
{
name = "atuin";
ensureDBOwnership = true;
}
];
dataDir = "/storage/postgres"; dataDir = "/storage/postgres";
enableTCPIP = true; enableTCPIP = true;
package = pkgs.postgresql_15; package = pkgs.postgresql_15;
# https://www.postgresql.org/docs/current/auth-pg-hba-conf.html # https://www.postgresql.org/docs/current/auth-pg-hba-conf.html
# TODO: enable the "daniel" user to access all databases
authentication = pkgs.lib.mkOverride 10 '' authentication = pkgs.lib.mkOverride 10 ''
#type database user auth-method auth-options #type database user auth-method auth-options
local all postgres peer map=superuser_map local all postgres peer map=superuser_map
local all daniel peer map=superuser_map local all daniel peer map=superuser_map
local sameuser all peer map=superuser_map local sameuser all peer map=superuser_map
# local plausible plausible peer
# local nextcloud nextcloud peer
# local atuin atuin peer
# lan ipv4 # lan ipv4
host all daniel 192.168.0.0/16 trust host all daniel 192.168.0.0/16 trust
@ -927,19 +930,28 @@ sudo nix run nixpkgs#ipmitool -- raw 0x30 0x30 0x02 0xff 0x00
# }; # };
# }; # };
# } # }
# { {
# services.atuin = { services.postgresql = {
# enable = true; ensureDatabases = ["atuin"];
# database = { ensureUsers = [
# createLocally = true; {
# # uri = "postgresql://atuin@localhost:5432/atuin"; name = "atuin";
# }; ensureDBOwnership = true;
# openRegistration = false; }
# }; ];
# services.caddy.virtualHosts."atuin.h.lyte.dev" = { };
# extraConfig = ''reverse_proxy :${toString config.services.atuin.port}''; services.atuin = {
# }; enable = true;
# } database = {
createLocally = false;
uri = "postgresql://atuin@localhost:5432/atuin";
};
openRegistration = false;
};
services.caddy.virtualHosts."atuin.h.lyte.dev" = {
extraConfig = ''reverse_proxy :${toString config.services.atuin.port}'';
};
}
# { # {
# # jland minecraft server # # jland minecraft server
# users.groups.jland = { # users.groups.jland = {