-
Notifications
You must be signed in to change notification settings - Fork 1
/
default.nix
45 lines (38 loc) · 947 Bytes
/
default.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
{ gitrev ? "devel"
, sources ? import ./nix/sources.nix
, packages ? import sources.nixpkgs {}
, inShell ? null
}:
let
env = packages.stdenv.mkDerivation {
name = "asterix-tool-environment";
buildInputs = [];
shellHook = ''
echo "Run nix-shell inside individual sub-directory!"
exit 1
'';
};
ast-tool-py = import ./ast-tool-py/default.nix {};
envVars = ''
'';
deps = [
packages.git
];
drv = packages.stdenv.mkDerivation {
name = "ast-tool";
preBuild = envVars;
src = builtins.filterSource
(path: type:
(type != "directory" || baseNameOf path != ".git")
&& (type != "symlink" || baseNameOf path != "result"))
./.;
buildInputs = deps;
installPhase = ''
mkdir -p $out/bin
ln -s ${ast-tool-py}/bin/ast-tool-py $out/bin/ast-tool-py
'';
};
in
if inShell == false
then drv
else if packages.lib.inNixShell then env else drv