mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-27 21:55:19 +03:00
6fbba94c21
This allows for cross-flake testing of content-addressible nix derivations without affecting other users of the flake (which would be the cases if CA-drvs would be hard-coded upstream) and without losing the ability to quickly update to the latest idris2 version (which would happen if a fork of the repo would be used). See also: https://discourse.nixos.org/t/content-addressed-nix-call-for-testers/12881 The flake can still be used as usual, but it will gain an output `overrideOptions`, which can be used like e.g. ```nix let idrisx = idris.overrideOptions { config.contentAddressedByDefault = true; }; in { ... } ```
13 lines
602 B
Nix
13 lines
602 B
Nix
rec {
|
|
# source: https://nixos.org/guides/nix-pills/override-design-pattern.html
|
|
# but with the ability to change the name of the override method
|
|
makeOverridable = kind: f:
|
|
let inner = oldArgs: (f oldArgs) // { ${kind} = newArgs: inner (oldArgs // newArgs); };
|
|
in inner;
|
|
|
|
# create a flake with overridable options. useful because we can't pass
|
|
# fine-grained overrides to flakes otherwise, we can only change inputs
|
|
# (therefore, this can't change inputs per default, and that should also be unnecessary)
|
|
mkOvrOptsFlake = flakefn: makeOverridable "overrideOptions" flakefn { };
|
|
}
|