coriolis/flake.nix

130 lines
4.8 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-10-26 15:17:17 -05:00
inputs.nixpkgs.url = "github:NixOS/nixpkgs"; # for alliance
inputs.alliance-check-toolkit.url = "git+https://github.com/lip6/alliance-check-toolkit.git";
inputs.alliance-check-toolkit.flake = false;
2021-09-05 09:49:09 -05:00
inputs.soclayout.url = "git+https://git.libre-soc.org/git/soclayout.git";
2021-09-05 08:57:31 -05:00
inputs.soclayout.flake = false;
2021-09-05 09:49:09 -05:00
inputs.pinmux.url = "git+https://git.libre-soc.org/git/pinmux.git";
inputs.pinmux.flake = false;
2021-09-16 15:10:05 -05:00
outputs = { self, nixpkgs, alliance-check-toolkit, soclayout, pinmux }:
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: {
2021-10-26 16:10:09 -05:00
python3Packages = super.python3Packages.override {
2021-09-01 04:31:22 -05:00
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=";
};
2021-10-26 16:10:09 -05:00
pythonImportsCheck = (o.pythonImportsCheck or []) ++ [ "PyQt4.QtCore" "PyQt4.QtGui" ];
2021-09-01 04:31:22 -05:00
});
};
};
};
# 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-10-26 17:27:24 -05:00
"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:49:09 -05:00
"documentation" "combined"
2021-08-27 09:36:23 -05:00
];
2021-08-23 03:44:07 -05:00
2021-09-05 09:49:09 -05:00
commonArgs = { inherit version meta generic; };
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; }
) {};
2021-09-05 09:49:09 -05:00
libresoc = nixpkgsFor.${system}.callPackage (
2021-09-05 11:06:44 -05:00
import ./nix/libresoc.nix { inherit alliance-check-toolkit soclayout pinmux; }
2021-09-05 09:49:09 -05:00
) {};
2021-09-05 09:22:18 -05:00
unittests = override (nixpkgsFor.${system}.callPackage (
2021-09-05 09:03:28 -05:00
import ./nix/unittests.nix { inherit version meta; }
2021-09-05 09:22:18 -05:00
) {});
2021-09-05 08:57:31 -05:00
});
2021-09-05 07:20:50 -05:00
# CORIOLIS_TOP must be set before execution
2021-09-05 09:17:19 -05:00
# example: `env 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};
2021-10-26 16:10:09 -05:00
env = pkgs.python3.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-09-05 11:06:44 -05:00
hydraJobs.libresoc = forAllSystems (system: self.checks.${system}.libresoc);
2021-08-16 12:06:47 -05:00
};
}