coriolis/flake.nix

92 lines
3.1 KiB
Nix
Raw Normal View History

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.
inputs.nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-21.05";
outputs = { self, nixpkgs }:
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;
# Nixpkgs instantiated for supported system types.
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; overlays = [ self.overlay ]; });
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-08-27 09:26:33 -05:00
override = drv: drv.overrideAttrs (o: {
preConfigure = ''
cmakeFlagsArray+=(-DCMAKE_MODULE_PATH="$(sed -e 's|:|/share/cmake/Modules;|g' <<< "$CMAKE_PREFIX_PATH:")")
'' + (o.preConfigure or "");
2021-08-27 15:08:48 -05:00
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; };
# not generic: solstice lefdef equinox knik coloquinte bootstrap
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"
"tutorial" "unicorn"
2021-08-29 14:16:28 -05:00
];
components = pythonComponents ++ [
2021-08-29 14:21:28 -05:00
"lefdef" "bootstrap" "cumulus" "coloquinte"
"equinox" "knik" "ispd" "karakaze" "nimbus"
"metis" "mauka" "oroshi" "solstice" "stratus1"
"documentation" "unittests"
2021-08-27 09:36:23 -05:00
];
2021-08-23 03:44:07 -05:00
2021-08-29 12:36:58 -05:00
commonArgs = { inherit version meta generic; };
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;
packages = forAllSystems (system: builtins.foldl' (acc: elem: acc // {
${elem} = nixpkgsFor.${system}.${"coriolis-${elem}"};
}) {} components);
2021-08-16 12:06:47 -05:00
2021-08-27 15:18:09 -05:00
defaultPackage = forAllSystems (system: self.packages.${system}.unicorn);
2021-08-31 09:10:13 -05:00
devShells = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
envFor = comp: (pkgs.python2.buildEnv.override {
extraLibs = [ pkgs.${"coriolis-${comp}"} ];
2021-08-31 10:32:38 -05:00
});
2021-08-31 09:10:13 -05:00
in builtins.catAttrs (builtins.map (comp: { ${comp} = envFor comp; }) pythonComponents)
);
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;
};
in env.env
);
2021-08-16 12:06:47 -05:00
2021-08-22 05:54:22 -05:00
#hydraJobs.coriolis = self.defaultPackage;
2021-08-16 12:06:47 -05:00
};
}