fix nextcloud auto-update crashing on nix-managed apps
All checks were successful
Check Flake / check-flake (push) Successful in 3m23s

This commit is contained in:
2026-02-26 20:25:42 -08:00
parent f2f5761c83
commit 3622f6deee

View File

@@ -11,6 +11,9 @@ let
# Hardcoded public ip of ponyo... I wish I didn't need this...
public_ip_address = "147.135.114.130";
nixManagedApps = builtins.attrNames cfg.extraApps;
nixManagedAppsPattern = lib.concatStringsSep "|" nixManagedApps;
in
{
config = lib.mkIf cfg.enable {
@@ -42,6 +45,18 @@ in
# Allows installing Apps from the UI (might remove later)
appstoreEnable = true;
};
# Override the update service to skip Nix-managed apps, which would otherwise
# get duplicated into store-apps/ and cause PHP class redeclaration errors.
systemd.services.nextcloud-update-plugins = {
path = [ config.services.nextcloud.occ ];
serviceConfig.ExecStart = lib.mkForce (toString (pkgs.writeShellScript "nextcloud-update-non-nix-apps" ''
apps=$(nextcloud-occ app:update --showonly | awk '{print $1}' | grep -vE '^(${nixManagedAppsPattern})$' || true)
for app in $apps; do
nextcloud-occ app:update "$app"
done
''));
};
age.secrets.nextcloud-pw = {
file = ../../secrets/nextcloud-pw.age;
owner = "nextcloud";