Skip to content

Instantly share code, notes, and snippets.

@tengkuizdihar
Created February 4, 2023 06:30
Show Gist options
  • Save tengkuizdihar/82d05ea467cb3171a8c0fca72efd9f2d to your computer and use it in GitHub Desktop.
Save tengkuizdihar/82d05ea467cb3171a8c0fca72efd9f2d to your computer and use it in GitHub Desktop.
Tauri + React Flake Development (not working yet)
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) lib;
inherit (pkgs.stdenv) isLinux;
inherit (lib.strings) optionalString;
libraries-linux = with pkgs;[
webkitgtk
gtk3
cairo
gdk-pixbuf
glib
dbus
openssl_3
];
packages-linux = with pkgs; [
curl
wget
pkg-config
dbus
openssl_3
glib
gtk3
libsoup
webkitgtk
nodejs
# rust related
cargo
cargo-tarpaulin
cargo-watch
clippy
rustc
rustfmt
];
packages-darwin = with pkgs; [
curl
wget
rustup
nodejs
pkg-config
libiconv
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.CoreServices
darwin.apple_sdk.frameworks.CoreFoundation
darwin.apple_sdk.frameworks.Foundation
darwin.apple_sdk.frameworks.AppKit
darwin.apple_sdk.frameworks.WebKit
darwin.apple_sdk.frameworks.Cocoa
];
packages = if isLinux then packages-linux else packages-darwin;
libraries = libraries-linux;
in
{
devShell = pkgs.mkShell {
buildInputs = packages;
shellHook =
let
joinLibs = libs: builtins.concatStringsSep ":" (builtins.map (x: "${x}/lib") libs);
libs = joinLibs libraries;
in
optionalString isLinux
''
export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath libraries}:$LD_LIBRARY_PATH
export RUST_SRC_PATH="${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"
'';
};
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment