I’m trying to make an app using gtk-rs.
I’ve got all the Rust stuff sorted, but I can’t get it to run using a flake.
I’ve created this flake (using stuff I found online):
Flake
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
utils,
}:
utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
packages.default = pkgs.rustPlatform.buildRustPackage {
name = "gtk-rs-test";
src = ./.;
buildInputs = with pkgs; [ gtk4.dev ];
nativeBuildInputs = with pkgs.buildPackages; [
pkg-config
gtk4.dev
];
cargoLock.lockFile = ./Cargo.lock;
};
}
);
}
If I try to nix run I get this error:
Error
error: Cannot build '/nix/store/d8lpnnk7y2v1rk4p73nmxzcxdrwggddx-gtk-rs-test.drv'.
Reason: builder failed with exit code 101.
Output paths:
/nix/store/gkr3d4c1ndrwn19ibal30qyfm2n5nh0n-gtk-rs-test
Last 25 log lines:
> - /nix/store/r5dnrkpnds4xi52cdwakbjvvx049cj3x-brotli-1.1.0-dev/lib/pkgconfig
> - /nix/store/1hkdki45cpkpkmszjm3mafac1igj6qyf-libpng-apng-1.6.50-dev/lib/pkgconfig
> - /nix/store/zx88hmmi1an1gfyrfbzm4ga77qii30d5-pixman-0.46.4/lib/pkgconfig
> - /nix/store/c70mx04ih0h6lnyqji8hgh7q1hgwcg59-libxext-1.3.6-dev/lib/pkgconfig
> - /nix/store/nml7jra2yzxg133ssim80aj39f4668gc-xorgproto-2024.1/share/pkgconfig
> - /nix/store/psd6a1kxjs4xyrqxy623s2948k0y5ash-libxau-1.0.12-dev/lib/pkgconfig
> - /nix/store/xgc6bxmjmsw5qd8yfr22cqc8x215j8cs-libxrender-0.9.12-dev/lib/pkgconfig
> - /nix/store/20q72vi8wdb7j6p9sdnpi32477j6nv2z-libx11-1.8.12-dev/lib/pkgconfig
> - /nix/store/27czksni7m3kji791lvfdl40n99f71q8-libxcb-1.17.0-dev/lib/pkgconfig
> - /nix/store/ly2cp9lbsbds7qkn04098svwc5m64yvv-glib-2.84.4-dev/lib/pkgconfig
> - /nix/store/z0hijbjl01x3xwqwmabddhj7l9nm7zy5-libffi-3.5.2-dev/lib/pkgconfig
> - /nix/store/1czky7inzmyir9421d8aybahp51lf2ds-gdk-pixbuf-2.42.12-dev/lib/pkgconfig
> - /nix/store/ks8qbv15kvqsixbhs1vwy0nnh17y5fga-libtiff-4.7.1-dev/lib/pkgconfig
> - /nix/store/mfnqd0l258v2vdyxynbw2dq129z7sad3-libjpeg-turbo-3.1.2-dev/lib/pkgconfig
> - /nix/store/jbg4x930kfzpjfrw239y78bl6df4i8xw-graphene-1.10.8-dev/lib/pkgconfig
> - /nix/store/8xd82yxllimranyhgx3372c16iydxgsa-pango-1.56.4-dev/lib/pkgconfig
> - /nix/store/izaxd55idp7vqyxsw8kci0y4d12zbc7h-harfbuzz-12.1.0-dev/lib/pkgconfig
> - /nix/store/xpwg3r0dcmn431h2ms1j0zq66ag3qsb7-graphite2-1.3.14-dev/lib/pkgconfig
> - /nix/store/y2kz6kw58c3hdya6h7xx308v3vj2p023-libxft-2.3.9-dev/lib/pkgconfig
> - /nix/store/465lj8xn3vp4xfand16iqlwx1kqgc4id-wayland-1.24.0-dev/lib/pkgconfig
> - /nix/store/szq0xnk6r3wnq1j9xl77vbxsc4xi87wb-vulkan-loader-1.4.328.0-dev/lib/pkgconfig
> - /nix/store/03iq7iqv9avzxhxpf791n0asqg11rj3a-gsettings-desktop-schemas-48.0/share/pkgconfig
>
> HINT: you may need to install a package such as gtk4, gtk4-dev or gtk4-devel.
>
For full logs, run:
nix log /nix/store/d8lpnnk7y2v1rk4p73nmxzcxdrwggddx-gtk-rs-test.drv
So pkg-config doesn’t find gtk4, but even if I create a shell which has cargo, pkg-config and gtk4.dev in it, it fails to compile at the same point, while having gtk4.pc in one of the paths. (ok, that’s a different thing, but I still wanted to mention it in case it is relevant)
Does anyone know whats wrong or how I can fix it?