ebook-manager/project.nix

41 lines
952 B
Nix
Raw Normal View History

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