Systemd service reading files

I am doing some homelab with NixOS only solution :slight_smile:
Using flakes, I remotely update NixOS configuration:
From SOURCE desktop to TARGET headless pc. I wrote a systemd service which reads a bash file (/home/alain/dynu-refresh.sh) from TARGET. And this works fine:

{
  pkgs,
  lib,
  config,
  ...
}:
{
  options.services.dynu_refresh = {
    enable = lib.mkEnableOption "Enable dynu_refresh";
  };

  config = lib.mkIf config.services.dynu_refresh.enable {

    systemd.services.dynu_refresh = {
      enable = true;
      description = "adresse dynamique dynu";
      after = [
        "network.target"
      ];
      environment = {
        HOME = "/home/alain";
      };
      path = [
        pkgs.gawk
        pkgs.iproute2
        pkgs.gnused
        pkgs.curl
        pkgs.toybox
      ];
      serviceConfig = {
        User = "alain";
        WorkingDirectory = "/home/alain";
        ExecStart = "/run/current-system/sw/bin/sh /home/alain/dynu-refresh.sh";
        ExecReload = "/run/current-system/sw/bin/kill $MAINPID";
        KillMode = "process";
        Restart = "on-failure";
      };
      wantedBy = [ "multi-user.target" ];
    };
  };
}

But there is a but, how can I do the same with a bash file read from my SOURCE desktop?
If btw you can improve my module thx !

Use a path value:

  ExecStart = "/run/current-system/sw/bin/sh ${./dynu-refresh.sh}";

If the path is part of your flake (relative to the flake root, checked into the Git repository, etc.), this will just work. If it’s an absolute path instead, you will have to run your build with the --impure flag.

Thx it is working flawless. It is just magic :wink:

From Data Types - Nix Reference Manual :
"
When an interpolated string evaluates to a path, the path is first copied into the Nix store and the resulting string is the store path of the newly created store object.

For instance, evaluating "${./foo.txt}" will cause foo.txt in the current directory to be copied into the Nix store and result in the string "/nix/store/<hash>-foo.txt".
"