-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdevenv.nix
45 lines (36 loc) · 1.42 KB
/
devenv.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{ pkgs, lib, config, ... }:
{
# https://devenv.sh/packages/
# on macos frameworks have to be explicitly specified
# otherwise a linker error ocurs on rust packages
packages = lib.optionals pkgs.stdenv.isDarwin (with pkgs.darwin.apple_sdk; [
frameworks.CoreServices
frameworks.CoreFoundation
]);
# Certain Rust tools won't work without this
# This can also be fixed by using oxalica/rust-overlay and specifying the rust-src extension
# See https://discourse.nixos.org/t/rust-src-not-found-and-other-misadventures-of-developing-rust-on-nixos/11570/3?u=samuela. for more details.
#env.RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
# https://devenv.sh/scripts/
scripts.hello.exec = "echo Welcome to tket2proto devenv!";
enterShell = ''
hello
cargo --version
'';
# https://devenv.sh/languages/
languages.rust = {
enable = true;
channel = "nightly";
components = [ "rustc" "cargo" "clippy" "rustfmt" "rust-analyzer" ];
};
languages.python = {
enable = true;
venv.enable = true;
venv.requirements = "-r ${config.env.DEVENV_ROOT}/pyrs/dev-requirements.txt";
};
# https://devenv.sh/pre-commit-hooks/
pre-commit.hooks.clippy.enable = true;
pre-commit.tools.clippy = lib.mkForce config.languages.rust.toolchain.clippy;
pre-commit.hooks.rustfmt.enable = true;
pre-commit.tools.rustfmt = lib.mkForce config.languages.rust.toolchain.rustfmt;
}