In the following flake, can someone explain why the runScript output is actually necessary? I wrote it while using a similar flake as inspiration.
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
outputs = { self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
name = "hello";
in
with pkgs;
{
packages.${system}.default = stdenv.mkDerivation rec {
inherit name;
src = ./src;
buildInputs = [ cc65 vice ];
buildPhase = ''
${cc65}/bin/cl65 -C c64-asm.cfg -u __EXEHDR__ -o ${name}.prg ${name}.s
${vice}/bin/c1541 -format diskname,id d64 ${name}.d64 -attach ${name}.d64 -write ${name}.prg ${name}
'';
installPhase = ''
mkdir -p $out/bin
cp ${name}.d64 $out/bin
'';
};
runScript = writeScript "runit" ''
#!/usr/bin/env sh
${vice}/bin/x64sc ${self.packages.${system}.default}/bin/${name}.d64
'';
apps.${system}.default = {
type = "app";
# program = "${vice}/bin/x64sc ${self.packages.${system}.default}/bin/hello.d64";
program = "${self.runScript}";
};
};
}
If I instead try to use nix run with the commented out program value, I get the error saying
error: unable to execute ‘/nix/store/q0in8853fh4ghr57bxxz6faa6bvwydfy-vice-3.7.1/bin/x64sc /nix/store/gjrdjzn264lpaxssk1c5grag5n91y09y-hello/bin/hello.d64’: No such file or directory
The paths specified in the error message do exist and that exact string does in fact launch the binary. Is the program value simply unable to handle arguments, or what?