How to deploy custom NixOS module configuration with a flake using nixos-rebuild and keep the relative path of a custom script file?

  1. You should prefer script over ServiceConfig.ExecStart
  2. The path is used in a way that it looses its context, try "${cfg.path}" instead.