-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell.nix
More file actions
21 lines (19 loc) · 758 Bytes
/
shell.nix
File metadata and controls
21 lines (19 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{ pkgs ? import <nixpkgs> {}, unstable ? import <nixos-unstable> {} }:
pkgs.mkShell {
buildInputs = [
((pkgs.rustChannelOf { channel = "stable"; }).rust.override {
extensions = [ "clippy-preview" ];
})
pkgs.cargo-outdated
pkgs.openssl
pkgs.pkgconfig
pkgs.gcc
];
# move build files and artifacts out of source directory to XDG_CACHE_HOME
shellHook = ''
# path of this shell.nix file, escaped by systemd to have a working directory name identifier
identifier=$(/run/current-system/sw/bin/systemd-escape -p ${toString ./.})
# all missing directories in $CARGO_TARGET_DIR path are created automatically by cargo
export CARGO_TARGET_DIR="''${XDG_CACHE_HOME:-$HOME/.cache}/cargo/targets/$identifier"
'';
}