Skip to content

Instantly share code, notes, and snippets.

@ivan
Created November 29, 2019 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivan/a57be34f77e27d90ca4c4a7659373ae2 to your computer and use it in GitHub Desktop.
Save ivan/a57be34f77e27d90ca4c4a7659373ae2 to your computer and use it in GitHub Desktop.
nix-shell wrapper for cargo to make cargo builds work on NixOS
#!/bin/sh
# A nix-shell that includes many packages, so that Cargo projects can build on NixOS.
set -eu
packages=(
pkgconfig
openssl
# druid
cairo
atk
gdk-pixbuf
pango
gtk3
# imgui-rs
xorg.libxcb
# web-view
webkitgtk
)
args=()
for p in ${packages[@]}; do
args+=("-p" "$p")
done
nix-shell "${args[@]}" --run "$(printf '%q ' "$@")"
@ivan
Copy link
Author

ivan commented Nov 29, 2019

Usage:

nix-shell-for-cargo cargo build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment