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
NIX_USER_CONF_FILES #3458
NIX_USER_CONF_FILES #3458
Conversation
6f62825
to
3a9d3d0
Compare
If this isn't a proof for NixOS/rfcs#64 then I don't know what is :) |
It's actually the opposite: DocBook at least has a concept of an "error". Markdown is garbage in, garbage out. |
I can fix the doc error with some more elbow grease. Can I get feedback on the PR instead? :D @edolstra does the PR make sense to you overall? |
@zimbatm Yes, makes sense. However it may make more sense to add an environment variable |
Or generalize this to a list of configuration files (e.g. |
What advantage does this have over using the existing XDG_CONF_DIRS support? |
@lheckemann Good point, that might be the way to go. |
For example, you'll want your editor to read the usual configuration files. |
You don't need to change the config home (where programs write their config to), only add a dir to the config path (where they read their config from) — and if the extra entry in the config path only contains relevant config (i.e. nix config) it'll only affect nix. |
On 06:52 01.04.20, Linus Heckemann wrote:
You don't need to change the config home (where programs write their
config to), only add a dir to the config path (where they read their
config from) — and if the extra entry in the config path only contains
relevant config (i.e. nix config) it'll only affect nix.
Yeah, I am just setting that as part of my .envrc:
export XDG_CONFIG_DIRS="$(pwd)/.config:$XDG_CONFIG_DIRS"
It has served me well for a while now. If there was another variable on
the nix end it should probably just allow a list of files (as eelco
suggested).
|
I was focused on |
@lheckemann |
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 don't know if I'm authorized to approve, but this looks really nice and solves an important use case. Bonus point for documentation.
A variation on the XDG idea would be to push |
56ce053
to
a1cba71
Compare
I fixed the doc generation and added a minimal test. The last thing to address is @edolstra's comment on |
4b13d54
to
62b0d3d
Compare
@edolstra the env has been renamed to NIX_CONF_FILES and now appends to the existing config paths. |
Does this override the system configuration or just append to it? For instance, what happens when a local config has |
Keys get overridden and the last writer wins. For example, if |
That's #2149 |
Who is able to give this PR another substantial review? Does it make sense how I changed the code structure to load all the config files? |
doc/manual/command-ref/conf-file.xml
Outdated
<listitem> | ||
<para> | ||
And finally, every files pointed to by | ||
<envar>NIX_EXTRA_CONF_FILES</envar>, separated by <literal>:</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.
Is this implemented?
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.
yes? You can see it in action in the admittedly minimal test.
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.
It only uses NIX_CONF_FILES
, not NIX_EXTRA_CONF_FILES
.
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.
oh ok. This is a typo. Fixed in 976ead5
It also seems like the |
doc/manual/command-ref/conf-file.xml
Outdated
<para> | ||
And finally, every files pointed to by | ||
<envar>NIX_CONF_FILES</envar>, separated by <literal>:</literal> | ||
if that environment variable exists. |
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.
This is phrased awkwardly (it's the contents of NIX_CONF_FILE that's separated by :
).
0a1fd9f
to
a648322
Compare
Motivation: maintain project-level configuration files. Document the whole situation a bit better so that it corresponds to the implementation, and add NIX_USER_CONF_FILES that allows overriding which user files Nix will load during startup.
a648322
to
895516c
Compare
This is ready for another round of review.
|
add NIX_USER_CONF_FILES
Motivation: maintain project-level configuration files.
Document the whole situation a bit better so that it corresponds to the
implementation, and add NIX_USER_CONF_FILES that allows overriding
which user files Nix will load during startup.