summaryrefslogtreecommitdiffstats
path: root/pkgs/haskell
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-16 02:36:27 +0000
committertv <tv@krebsco.de>2026-11-16 03:42:28 +0100
commit93c9f5001eff0f2096f9c72d78eb3d5ca2c4e069 (patch)
tree7afe4488e1670ae200ad05ebdd360c009501b72c /pkgs/haskell
parentda2c5e514d576a46d60b780514977df4a422db68 (diff)
pkgs/haskell: add automatic packages
Diffstat (limited to 'pkgs/haskell')
-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);
};
}