Generate a fuckin pw
This commit is contained in:
parent
a436b7e9c2
commit
c239e42ea6
|
@ -86,13 +86,24 @@ in {
|
||||||
config = {
|
config = {
|
||||||
boot.tmp.useTmpfs = true;
|
boot.tmp.useTmpfs = true;
|
||||||
system.nssModules = mkForce [ ];
|
system.nssModules = mkForce [ ];
|
||||||
|
systemd.services.postgresPasswdGenerator = {
|
||||||
|
requiredBy = [ "lemmy.service" "postgresql.service" ];
|
||||||
|
before = [ "lemmy.service" ];
|
||||||
|
after = [ "postgresql.service" ];
|
||||||
|
path = with pkgs; [ pwgen config.services.postgresql.package ];
|
||||||
|
script = ''
|
||||||
|
PASSWD=$(pwgen 25)
|
||||||
|
echo "postgresql://lemmy:$PASSWD@lemmy&host=/var/run/postgresql" > /run/lemmy/postgresql.passwd
|
||||||
|
sudo -u postgres psql -c "ALTER USER lemmy ENCRYPTED PASSWORD '$PASSWD';"
|
||||||
|
'';
|
||||||
|
};
|
||||||
services = {
|
services = {
|
||||||
nscd.enable = false;
|
nscd.enable = false;
|
||||||
postgresql.enable = true;
|
postgresql.enable = true;
|
||||||
pict-rs.enable = true;
|
pict-rs.enable = true;
|
||||||
lemmy = {
|
lemmy = {
|
||||||
enable = true;
|
enable = true;
|
||||||
database.createLocally = true;
|
database.urlFile = "/run/lemmy/postgresql.passwd";
|
||||||
adminPasswordFile = "/run/lemmy-container/admin.passwd";
|
adminPasswordFile = "/run/lemmy-container/admin.passwd";
|
||||||
nginx.enable = true;
|
nginx.enable = true;
|
||||||
server.package = cfg.server-package;
|
server.package = cfg.server-package;
|
||||||
|
|
Loading…
Reference in New Issue