2018-08-29 22:43:44 +03:00
|
|
|
nixpkgs:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
inherit (nixpkgs.lib) mapAttrs mapAttrsToList escapeShellArg optionalString concatStringsSep concatMapStringsSep;
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{ packages
|
|
|
|
, overrides ? _ : _ : {}
|
2018-08-29 23:03:24 +03:00
|
|
|
, tools ? []
|
2018-08-29 22:43:44 +03:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
overrides' = nixpkgs.lib.foldr nixpkgs.lib.composeExtensions (_: _: {}) [
|
|
|
|
(self: super: mapAttrs (name: path: self.callCabal2nix name path {}) packages)
|
2018-10-17 23:51:30 +03:00
|
|
|
overrides
|
2018-08-29 22:43:44 +03:00
|
|
|
];
|
|
|
|
haskellPackages = nixpkgs.haskellPackages.override { overrides = overrides'; };
|
|
|
|
packages' = mapAttrs (name: _: haskellPackages."${name}") packages;
|
|
|
|
mkShell = name: pkg:
|
|
|
|
let
|
|
|
|
n = "${name}-shell";
|
2018-10-17 23:51:30 +03:00
|
|
|
deps = haskellPackages.ghcWithHoogle (pkgs: pkg.buildInputs ++ pkg.propagatedBuildInputs);
|
2018-08-29 22:43:44 +03:00
|
|
|
in
|
|
|
|
{
|
|
|
|
name = "${n}";
|
|
|
|
value = nixpkgs.buildEnv {
|
|
|
|
name = "${n}";
|
2018-08-29 23:03:24 +03:00
|
|
|
paths = tools;
|
|
|
|
buildInputs = tools ++ [deps];
|
2018-08-29 22:43:44 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
shells = nixpkgs.lib.listToAttrs (mapAttrsToList mkShell packages');
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
packages' // shells
|