Fix handling filenames with spaces in "substitute"

Tested with nixos switch, should not break anything. Add mass-rebuild and bug, please.