Adding extra build information to executables. #35
-
I am currently making an xorg.libX11
xorg.libXcursor
xorg.libXrandr
xorg.libXi
libGL
libGLU I've tried to add them as buildInputs to all combinations of Is there a way to leverage crane in this situation? I does find all executables in the workspace, so it could be great if one could specify a wrapper they need to run correctly? Here is a link to a simple working devShell: devShell = pkgs.mkShell {
inputsFrom = builtins.attrValues self.checks;
buildInputs = with pkgs; [
xorg.libX11
xorg.libXcursor
xorg.libXrandr
xorg.libXi
libGL
libGLU
];
# Extra inputs can be added here
nativeBuildInputs = with pkgs; [
rustToolchain
cargo-tarpaulin
cargo-edit
pkgconfig
];
shellHook = ''
export LD_LIBRARY_PATH=/run/opengl-driver/lib/:${lib.makeLibraryPath ([pkgs.libGL pkgs.libGLU])}
'';
};
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I can't seem to run your app on the flake-provided devShell on my hardware (6900XT GPU, NixOS diff --git a/flake.nix b/flake.nix
index a7e4883..415fe52 100644
--- a/flake.nix
+++ b/flake.nix
@@ -50,6 +50,18 @@
galleria = craneLib.buildPackage {
inherit cargoArtifacts src;
};
+
+ wrappedGalleria = pkgs.symlinkJoin {
+ name = "galleria";
+ paths = [ galleria ];
+
+ buildInputs = [ pkgs.makeWrapper ];
+
+ postBuild = ''
+ wrapProgram $out/bin/galleria \
+ --prefix LD_LIBRARY_PATH=${lib.makeLibraryPath ([pkgs.libGL pkgs.libGLU])}
+ '';
+ };
in
{
checks = {
@@ -79,6 +91,7 @@
};
packages.galleria = galleria;
+ packages.wrapped = wrappedGalleria;
apps.galleria = flake-utils.lib.mkApp {
drv = galleria; https://nixos.org/manual/nixpkgs/stable/#fun-makeWrapper |
Beta Was this translation helpful? Give feedback.
I can't seem to run your app on the flake-provided devShell on my hardware (6900XT GPU, NixOS
21.11.20220520.cbd40c7
), so I can't get to a fully working solution, but I think something like this is a helpful incremental step: