-
Notifications
You must be signed in to change notification settings - Fork 6
/
devenv.nix
65 lines (60 loc) · 1.75 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, inputs, config, ... }:
let
pkgs-stable = import inputs.nixpkgs-stable { system = pkgs.stdenv.system; };
cfg = config.hugr;
in
{
options.hugr = {
setupInShell = lib.mkEnableOption "setupInShell" // {
default = true;
description = "run `just setup` on entering shell";
};
};
config = {
# 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-stable.cargo-llvm-cov
pkgs.graphviz
pkgs.cargo-insta
pkgs.capnproto
] ++ lib.optionals
pkgs.stdenv.isDarwin
(with pkgs.darwin.apple_sdk; [
frameworks.CoreServices
frameworks.CoreFoundation
# added for json schema validation tests
frameworks.SystemConfiguration
]);
# https://devenv.sh/scripts/
scripts.hello.exec = "echo Welcome to hugr dev shell!";
enterShell = ''
hello
cargo --version
export LLVM_COV="${pkgs.llvmPackages_16.libllvm}/bin/llvm-cov"
export LLVM_PROFDATA="${pkgs.llvmPackages_16.libllvm}/bin/llvm-profdata"
'' + lib.optionalString cfg.setupInShell ''
just setup
'' + ''
source .venv/bin/activate
'';
languages.python = {
enable = true;
uv = {
enable = true;
};
};
# https://devenv.sh/languages/
# https://devenv.sh/reference/options/#languagesrustversion
languages.rust = {
channel = "stable";
enable = true;
components = [ "rustc" "cargo" "clippy" "rustfmt" "rust-analyzer" ];
};
};
# See full reference at https://devenv.sh/reference/options/
}