nextcloud: create admin user via occ
nixpkgs removed services.nextcloud.config.{adminuser,adminpassFile} and
now installs with --disable-admin-user. Add a nextcloud-admin-user oneshot
that creates the admin account from the vars secret after nextcloud-setup.
This commit is contained in:
1 parent
78fffa61f6
commit
8b5ea6d81e
2 files changed
+21
-4
No files matched your search
@@ -42,10 +42,27 @@
|
||||
dbhost = lib.mkDefault "/run/postgresql";
|
||||
dbuser = lib.mkDefault "nextcloud";
|
||||
dbname = lib.mkDefault "nextcloud";
|
||||
adminuser = lib.mkDefault "admin";
|
||||
adminpassFile = lib.mkDefault config.clan.core.vars.generators.nextcloud.files.adminpassFile.path;
|
||||
};
|
||||
};
|
||||
|
||||
# nixpkgs installs Nextcloud with --disable-admin-user; create the
|
||||
# admin account ourselves once the instance is installed.
|
||||
systemd.services.nextcloud-admin-user = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "nextcloud-setup.service" ];
|
||||
requires = [ "nextcloud-setup.service" ];
|
||||
before = [ "phpfpm-nextcloud.service" ];
|
||||
path = [ config.services.nextcloud.occ ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "nextcloud";
|
||||
};
|
||||
script = ''
|
||||
if ! nextcloud-occ user:info admin >/dev/null 2>&1; then
|
||||
NC_PASS="$(<${config.clan.core.vars.generators.nextcloud.files.adminpassFile.path})" \
|
||||
nextcloud-occ user:add admin --password-from-env --group admin
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
clan.core.state.nextcloud.folders = [
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
server.wait_for_unit("phpfpm-nextcloud.service")
|
||||
|
||||
# Check that garage is running
|
||||
server.succeed("systemctl status phpfpm-nextcloud.service")
|
||||
# Admin account exists and is in the admin group
|
||||
server.succeed("nextcloud-occ user:info admin --output=json | grep -q '\"groups\":\\[\"admin\"\\]'")
|
||||
'';
|
||||
}
|
||||
Reference in new issue
Block a user