I need help trying to Package a program that is not in nixpkgs. I packaged It like this:
{ stdenv, lib, bash, perl, bison, flex, tcl, fltk, mesa, libGL, xorg, haskellPackages, cudaPackages, python3, python313Packages }:
stdenv.mkDerivation rec {
pname = "vmd";
version = "2.0.0";
src = ./vmd-2.0.0.bin.LINUXAMD64.tar.gz;
unpackPhase = ''
tar -xvzf $src
cp -r ${pname}-${version} source
chmod -R +w source
cd source
'';
nativeBuildInputs = [ bash perl bison flex cudaPackages.cudnn];
patchPhase = ''
patchShebangs configure
'';
preConfigure = ''
substituteInPlace configure \
--replace-fail 'install_bin_dir="usr/local/bin"' 'install_bin_dir="$out/bin"' \
--replace-fail 'install_library_dir="/usr/local/lib/$install_name"' 'install_library_dir="$out/lib/vmd"'
'';
configurePhase = ''
./configure LINUX OPENGL FLTK MESA PYTHON NUMPY
'';
dontBuild = true;
# recursion in symlinks solved. still broken bc other reasons.
installPhase =''
substituteInPlace src/config.h \
--replace-fail "/lib/vmd" "$out/lib/vmd" \
--replace-fail "/usr/local" "$out/local"
cat src/Makefile
for f in src/Makefile bin/vmd.sh bin/vmd.csh ; do
substituteInPlace "$f" \
--replace-fail "/usr/local/lib/vmd" "$out/lib/" \
--replace-fail "/usr" "$out/usr"
done
cat src/Makefile
cd src
make install
mkdir -p $out/bin
mkdir -p $out/lib/vmd
cd ..
cp -r LINUXAMD64/* $out/bin
'';
propagatedBuildInputs = [
tcl
fltk
mesa
libGL
xorg.libX11
xorg.libXext
xorg.libXi
xorg.libXrender
haskellPackages.OpenGL
cudaPackages.cudnn
python3
python313Packages.numpy
];
meta = with lib; {
description = "Just for personal Use, has a complicated license";
homepage = "https://www.ks.uiuc.edu/Research/vmd/";
platforms = platforms.unix;
};
}
when running ./result/bin/vmd_LINUXAMD64 it says:
Could not start dynamically linked executable: ./result/bin/vmd_LINUXAMD64
NixOS cannot run dynamically linked executables intended for generic
linux environments out of the box.
How can I make it just run and include it to my configuration file?