coriolis/flake.nix

123 lines
4.5 KiB
Nix
Raw Normal View History

2021-08-31 10:50:50 -05:00
# The license for this file is included in the `nix` directory next to this file.
2021-08-16 12:06:47 -05:00
{
description = "Coriolis is a free database, placement tool and routing tool for VLSI design.";
# Nixpkgs / NixOS version to use.
2021-09-02 16:59:32 -05:00
inputs.nixpkgs.url = "github:L-as/nixpkgs?ref=alliance"; # for alliance
inputs.alliance-check-toolkit.url = "git+https://gitlab.lip6.fr/vlsi-eda/alliance-check-toolkit.git";
inputs.alliance-check-toolkit.flake = false;
2021-09-05 08:57:31 -05:00
inputs.soclayout.url = git://git.libre-soc.org/soclayout.git;
inputs.soclayout.flake = false;
2021-08-16 12:06:47 -05:00
2021-09-05 08:57:31 -05:00
outputs = { self, nixpkgs, alliance-check-toolkit, soclayout }@inputs:
2021-08-16 12:06:47 -05:00
let
# Generate a user-friendly version numer.
2021-08-27 15:18:09 -05:00
version = builtins.substring 0 8 self.lastModifiedDate;
2021-08-16 12:06:47 -05:00
# 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;
2021-08-22 05:54:22 -05:00
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;
};
2021-08-16 12:06:47 -05:00
2021-09-01 04:31:22 -05:00
pythonOverlay = self: super: {
python2Packages = super.python2Packages.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 = [ "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 []);
});
2021-08-27 09:26:33 -05:00
2021-08-29 12:36:58 -05:00
generic = import ./nix/generic.nix { inherit version meta; };
2021-08-29 14:16:28 -05:00
pythonComponents = [
2021-08-29 14:21:28 -05:00
"vlsisapd" "hurricane" "crlcore" "flute" "etesian"
"anabatic" "katana" "bora" "katabatic" "kite"
2021-09-03 07:50:39 -05:00
"tutorial" "unicorn" "oroshi" "cumulus"
2021-08-29 14:16:28 -05:00
];
components = pythonComponents ++ [
2021-09-03 07:50:39 -05:00
"lefdef" "bootstrap" "coloquinte"
"equinox" "knik" "ispd" "karakaze" "nimbus"
2021-09-01 06:10:59 -05:00
"metis" "mauka" "solstice" "stratus1"
2021-09-05 09:03:28 -05:00
"documentation" "combined" "libresoc-experiments9"
2021-08-27 09:36:23 -05:00
];
2021-08-23 03:44:07 -05:00
2021-09-05 08:57:31 -05:00
commonArgs = { inherit version meta generic inputs; };
2021-08-29 12:36:58 -05:00
2021-08-16 12:06:47 -05:00
in
rec {
2021-08-23 03:44:07 -05:00
overlay = final: prev:
builtins.foldl'
(acc: elem: acc // {
2021-08-27 09:26:33 -05:00
"coriolis-${elem}" = override (final.callPackage (
2021-08-29 12:36:58 -05:00
let f = import (./nix + "/${elem}.nix"); in
f (builtins.intersectAttrs (builtins.functionArgs f) commonArgs)
2021-08-27 09:26:33 -05:00
) {});
2021-08-23 03:44:07 -05:00
}) {} components;
2021-09-03 08:31:29 -05:00
packages = forAllSystems (system:
let pkgs = nixpkgsFor.${system}; in
builtins.foldl' (acc: elem: acc // {
${elem} = pkgs.${"coriolis-${elem}"};
}) {} components
);
2021-08-16 12:06:47 -05:00
2021-09-05 08:57:31 -05:00
checks = forAllSystems (system: {
alliance-check-toolkit = nixpkgsFor.${system}.callPackage (
2021-09-05 09:03:28 -05:00
import ./nix/alliance-check-toolkit.nix { inherit alliance-check-toolkit; }
) {};
unittests = nixpkgsFor.${system}.callPackage (
import ./nix/unittests.nix { inherit version meta; }
2021-09-05 08:57:31 -05:00
) {};
});
2021-09-05 07:20:50 -05:00
# CORIOLIS_TOP must be set before execution
# example: CORIOLIS_TOP="$(mktemp -d)" && ./result/bin/cgt
2021-08-27 15:18:09 -05:00
defaultPackage = forAllSystems (system: self.packages.${system}.unicorn);
devShell = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
env = pkgs.python2.buildEnv.override {
2021-08-29 14:16:28 -05:00
extraLibs = builtins.map (x: pkgs.${"coriolis-${x}"}) pythonComponents;
};
2021-09-03 05:12:38 -05:00
in pkgs.mkShell {
buildInputs = [ env ];
}
);
2021-08-16 12:06:47 -05:00
2021-09-05 09:03:28 -05:00
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);
2021-08-16 12:06:47 -05:00
};
}