module system: small eval optimization#54637
Conversation
|
Oh nice! I didn't know the |
|
Can you put a more fitting description for the first 2 commits? Seems good to merge then |
37da1fc to
5747041
Compare
5747041 to
30748a8
Compare
|
@infinisil should be good now |
infinisil
left a comment
There was a problem hiding this comment.
I'd like to take @nbp, @Profpatsch or @rycee to take a look at this as well.
One thing that could be changed is to throw an error when people pass an options argument to mkOption, this then corresponds to optionSet's behavior
|
|
There was a problem hiding this comment.
I think this needs more strong wording since "deprecated" might imply that it is still actually working. I would suggest something like
<literal>types.optionSet</literal> has been removed after a long deprecation period. Use <literal>types.submodule</literal> instead.I guess "removed" is not technically correct but I think it is morally correct 😉
There was a problem hiding this comment.
I'd suggest changing the formatting to
opts = { config, name, ... }: {
options.runner = mkOption {
internal = true;
description = ''
A script that runs the service outside of systemd,
useful for testing or for using NixOS services outside
of NixOS.
'';
};
config.runner = makeScript name config;
};
rycee
left a comment
There was a problem hiding this comment.
Haven't checked super carefully but I'm liking it a lot! Very nice to clean up this old options code.
|
@rycee @infinisil is release doc good now? |
… -> foldl' + mapAttrs)
7dac02f to
5f8106d
Compare
5f8106d to
27982b4
Compare
|
Looks good. Am not particularly deep into the implementation of the module system. Nix needs an hlint. :P |
|
Agreed that it looks good 👍 |
27982b4 introduced a bug when refactoring the encrypted-devices module, causing some encrypted filesystem options to not be recognized anymore. See e.g. https://hydra.nixos.org/build/88145490
* pr-55088: nixos/tasks/encrypted-devices: fix regression from #54637
Motivation for this change
Small NixOS eval optimization (~2.5% runtime, ~5% memory)
foldl'+foldl'+attrNames->foldl'+mapAttrslistToAttrs+mapAttrsToList->mapAttrstypes.optionSetand remove some (most?) related codeThings done
sandboxinnix.confon non-NixOS)nix-shell -p nox --run "nox-review wip"./result/bin/)nix path-info -Sbefore and after)