I’m working on a flake for a local project with these two relevant portions:
devShells.default = pkgs.mkShell {
packages = nativeBuildInputs ++ linuxBuildInputs;
shellInputs = linuxBuildInputs;
shellHook = ''
export RUST_BACKTRACE=1
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.lib.makeLibraryPath linuxBuildInputs}"
'';
};
packages.errata.x86_64-linux = rustPlatform.buildRustPackage {
name = "errata-x86_64-linux";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = nativeBuildInputs;
buildInputs = linuxBuildInputs;
shellHook = ''
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.lib.makeLibraryPath linuxBuildInputs}"
'';
};
I would like to add support for multiple platforms as this is a cross platform project, but I’m currently running into the issue that setting the attribute name
in a buildRustPackage
derivation doesn’t change the name of the resulting executable, but does make nix run
try to execute the changed name:
$ nix run
error: unable to execute '/nix/store/7fs5zdsyrn1iwlfsc6756sbq642z9kz1-errata-x86_64-linux/bin/errata-x86_64-linux': No such file or directory
Is there any elegant way around this or do I need to build the derivation from scratch?