This repository has been archived by the owner on Jan 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
129 lines (106 loc) · 4.84 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# The license for this file is included in the `nix` directory next to this file.
{
description = "Coriolis is a free database, placement tool and routing tool for VLSI design.";
# Nixpkgs / NixOS version to use.
inputs.nixpkgs.url = "github:NixOS/nixpkgs"; # for alliance
inputs.alliance-check-toolkit.url = "git+https://gitlab.lip6.fr/vlsi-eda/alliance-check-toolkit.git";
inputs.alliance-check-toolkit.flake = false;
inputs.soclayout.url = "git+https://git.libre-soc.org/git/soclayout.git";
inputs.soclayout.flake = false;
inputs.pinmux.url = "git+https://git.libre-soc.org/git/pinmux.git";
inputs.pinmux.flake = false;
outputs = { self, nixpkgs, alliance-check-toolkit, soclayout, pinmux }:
let
# Generate a user-friendly version numer.
version = builtins.substring 0 8 self.lastModifiedDate;
# System types to support.
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
meta = with nixpkgs.lib; {
description = "Coriolis is a free database, placement tool and routing tool for VLSI design.";
homepage = "http://coriolis.lip6.fr/";
platforms = platforms.all;
};
pythonOverlay = self: super: {
python3Packages = super.python3Packages.override {
overrides = pself: psuper: {
pyqt4 = psuper.pyqt4.overridePythonAttrs (o: rec {
version = "4.12.1";
src = super.fetchurl {
url = "mirror://sourceforge/pyqt/PyQt4_gpl_x11-${version}.tar.gz";
sha256 = "RdckRhrliwGbm+lQdsoH4hLrcwhK7JEluyVIJcOgU4M=";
};
pythonImportsCheck = (o.pythonImportsCheck or []) ++ [ "PyQt4.QtCore" "PyQt4.QtGui" ];
});
};
};
};
# Nixpkgs instantiated for supported system types.
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; overlays = [ pythonOverlay self.overlay ]; });
override = drv:
drv.overrideAttrs (o: {
preConfigure = ''
cmakeFlagsArray+=(-DCMAKE_MODULE_PATH="$(sed -e 's|:|/share/cmake/Modules;|g' <<< "$CMAKE_PREFIX_PATH:")")
'' + (o.preConfigure or "");
cmakeFlags = [ "-DBUILD_DOC=ON" ] ++ (o.cmakeFlags or []);
});
generic = import ./nix/generic.nix { inherit version meta; };
pythonComponents = [
"hurricane" "crlcore" "flute" "etesian"
"anabatic" "katana" "bora" "katabatic" "kite"
"tutorial" "unicorn" "oroshi" "cumulus"
];
components = pythonComponents ++ [
"lefdef" "bootstrap" "coloquinte"
"equinox" "knik" "ispd" "karakaze" "nimbus"
"metis" "mauka" "solstice" "stratus1"
"documentation" "combined"
];
commonArgs = { inherit version meta generic; };
in
rec {
overlay = final: prev:
builtins.foldl'
(acc: elem: acc // {
"coriolis-${elem}" = override (final.callPackage (
let f = import (./nix + "/${elem}.nix"); in
f (builtins.intersectAttrs (builtins.functionArgs f) commonArgs)
) {});
}) {} components;
packages = forAllSystems (system:
let pkgs = nixpkgsFor.${system}; in
builtins.foldl' (acc: elem: acc // {
${elem} = pkgs.${"coriolis-${elem}"};
}) {} components
);
checks = forAllSystems (system: {
alliance-check-toolkit = nixpkgsFor.${system}.callPackage (
import ./nix/alliance-check-toolkit.nix { inherit alliance-check-toolkit; }
) {};
libresoc = nixpkgsFor.${system}.callPackage (
import ./nix/libresoc.nix { inherit alliance-check-toolkit soclayout pinmux; }
) {};
unittests = override (nixpkgsFor.${system}.callPackage (
import ./nix/unittests.nix { inherit version meta; }
) {});
});
# CORIOLIS_TOP must be set before execution
# example: `env CORIOLIS_TOP="$(mktemp -d)" ./result/bin/cgt`
defaultPackage = forAllSystems (system: self.packages.${system}.unicorn);
devShell = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
env = pkgs.python3.buildEnv.override {
extraLibs = builtins.map (x: pkgs.${"coriolis-${x}"}) pythonComponents;
};
in pkgs.mkShell {
buildInputs = [ env ];
}
);
hydraJobs.combined = forAllSystems (system: self.packages.${system}.combined);
hydraJobs.alliance-check-toolkit = forAllSystems (system: self.checks.${system}.alliance-check-toolkit);
hydraJobs.unittests = forAllSystems (system: self.checks.${system}.unittests);
hydraJobs.libresoc = forAllSystems (system: self.checks.${system}.libresoc);
};
}