mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 16:21:34 +01:00
Make forgejo user setup more robust
This commit is contained in:
parent
c62e58167c
commit
d2b73e1e9d
1 changed files with 12 additions and 9 deletions
|
|
@ -1,9 +1,4 @@
|
||||||
{
|
{ config, lib, ... }:
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
let
|
let
|
||||||
cfg = config.custom.services.forgejo;
|
cfg = config.custom.services.forgejo;
|
||||||
|
|
||||||
|
|
@ -53,10 +48,18 @@ in
|
||||||
|
|
||||||
systemd.services.forgejo.preStart =
|
systemd.services.forgejo.preStart =
|
||||||
let
|
let
|
||||||
createCmd = "${lib.getExe config.services.forgejo.package} admin user create";
|
userCmd = "${lib.getExe config.services.forgejo.package} admin user";
|
||||||
passwordPath = config.sops.secrets."forgejo/admin-password".path;
|
credentials = lib.concatStringsSep " " [
|
||||||
|
"--username SebastianStork"
|
||||||
|
"--password \"$PASSWORD\""
|
||||||
|
];
|
||||||
in
|
in
|
||||||
''${createCmd} --username SebastianStork --password "$(cat ${passwordPath})" --email "sebastian.stork@pm.me" --admin || true'';
|
''
|
||||||
|
PASSWORD="$(< ${config.sops.secrets."forgejo/admin-password".path})"
|
||||||
|
|
||||||
|
${userCmd} create ${credentials} --email "sebastian.stork@pm.me" --admin \
|
||||||
|
|| ${userCmd} change-password ${credentials} --must-change-password=false
|
||||||
|
'';
|
||||||
|
|
||||||
systemd.tmpfiles.rules =
|
systemd.tmpfiles.rules =
|
||||||
let
|
let
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue