Should I use /run/current-system/sw/bin/x or ${pkgs.package}/x in scripts?

The former is a wrapper around the latter that is generated by the nexcloud nixos-module and also placed in environment.systemPackages for convenience. It essentially ensures that occ can find the configuration and is run as the correct user.

In general, I would avoid referring to stuff via /run/current-system/sw/bin/foo as it just silently fails to work if nothing in environment.systemPackages provides foo. Just In this special case the derivation cannot provide a script that is useful without a suitable wrapper. The wrapper can also be accessed via ${config.services.nextcloud.occ}/bin/nextcloud-occ.

5 Likes