···
let inherit (lib) nv nvs; in
5
-
# - development/interpreters/php_configurable/default.nix
6
-
# - .. search composableDerivation in all-packages.nix ..
5
+
# composableDerivation basically mixes these features:
8
+
# - provides shortcuts for "options" such as "--enable-foo" and adding
9
+
# buildInputs, see php example
11
+
# It predates styles which are common today, such as
13
+
# * mkDerivation.override feature
14
+
# * overrideDerivation (lib/customization.nix)
16
+
# Some of the most more important usage examples (which could be rewritten if it was important):
19
+
# * vim_configurable
21
+
# A minimal example illustrating most features would look like this:
22
+
# let base = composableDerivation { (fixed : let inherit (fixed.fixed) name in {
25
+
# buildInputs = [A];
26
+
# preConfigre = "echo ${name}";
27
+
# # attention, "name" attr is missing, thus you cannot instantiate "base".
30
+
# # These all add name attribute, thus you can instantiate those:
31
+
# v1 = base.merge ({ name = "foo-add-B"; buildInputs = [B]; }); // B gets merged into buildInputs
32
+
# v2 = base.merge ({ name = "mix-in-pre-configure-lines" preConfigre = ""; });
33
+
# v3 = base.replace ({ name = "foo-no-A-only-B;" buildInputs = [B]; });
36
+
# So yes, you can think about it being something like nixos modules, and
37
+
# you'd be merging "features" in one at a time using .merge or .replace
38
+
# Thanks Shea for telling me that I rethink the documentation ..
41
+
# * its complicated to understand
42
+
# * some "features" such as exact merge behaviour are burried in mergeAttrBy
43
+
# and defaultOverridableDelayableArgs assuming the default behaviour does
44
+
# the right thing in the common case
45
+
# * Eelco once said using such fix style functions are slow to evaluate
46
+
# * Too quick & dirty. Hard to understand for others. The benefit was that
47
+
# you were able to create a kernel builder like base derivation and replace
48
+
# / add patches the way you want without having to declare function arguments
51
+
# declaring "optional featuers" is modular. For instance:
53
+
# configureFlags = ["--with-curl=${curl}" "--with-curlwrappers"];
54
+
# buildInputs = [curl openssl];
56
+
# flags.other = { .. }
57
+
# (Example taken from PHP)
59
+
# alternative styles / related features:
60
+
# * Eg see function supporting building the kernel
61
+
# * versionedDerivation (discussion about this is still going on - or ended)
62
+
# * composedArgsAndFun
63
+
# * mkDerivation.override
64
+
# * overrideDerivation
65
+
# * using { .., *Support ? false }: like configurable options.
66
+
# To find those examples use grep
8
-
# You should be able to override anything you like easily
9
-
# grep the mailinglist by title "python proposal" (dec 08)
10
-
# -> http://mail.cs.uu.nl/pipermail/nix-dev/2008-December/001571.html
11
-
# to see why this got complicated when using all its features
12
-
# TODO add newer example using new syntax (kernel derivation proposal -> mailinglist)
68
+
# To sum up: It exists for historical reasons - and for most commonly used
69
+
# tasks the alternatives should be used
71
+
# If you have questions about this code ping Marc Weber.
mkDerivation ? pkgs.stdenv.mkDerivation,