Use file from fetchurl in systemd service

I want to use a single file from the internet as a parameter for the command in a systemd service.
Can I use fetchurl to do that? I.e.:

  myFile = fetchurl { url = ""; };
in = {
    script = ''
        foo -i ${file}

But that returns a .drv file. How do I get to the file from the URL?

The answer seems to be file.outPath

Uhh no. "${foo}" is exactly the same as foo.outPath or "${foo.outPath}". But note that you used file while your variable was named myFile, and file is in fact the name of a package in pkgs, in case you’ve used with pkgs;

Whoops thats right. I meant to write myFile there. The entire thing is supposed to be entirely hypothetical.