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

bug: nix.checkConfig = false still fails on unknown settings #5753

Open
2 tasks done
ian-h-chamberlain opened this issue Aug 18, 2024 · 3 comments · May be fixed by #6293
Open
2 tasks done

bug: nix.checkConfig = false still fails on unknown settings #5753

ian-h-chamberlain opened this issue Aug 18, 2024 · 3 comments · May be fixed by #6293
Assignees
Labels
bug triage Issues or feature request that have not been triaged yet

Comments

@ian-h-chamberlain
Copy link

Are you following the right branch?

  • My Nixpkgs and Home Manager versions are in sync

Is there an existing issue for this?

  • I have searched the existing issues

Issue description

I'm not sure if this is more of a bug report or feature request, but ultimately it's unexpected behavior to me and I couldn't find any other issues about this option...

I have a simple config like

  nix.checkConfig = false;
  nix.settings = {
    unknown-setting = "";
  };

From the description of checkConfig, I assumed this would work: https://github.com/nix-community/home-manager/blob/master/modules/misc/nix.nix#L239C1-L246C7
Especially since nix.conf allows unknown keys according to its manpages.

However the checkPhase as written seems to specifically disallow unknown values regardless of nix.checkConfig: https://github.com/nix-community/home-manager/blob/master/modules/misc/nix.nix#L95-L97 and this results in a build failure:

nix-repl> :b homeConfigurations."ianchamberlain@MacBook-Pro".config.xdg.configFile."nix/nix.conf".source
error: builder for '/nix/store/7p3bzjm46nxh20kfyn76fbdf3qgy890g-nix.conf.drv' failed with exit code 1;
       last 2 log lines:
       > Validating generated nix.conf
       > error: unknown setting 'unknown-setting'
       For full logs, run 'nix log /nix/store/7p3bzjm46nxh20kfyn76fbdf3qgy890g-nix.conf.drv'.

I would propose one of two changes:

  • For checkConfig = false, skip the checkPhase entirely; the user has opted out of nix.conf validation
  • Add a new option allowUnknownSettings or something like that, which could be toggled separately from checkConfig and specifically allows unknown settings but not other errors.

The first choice seems much simpler to implement (happy to open a PR), but maybe the second choice would make sense as a way to enable syntax / type checking but still allow unknown settings? I guess it would allow for type checking of known features but not unknown features...

Maintainer CC

Nix module no longer has an active maintainer and git blame seems mostly like one-off changes... not sure who might be the right person to see this?

System information

- system: `"aarch64-darwin"`
 - host os: `Darwin 23.6.0, macOS 14.6.1`
 - multi-user?: `no`
 - sandbox: `yes`
 - version: `nix-env (Lix, like Nix) 2.90.0`
 - nixpkgs: `not found`
@ian-h-chamberlain ian-h-chamberlain added bug triage Issues or feature request that have not been triaged yet labels Aug 18, 2024
Copy link

stale bot commented Jan 3, 2025

Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.

If you are the original author of the issue

  • If this is resolved, please consider closing it so that the maintainers know not to focus on this.
  • If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

If you are not the original author of the issue

  • If you are also experiencing this issue, please add details of your situation to help with the debugging process.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

Memorandum on closing issues

Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.

@stale stale bot added the status: stale label Jan 3, 2025
@ian-h-chamberlain
Copy link
Author

Since I haven't got any feedback on a preferred option, I'll see if I can just implement the simpler option:

For checkConfig = false, skip the checkPhase entirely; the user has opted out of nix.conf validation

If it seems simple enough maybe I'll try to add an "allow unknown" settings as well

@ian-h-chamberlain ian-h-chamberlain linked a pull request Jan 8, 2025 that will close this issue
6 tasks
@ian-h-chamberlain
Copy link
Author

PR opened, maybe stalebot will remove its label here now?

@stale stale bot removed the status: stale label Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug triage Issues or feature request that have not been triaged yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants