-
Notifications
You must be signed in to change notification settings - Fork 80
/
crates.nix
79 lines (72 loc) · 2.33 KB
/
crates.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{
perSystem = { pkgs, lib, config, ... }: {
nci =
let
llvmPackages = pkgs.llvmPackages_16;
major = lib.versions.major llvmPackages.llvm.version;
minor = lib.versions.minor llvmPackages.llvm.version;
llvm-sys-ver = "${major}${builtins.substring 0 1 minor}";
env = { "LLVM_SYS_${llvm-sys-ver}_PREFIX" = llvmPackages.llvm.dev; };
stdlib = pkgs.stdenv.mkDerivation {
pname = "ante-stdlib";
version = config.packages.ante.version;
src = ./stdlib;
phases = [ "unpackPhase" "installPhase" ];
installPhase = ''
find . -type f -exec install -Dm644 "{}" -t $out/lib \;
'';
};
in
{
toolchainConfig = {
channel = "stable";
components = [ "rust-analyzer" "clippy" "rustfmt" "rust-src" ];
};
projects.ante = {
export = false;
path = ./.;
};
crates = {
ante-ls = {
profiles.release.features = [ ];
drvConfig.mkDerivation = {
preBuild = ''
export ANTE_STDLIB_DIR=${stdlib}/lib
'';
};
};
ante = {
depsDrvConfig = {
inherit env;
};
drvConfig = {
inherit env;
mkDerivation = {
nativeBuildInputs = [ pkgs.installShellFiles ];
buildInputs = lib.attrValues
{
inherit (pkgs)
libffi
libxml2
ncurses;
} ++ [ llvmPackages.llvm stdlib ];
postPatch = ''
substituteInPlace tests/golden_tests.rs --replace \
'target/debug' "target/$(rustc -vV | sed -n 's|host: ||p')/release"
'';
preBuild = ''
export ANTE_STDLIB_DIR=${stdlib}/lib
'';
postInstall = ''
installShellCompletion --cmd ante \
--bash <($out/bin/ante --shell-completion bash) \
--fish <($out/bin/ante --shell-completion fish) \
--zsh <($out/bin/ante --shell-completion zsh)
'';
};
};
};
};
};
};
}