-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Is your feature request related to a problem? Please describe.
Since caching sources of a closure seems next-to-impossible at the moment[1], the next best thing is to at least to be able to cache the output of any derivation. But if allowSubstitutes is set (or left undefined?), it prevents that.
Describe the solution you'd like
Add option that allows user to override the behaviour set by allowSubstitutes. E.g. always-allow-substitutes = true|false
Describe alternatives you've considered
overrideAttrs is not always possible and would unnecessarily modify the derivation. If the documentation is correct [2] in that allowSubstitutes is only a build optimization it shouldn't introduce an impurity to allow the attribute to be overridden by an option.
Additional context
[1] https://discourse.nixos.org/t/using-nixos-in-an-isolated-environment/3369
[2] https://nixos.org/nix/manual/#sec-advanced-attributes
allowSubstitutes
If this attribute is set to false, then Nix will always build this derivation; it will not try to substitute its outputs. This is useful for very trivial derivations (such as writeText in Nixpkgs) that are cheaper to build than to substitute from a binary cache.