Created
March 16, 2022 10:57
-
-
Save typetetris/3e69f7240a71e3a6fdf5cf3f97eadde1 to your computer and use it in GitHub Desktop.
nix mold example, just run `nix develop`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
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