hydra
hydra copied to clipboard
Declarative admin user?
Is it possible to create a hydra admin user declaratively? I'm not seeing any options for it.
You can use LDAP. The groups are mapped. That's what we do, but if you're not already running LDAP, that's probably overkill.
What is LDAP?
https://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol
It's not "truly" declarative, but you could write a systemd service to create a user:
{ config, pkgs, ... }: {
systemd.services.configure-hydra-user = {
wantedBy = ["multi-user.target"];
requires = ["postgresql.service"];
after = ["postgresql.service"];
script = ''
${config.services.hydra.package}/bin/hydra-create-user admin --password "$(</var/secrets/hydra-admin-password)" --role admin
'';
};
}
Close enough: https://search.nixos.org/options?channel=21.05&show=services.openldap.declarativeContents&from=0&size=50&sort=relevance&query=openldap
It's not "truly" declarative, but you could write a systemd service to create a user:
{ config, pkgs, ... }: { systemd.services.configure-hydra-user = { wantedBy = ["multi-user.target"]; requires = ["postgresql.service"]; after = ["postgresql.service"]; script = '' ${config.services.hydra.package}/bin/hydra-create-user admin --password "$(</var/secrets/hydra-admin-password)" --role admin ''; }; }
Is this still a viable solution?