haskell-modules: Add replacements-by-name

(cherry picked from commit 3ff89d8f12b0f2b3ef4cfb9873df6c76a1d9c761)

Changed files
+22
pkgs
development
haskell-modules
replacements-by-name
+15
pkgs/development/haskell-modules/non-hackage-packages.nix
···
{ pkgs, haskellLib }:
# EXTRA HASKELL PACKAGES NOT ON HACKAGE
#
# This file should only contain packages that are not in ./hackage-packages.nix.
···
hercules-ci-optparse-applicative = self.callPackage ../misc/haskell/hercules-ci-optparse-applicative.nix {};
}
···
{ pkgs, haskellLib }:
+
let
+
inherit (pkgs) lib;
+
inherit (lib.strings) hasSuffix removeSuffix;
+
+
pathsByName =
+
lib.concatMapAttrs
+
(name: type:
+
lib.optionalAttrs (type == "regular" && hasSuffix ".nix" name) {
+
${removeSuffix ".nix" name} = ./replacements-by-name + "/${name}";
+
}
+
)
+
(builtins.readDir ./replacements-by-name);
+
in
+
# EXTRA HASKELL PACKAGES NOT ON HACKAGE
#
# This file should only contain packages that are not in ./hackage-packages.nix.
···
hercules-ci-optparse-applicative = self.callPackage ../misc/haskell/hercules-ci-optparse-applicative.nix {};
}
+
// lib.mapAttrs (_name: path: self.callPackage path {}) pathsByName
+7
pkgs/development/haskell-modules/replacements-by-name/README.md
···
···
+
# haskell-modules/replacements-by-name
+
+
This directory is scanned, and all `.nix` files are called in order to replace their respective packages in the `haskellPackages` set.
+
They're loaded after `hackage-packages.nix` but before any overrides are applied.
+
See [non-hackage-packages.nix](../non-hackage-packages.nix) for the implementation.
+
+
This is used for selective backports of updates, as the hackage package set won't be updated in its entirety.