flake.nix and script.sh are in the same directory and I want to copy script.sh to a package so it can be updated on the system by updating the flake. However, when I run nix build in the flake directory I get
error: builder for '/nix/store/fa1jvk3hqr7p721z4h4h02cxr2nxcrzi-test-script.drv' failed to produce output path for output 'out' at '/nix/store/fa1jvk3hqr7p721z4h4h02cxr2nxcrzi-test-script.drv.chroot/root/nix/store/wxmb38b27jfd13rh758r619ki245kabx-test-script'
What am I missing here? I also tried using installPhase instead of buildCommand but it had the same error
I also couldn’t figure out how to get stdenv.mkDerevation to work in the flake but that’s a different problem I think!
The file doesn’t exist and ${inputs.my-package}/ references a directory suffixed -source which contains all the files from the src directory in the flake, but without any changes from the build or install phases.
nix build in the directory with the my-package flake creates the expected result.
I’m assuming I’m using it wrong, but what do I need to do in place of ${inputs.my-package} to reference the result directory, rather than the source directory?
Can I prevent the source directory being placed in the nix store entirely?
To answer my own question I need to use "${inputs.my-package.packages.x86_64-linux.default}/file which is kind of verbose and slightly annoying that it has to include the architecture given the package contains interpreted code rather than compiled code
You could use an overlay in the flake distributing the script, and apply that overlay in your NixOS configuration. This way you don’t have to reference the target architecture when including the package in your configuration.