I compiled my rust program (super simple one too as a test, just hello world). I ran it on my NixOS computer, but when I tried moving it to a server running a different distro of linux bash does not recognize it. Here is the output from file
:
main: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /nix/store/xmprbk52mlcdsljz66m8yf7cf0xf36n1-glibc-2.38-44/lib/ld-linux-x86-64.so.2, for GNU/Linux 3.10.0, with debug_info, not stripped
and here is my shell.nix
:
{ pkgs ? import <nixpkgs> {} }:
let
gems = pkgs.bundlerEnv {
name = "ultrahook-env";
inherit (pkgs.ruby) bundler;
gemdir = ./.; # path to Gemfile
};
in pkgs.mkShell rec {
buildInputs = with pkgs; [
clang
llvmPackages_17.bintools
rustup
openssl.dev
binaryen
dart-sass
tailwindcss
ruby.devEnv
gems
gems.wrappedRuby
];
RUSTC_VERSION = pkgs.lib.readFile ./rust-toolchain;
LIBCLANG_PATH = pkgs.lib.makeLibraryPath [pkgs.llvmPackages_latest.libclang.lib];
shellHook = ''
export PATH=$PATH:''${CARGO_HOME:-~/.cargo}/bin
export PATH=$PATH:''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-x86_64-unknown-linux-gnu/bin/
'';
RUSTFLAGS = builtins.map (a: ''-L ${a}/lib'') [
# add libraries here (e.g. pkgs.libvmi)
];
BINDGEN_EXTRA_CLANG_ARGS =
(builtins.map (a: ''-I"${a}/include"'') [
pkgs.glibc.dev
# add dev libraries here (e.g. pkgs.libvmi.dev)
])
++ [
''-I"${pkgs.llvmPackages_latest.libclang.lib}/lib/clang/${pkgs.llvmPackages_latest.libclang.version}/include"''
''-I"${pkgs.glib.dev}/include/glib-2.0"''
''-I${pkgs.glib.out}/lib/glib-2.0/include/''
];
}