self: super: let inherit (super) lib mylib; # Haskell projects in the development environment, i.e. directories in # ~/sync/src that contain .cabal. They take precedence over # pkgs/haskell and nixpkgs, and can depend on each other. On hosts without # ~/sync/src, there are none. automaticPackages = let root = /home/tv/sync/src; in lib.optionalAttrs (builtins.pathExists root) (lib.mapAttrs (pname: _type: root + "/${pname}") (lib.filterAttrs (pname: type: type == "directory" && builtins.pathExists (root + "/${pname}/${pname}.cabal")) (builtins.readDir root))); in { # nixpkgs applies packageOverrides to every Haskell package set, including # haskellPackages. haskell = super.haskell // { packageOverrides = lib.composeExtensions super.haskell.packageOverrides (hself: hsuper: mylib.mapNixDir (path: hself.callPackage path {}) [ ./. ] // lib.mapAttrs (pname: src: hself.callCabal2nix pname (lib.cleanSource src) {}) automaticPackages); }; }