non-nix managed nextcloud apps isn't worth the headache
All checks were successful
Check Flake / check-flake (push) Successful in 3m25s

This commit is contained in:
2026-02-26 22:51:09 -08:00
parent 6a0540dddd
commit 73633eaddc

View File

@@ -12,8 +12,6 @@ let
# Hardcoded public ip of ponyo... I wish I didn't need this... # Hardcoded public ip of ponyo... I wish I didn't need this...
public_ip_address = "147.135.114.130"; public_ip_address = "147.135.114.130";
nixManagedApps = builtins.attrNames cfg.extraApps;
nixManagedAppsPattern = lib.concatStringsSep "|" nixManagedApps;
in in
{ {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
@@ -26,7 +24,6 @@ in
config.adminpassFile = "/run/agenix/nextcloud-pw"; config.adminpassFile = "/run/agenix/nextcloud-pw";
# Apps # Apps
autoUpdateApps.enable = true;
extraAppsEnable = true; extraAppsEnable = true;
extraApps = with config.services.nextcloud.package.packages.apps; { extraApps = with config.services.nextcloud.package.packages.apps; {
# Want # Want
@@ -42,30 +39,6 @@ in
# inherit bookmarks cookbook deck memories maps music news notes phonetrack polls forms; # inherit bookmarks cookbook deck memories maps music news notes phonetrack polls forms;
}; };
# Allows installing Apps from the UI (might remove later)
appstoreEnable = true;
};
# Nix-managed apps (extraApps) live in the read-only nix store. If Nextcloud
# downloads a newer version into store-apps/, both get loaded by PHP causing
# a fatal class redeclaration error and leaving NC stuck in maintenance mode.
# Fix: (1) clean store-apps/ of nix-managed duplicates before setup/upgrade,
# (2) skip nix-managed apps during auto-updates.
systemd.services.nextcloud-setup.preStart = lib.mkAfter ''
for app in ${lib.escapeShellArgs nixManagedApps}; do
if [ -d "${cfg.home}/store-apps/$app" ]; then
rm -rf "${cfg.home}/store-apps/$app"
fi
done
'';
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 = { age.secrets.nextcloud-pw = {
file = ../../secrets/nextcloud-pw.age; file = ../../secrets/nextcloud-pw.age;