-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
82 lines (69 loc) · 2.17 KB
/
flake.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
80
81
82
{
description = "Tiger compiler flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11";
flake-utils.url = "github:numtide/flake-utils";
buildenv = {
url =
"git+https://gitlab.lrde.epita.fr/tiger/buildenv?ref=pr/nix&dir=nix";
inputs = { nixpkgs.follows = "nixpkgs"; };
};
};
outputs = { self, nixpkgs, buildenv, flake-utils, ... }:
let
systems = [ "x86_64-linux" ];
in
flake-utils.lib.eachSystem systems (system:
let
inherit (nixpkgs) lib;
inherit (lib) attrValues;
pkgs = import nixpkgs { inherit system; };
defaultStdenv = pkgs.multiStdenv;
tcPackage =
let
buildenvPkgs = with buildenv.outputs.packages.${system}; [
bison
];
in
{ lib, pkgs, stdenv }:
stdenv.mkDerivation {
pname = "tc";
version = "1.90";
src = self;
enableParallelBuilding = true;
hardeningDisable = [ "all" ];
preConfigure = ''
patchShebangs --build ./build-aux/bin/
patchShebangs --build ./dev/
./bootstrap
'';
nativeBuildInputs = with pkgs;
[
autoconf
automake
autoreconfHook
boost
flex
gnumake
libtool
perl
llvmPackages_12.llvm
pkgs.pkgsi686Linux.llvmPackages_11.clang
] ++ buildenvPkgs;
buildInputs = with pkgs; [ doxygen gdb graphviz valgrind libxml2 ];
};
in
{
defaultPackage = self.packages.${system}.tc;
packages = {
tc = pkgs.callPackage tcPackage { stdenv = defaultStdenv; };
# It does not work currently because nix does not allow 2 Clang in the same env.
tcClang = pkgs.callPackage tcPackage {
stdenv = pkgs.llvmPackages_12.stdenv;
};
devShell = pkgs.mkShell.override { stdenv = defaultStdenv; } {
inputsFrom = [ self.packages.${system}.tc ];
};
};
});
}