-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
|
@@ -350,6 +350,12 @@ | |||
See the <literal>fish</literal> <link xlink:href="https://github.com/fish-shell/fish-shell/releases/tag/3.0.0">release notes</link> for more information. | |||
</para> | |||
</listitem> | |||
<listitem> | |||
<para> | |||
<literal>types.optionSet</literal> is deprecated. Use <literal>types.submodule</literal> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 😉
@@ -92,23 +92,25 @@ let | |||
exit($mainRes & 127 ? 255 : $mainRes << 8); | |||
''; | |||
|
|||
opts = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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;
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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'
+mapAttrs
listToAttrs
+mapAttrsToList
->mapAttrs
types.optionSet
and remove some (most?) related codeThings done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)