Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modules: make apply mergeable #301472

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/modules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,9 @@ let
t' = opt.options.type;
mergedType = t.typeMerge t'.functor;
typesMergeable = mergedType != null;
applySet = if (bothHave "apply")
then { apply = value: opt.options.apply (res.apply value); }
else {};
typeSet = if (bothHave "type") && typesMergeable
then { type = mergedType; }
else {};
Expand All @@ -752,7 +755,6 @@ let
if bothHave "default" ||
bothHave "example" ||
bothHave "description" ||
bothHave "apply" ||
(bothHave "type" && (! typesMergeable))
then
throw "The option `${showOption loc}' in `${opt._file}' is already declared in ${showFiles res.declarations}."
Expand All @@ -772,7 +774,7 @@ let
then [opt.pos]
else [{ file = opt._file; line = null; column = null; }]);
options = submodules;
} // typeSet
} // applySet // typeSet
) { inherit loc; declarations = []; declarationPositions = []; options = []; } opts;

/* Merge all the definitions of an option to produce the final
Expand Down
2 changes: 2 additions & 0 deletions nixos/doc/manual/release-notes/rl-2405.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,8 @@ The pre-existing [services.ankisyncd](#opt-services.ankisyncd.enable) has been m

- A stdenv's default set of hardening flags can now be set via its `bintools-wrapper`'s `defaultHardeningFlags` argument. A convenient stdenv adapter, `withDefaultHardeningFlags`, can be used to override an existing stdenv's `defaultHardeningFlags`.

- The `apply` function passed to `mkOption` is now mergeable. This allows for accessing the previous value of the option, similar to the `prev`/`super` argument in `overlays`, `override` and `overrideAttrs`.

- `libass` now uses the native CoreText backend on Darwin, which may fix subtitle rendering issues with `mpv`, `ffmpeg`, etc.

- [Lilypond](https://lilypond.org/index.html) and [Denemo](https://www.denemo.org) are now compiled with Guile 3.0.
Expand Down