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
nixos/less: add configuration assertions #59517
Conversation
Instead of silently overriding values the user has configured for commands, clearDefaultCommands, lineEditingKeys, or envVariables, prevent the system from building a conflicted configuration and tell the user what's causing the conflict.
@GrahamcOfBorg eval |
Just played around with this locally and pushed a commit that documents this in the release notes. As soon as ofborg has finished its evaluations, we can merge this 👍 |
I broke ofborg. Rolling back, deploying, and then will re-evaluate. |
@GrahamcOfBorg eval |
I don't like this idea for multiple reasons:
|
@infinisil I think you're right. I'm closing this PR. |
Isn't it possible to use priorities like this here: { lib, ... }:
{
programs.less = {
envVariables = lib.mkForce {};
};
}
Well it makes perfect sense with the concept of priorities, but this isn't used in the
When I remember me while trying to learn NixOS two years ago I screwed a lot of stuff up at first due to some misunderstandings, so I have to admit that I don't understand why we should save 4 options that are potentially helpful, especially for beginners :) |
Ah yeah, using
Oh you're right, the module doesn't use priorities as I thought it would: nixpkgs/nixos/modules/programs/less.nix Lines 9 to 11 in c799751
Usually you'd implement this by using
In addition to the first point (which should be enough reason on its own), I don't think we should have this because these priority overrides are all over the place in NixOS, and we can't guard against them all (well we could, but that would be a pain). If we had something builtin in the module system to warn us (not error out at least) that would be better (but then again, we have no way to turn off warnings, and you sometimes want to override other options without getting a warning). Here's some more examples of options overriding other options: |
I'm afraid I have to disagree here: a hypothetical third-party module for I always think twice before using
I'm probably missing something, but having i.e.
Hmm that sounds in fact way better. Another option that came to my mind was to provide some kind of |
Yeah the If people really want to see more such assertions, I wouldn't mind seeing a small RFC for this that lists advantages/disadvantages and such. |
Motivation for this change
Instead of silently overriding values the user has configured for
commands
,clearDefaultCommands
,lineEditingKeys
, orenvVariables
, prevent the system from building a conflicted configuration and tell the user what's causing the conflict.Addresses #38629 (comment)
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)