forked from CQCL/tket2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
devenv.nix
65 lines (59 loc) · 2.04 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{ pkgs, lib, config, inputs, ... }:
let
pkgs-2305 = import inputs.nixpkgs-2305 { system = pkgs.stdenv.system; };
pkgs-poetry = import inputs.poetry-fix { system = pkgs.stdenv.system; };
in
{
# https://devenv.sh/packages/
# on macos frameworks have to be explicitly specified
# otherwise a linker error ocurs on rust packages
packages = [
pkgs.just
pkgs.llvmPackages_16.libllvm
# cargo-llvm-cov is currently marked broken on nixpkgs unstable
pkgs-2305.cargo-llvm-cov
]
++ lib.optionals pkgs.stdenv.isLinux [
pkgs.stdenv.cc.cc.lib
]
++ 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
python --version
poetry --version
export LLVM_COV="${pkgs.llvmPackages_16.libllvm}/bin/llvm-cov"
export LLVM_PROFDATA="${pkgs.llvmPackages_16.libllvm}/bin/llvm-profdata"
'';
# https://devenv.sh/languages/
languages.rust = {
enable = true;
channel = "stable";
components = [ "rustc" "cargo" "clippy" "rustfmt" "rust-analyzer" ];
};
languages.python = {
enable = true;
poetry = {
enable = true;
activate.enable = true;
# contains fix to poetry package on macos
package = pkgs-poetry.poetry;
};
};
# 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;
}