summaryrefslogtreecommitdiffstats
path: root/pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/haskell/default.nix18
1 files changed, 17 insertions, 1 deletions
diff --git a/pkgs/haskell/default.nix b/pkgs/haskell/default.nix
index 77905fe..5ab04d4 100644
--- a/pkgs/haskell/default.nix
+++ b/pkgs/haskell/default.nix
@@ -1,11 +1,27 @@
self: super: let
inherit (super) lib mylib;
+
+ # Haskell projects in the development environment, i.e. directories in
+ # ~/sync/src that contain <pname>.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 {}) [ ./. ]);
+ mylib.mapNixDir (path: hself.callPackage path {}) [ ./. ]
+ //
+ lib.mapAttrs (pname: src: hself.callCabal2nix pname (lib.cleanSource src) {}) automaticPackages);
};
}