33 lines
1.2 KiB
Nix
33 lines
1.2 KiB
Nix
|
{ pkgs ? import <nixpkgs> { } }:
|
||
|
let manifest = (pkgs.lib.importTOML ./Cargo.toml).package;
|
||
|
packages = with pkgs; [
|
||
|
pkg-config
|
||
|
libGLU
|
||
|
libGL
|
||
|
libxkbcommon
|
||
|
wayland
|
||
|
];
|
||
|
in
|
||
|
pkgs.rustPlatform.buildRustPackage rec {
|
||
|
pname = manifest.name;
|
||
|
version = manifest.version;
|
||
|
cargoLock.lockFile = ./Cargo.lock;
|
||
|
src = pkgs.lib.cleanSource ./.;
|
||
|
|
||
|
meta = {
|
||
|
description = manifest.description ? null;
|
||
|
};
|
||
|
postBuild = ''
|
||
|
patchelf --add-needed libxkbcommon.so target/x86_64-unknown-linux-gnu/release/todoodoo
|
||
|
patchelf --add-needed libwayland-client.so target/x86_64-unknown-linux-gnu/release/todoodoo
|
||
|
patchelf --add-needed libGLU.so target/x86_64-unknown-linux-gnu/release/todoodoo
|
||
|
patchelf --add-needed libEGL.so target/x86_64-unknown-linux-gnu/release/todoodoo
|
||
|
old_rpath=$(patchelf --print-rpath target/x86_64-unknown-linux-gnu/release/todoodoo)
|
||
|
if [[ -z "$old_rpath" ]]; then
|
||
|
patchelf --set-rpath "${pkgs.lib.makeLibraryPath packages}" target/x86_64-unknown-linux-gnu/release/todoodoo
|
||
|
else
|
||
|
patchelf --set-rpath "${pkgs.lib.makeLibraryPath packages}:$old_rpath" target/x86_64-unknown-linux-gnu/release/todoodoo
|
||
|
fi
|
||
|
'';
|
||
|
}
|