Skip to content

Instantly share code, notes, and snippets.

@typetetris
Created March 16, 2022 10:57
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save typetetris/3e69f7240a71e3a6fdf5cf3f97eadde1 to your computer and use it in GitHub Desktop.
nix mold example, just run `nix develop`
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
rust-evdev = {
url = "github:ndesh26/evdev-rs";
flake = false;
};
};
outputs = { self, nixpkgs, flake-utils, rust-evdev }:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system}; in
rec {
devShell = pkgs.mkShell {
shellHook = ''
set -x
echo "Setting RUSTFLAGS so we use clang with mold as linker"
export RUSTFLAGS="-C linker=clang -Clink-arg=-fuse-ld=$(which mold)"
echo "Creating and changing into temporary directory"
cd $(mktemp -d)
echo "Copying the sources of rust-evdev here."
cp -r ${rust-evdev} .
chmod -R +w *
echo "Building evtest"
cd *
cargo build --example evtest
echo "Running evtest"
cargo run --example evtest
'';
packages = [
pkgs.mold
pkgs.pkgconfig
pkgs.libevdev
pkgs.clang
pkgs.coreutils
pkgs.cargo
pkgs.rustc
];
};
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment