Skip to content

Instantly share code, notes, and snippets.

@rekyuu
Created January 8, 2025 22:19
Show Gist options
  • Save rekyuu/3dbfc59b18344a8013c0640444aed2a1 to your computer and use it in GitHub Desktop.
Save rekyuu/3dbfc59b18344a8013c0640444aed2a1 to your computer and use it in GitHub Desktop.
Nix Tauri Flake
{
# https://nixos.wiki/wiki/Rust
description = "Tauri test on NixOS";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in {
devShells.default = with pkgs; mkShell rec {
nativeBuildInputs = [
pkg-config
gobject-introspection
cargo
cargo-tauri
nodejs
bun
clippy
rustfmt
];
buildInputs = [
clang
llvmPackages_latest.bintools
rustup
at-spi2-atk
atkmm
cairo
gdk-pixbuf
glib
gtk3
harfbuzz
librsvg
libsoup_3
pango
webkitgtk_4_1
openssl
];
RUSTC_VERSION = "stable";
LIBCLANG_PATH = pkgs.lib.makeLibraryPath [ pkgs.llvmPackages_latest.libclang.lib ];
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (buildInputs ++ nativeBuildInputs);
RUSTFLAGS = (builtins.map (a: ''-L ${a}/lib'') [ ]);
BINDGEN_EXTRA_CLANG_ARGS =
(builtins.map (a: ''-I"${a}/include"'') [
pkgs.glibc.dev
])
++ [
''-I"${pkgs.llvmPackages_latest.libclang.lib}/lib/clang/${pkgs.llvmPackages_latest.libclang.version}/include"''
''-I"${pkgs.glib.dev}/include/glib-2.0"''
''-I${pkgs.glib.out}/lib/glib-2.0/include/''
];
shellHook = ''
export PATH=$PATH:''${CARGO_HOME:-~/.cargo}/bin
export PATH=$PATH:''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-x86_64-unknown-linux-gnu/bin/
'';
};
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment