Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building with a flake on NixOS #52

Open
t56k opened this issue May 10, 2024 · 3 comments
Open

Building with a flake on NixOS #52

t56k opened this issue May 10, 2024 · 3 comments

Comments

@t56k
Copy link

t56k commented May 10, 2024

I've used Cloudef/mach-flake to set up an env to build pixi, and I get this error when trying to build:

run
└─ run pixi
   └─ zig build-exe pixi Debug native failure
error: error: unable to find Dynamic system library 'atk-1.0' using strategy 'paths_first'. searched paths:
  /home/user/build/pixi/zig-cache/mach/gpu-dawn/release-cdd4a1a/x86_64-linux-gnu/release-fast/libatk-1.0.so

Anyone have any experience here? Thanks so much

@slimsag
Copy link
Sponsor Contributor

slimsag commented May 26, 2024

This appears to be a dependency of nfd-zig, which is used for opening native file dialogs.

nfd_mod.linkSystemLibrary("atk-1.0", .{});

Probably the 'correct' solution to this would be to make a better native file dialog library in Zig which uses dlopen or similar to get access to these functions at runtime, rather than linking dynamically to that library. At some point I want Mach itself to provide something like this.

As for fixing the nixos build, maybe @Cloudef would have an idea for how to do that - but I'm unsure myself how you would go about getting those libraries into the nix build.

@Cloudef
Copy link

Cloudef commented May 26, 2024

Hello, I answered similar question here:
https://ziggit.dev/t/zig2nix-nix-flake-for-packaging-building-and-running-zig-projects/2830/6

Basically:

env = mach-flake.outputs.mach-env.${system} {
    customRuntimeDeps = with pkgs; [ pkg-config ];
    customRuntimeLibs = with pkgs; [ atk ];
};

If you also plan to package using mach-flake, then you need to also add these into nativeBuildInputs and buildInputs respectively in the package derivation.

@Cloudef
Copy link

Cloudef commented May 26, 2024

@slimsag You might be interested in https://flatpak.github.io/xdg-desktop-portal/ https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.FileChooser.html
Sadly it uses dbus, but this is currently the way in linux for opening file browser and it will use the system's toolkit to do it (separate process). This originates from flatpak, but is not only limited to flatpak. Other than that, mach fully rendering the file dialog would be sure way and work / look the same everywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants