To be honest, if you want a more standard experience with Nix, just use nix-ld
, and you might enjoy starting to use nix language later. Nix is really not mandatory, just it feels nicer as you can easily add desktop entries for this, keep it in a git repo etc. I configured mine a long time ago with the above set of dependencies, and I never have any trouble to install new stuff… and if I forgot one lib I can just manually add it.
If your file is a simple one-binary file, like an appimage or alike, you should just be able to do something like:
{ lib
, stdenv
, fetchurl
, autoPatchelfHook
, wrapQtAppsHook
, libusb
}:
stdenv.mkDerivation rec {
pname = "yourbinary";
version = "1.0";
src = ./yourbinary;
unpackPhase = ":";
nativeBuildInputs = [
autoPatchelfHook
# only needed for Qt apps:
wrapQtAppsHook
];
buildInputs = [
# but here any lib you need for that program. Usually, I just try to run my program, and add the missing
# libraries one ofter the others. If you add something here, make sure to add it on the inputs `{…}:` on the first line:
libusb
];
installPhase = ''
mkdir -p $out/bin
cp $src $out/bin/${pname}
chmod +x $out/bin/${pname}
'';
}
put it in a file like mybinary.nix
and in your package list add (pkgs.libsForQt5.callPackage ./mybinary.nix {})
, with the parenthesis, or, if you don’t need wrapQtAppsHook
(e.g. your program is not using Qt), just add (pkgs.callPackage ./mybinary.nix {})
.
For instance, for your program luci, you can do:
{ lib
, stdenv
, fetchurl
, autoPatchelfHook
, wrapQtAppsHook
}:
stdenv.mkDerivation rec {
pname = "LuciLive";
version = "6.0.0";
src = ./LuciLive_6.0.0.run;
unpackPhase = ":";
nativeBuildInputs = [
autoPatchelfHook
# only needed for Qt apps:
wrapQtAppsHook
];
buildInputs = [
# but here any lib you need for that program. Usually, I just try to run my program, and add the missing
# libraries one ofter the others. If you add something here, make sure to add it on the inputs `{…}:` on the first line:
];
installPhase = ''
mkdir -p $out/bin
cp $src $out/bin/${pname}
chmod +x $out/bin/${pname}
'';
}
and call it with (pkgs.libsForQt5.callPackage ./yourlucyfile.nix {})
in your package list. After the switch, it will create a binary called LuciLive
.