feat(module): use kebab-case for option names, make more flexible#183
Conversation
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
📝 WalkthroughWalkthroughThe pull request refactors the nix module to introduce utility functions for nested attribute manipulation, restructure option paths via renaming (prebuildOptionCache → option-cache.enable, useActivationInterface → activation-interface.enable, generationTag → generation-tag), add new configuration options for environment preservation and option caching, and removes an example test. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@nix/module.nix`:
- Around line 193-198: The doas rule is producing duplicate SSH_AUTH_SOCK
entries because the module unconditionally prepends "SSH_AUTH_SOCK TERMINFO
TERMINFO_DIRS" while you also pass cfg.preserve-env into setEnv; update the
assignment used in security.doas.extraRules so the preserved-env list explicitly
removes the unconditional SSH_AUTH_SOCK before passing it to setEnv (e.g.
prepend "-SSH_AUTH_SOCK" or otherwise filter cfg.preserve-env) so the final
setEnv for the rule does not contain SSH_AUTH_SOCK twice.
- Around line 138-152: The description incorrectly references a non-existent
nested attribute `options.services.nixos-cli.preserve-env.options`; update the
text to point to the correct attribute `services.nixos-cli.preserve-env` (or
`options.services.nixos-cli.preserve-env` if referring to the evaluated option
path) so users look up the list value correctly; locate the paragraph mentioning
`options.services.nixos-cli.preserve-env.options` and replace that token with
`services.nixos-cli.preserve-env` and adjust surrounding wording if needed to
reflect that `preserve-env` is a list of strings.
- Around line 115-124: The option-cache.exclude mkOption lacks a type and
default which causes evaluation failures when cfg.option-cache.exclude is
referenced; update the lib.mkOption for option-cache.exclude to set an explicit
type (e.g. a list type such as types.listOf types.str or appropriate
attr-path/list type consistent with removeNestedAttrs usage) and add default =
[] so cfg.option-cache.exclude is defined by default; ensure this change aligns
with option-cache.enable behavior and prevents lib.foldl' in removeNestedAttrs
from receiving a non-list.
0f277d3 to
10cd959
Compare
The NixOS module had a couple of small cosmetic issues, as well as missing features; this PR takes some time to address them.
kebab-caseinstead ofcamelCasefor option identifiers. This standardizes the option names to usekebab-caseand also nests relevant options into attrsets that might benefit from more granular configuration in the future.optnixNix library) to exclude options that would otherwise result in evaluation failures, which can unblock users from bad configurations while they report issues to their respective upstreams.sudoenv var preservation was not configurable. This makes it configurable, and adds a notice about when it should be used with regards to the new updates with env wrappers.doas, but automatic env preservation was not configured. This adds that automatic configuration with sane env preservation defaults similar to the addedsudodefaults.Summary by CodeRabbit
Release Notes
New Features
Configuration Changes