I deleted /var/lib/nextcloud, /var/lib/mysql, deleted all generations and gc store. Same output.
Have you tried copying the contents of /var/lib/nextcloud to the target directory first?
No, I missed that. I will keep this in mind
I also wonder if the problem is that nextcloud starts before the filesystem is mounted. You might need to add a dependency on the mount in the nextcloud module.
The nextcloud module already created the folders inside the network share, so I don’t think it’s a dependency problem.
Another problem you’ll probably run into is that the NixOS module creates symlinks in the dataDir
that point to stuff in the nix store. You’ll know this better than me, but I imagine that those symlinks will not work through an smb share. You might need to host specific subdirectories of the dataDir
on your share instead, so that the configuration, plugins and such are hosted locally (since you use this network share mainly for backup purposes, that data is superfluous anyway, since it can be perfectly recovered from your NixOS config).
I’m really not an expert in this, but I saw that inside the smb share where symlinks created. This is my samba mount:
environment.systemPackages = [ pkgs.cifs-utils ];
fileSystems.“/mnt/nextcloud” = {
device = “//192.168.1.3/nextcloud”;
fsType = “cifs”;
options = let
# this line prevents hanging on network split
automount_opts = “x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s”;
in [“${automount_opts},credentials=/home/nextcloud/smb-secrets,uid=nextcloud,gid=nextcloud,file_mode=0644,dir_mode=0644,mfsymlinks”];
};
Right now I’m going the nixos nextcloud module route with stock settings and setting up nextcloud external samba storages for each user. I really would like a more declarative setup for some of my most important services like nextcloud.
Server died → nixos-rebuild switch --flake ‘…#server’ → done!