linebender / xilem

An experimental Rust native UI framework
Apache License 2.0
3.74k stars 118 forks source link

Development on nixos #66

Open twitchyliquid64 opened 1 year ago

twitchyliquid64 commented 1 year ago

Not sure where this goes, but just wanted to share that I got xilem building / working on nixos. You just need to jump into a nix-shell with the following shell.nix in your tree:

let
  pkgs = import <nixpkgs> {};

  fenix = pkgs.callPackage
    (pkgs.fetchFromGitHub {
      owner = "nix-community";
      repo = "fenix";
      # commit from: 2023-03-03
      rev = "e2ea04982b892263c4d939f1cc3bf60a9c4deaa1";
      hash = "sha256-AsOim1A8KKtMWIxG+lXh5Q4P2bhOZjoUhFWJ1EuZNNk=";
    })
    { };

in pkgs.mkShell rec {

  buildInputs = with pkgs; [
    libxkbcommon xorg.libxcb libclang
    wayland wayland-protocols vulkan-loader
  ];

  nativeBuildInputs = with pkgs; [
    # Note: to use stable, just replace `default` with `stable`
    fenix.default.toolchain

    pkgs.rustPlatform.bindgenHook
    wayland-scanner
    pkg-config
  ];

  RUST_SRC_PATH = "${fenix.complete.rust-src}/lib/rustlib/src/rust/library";
  LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
  LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
}
zoechi commented 10 months ago

Wouldn't this be nice to have this committed to the repo so that it becomes easy to enable with with direnv?