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
[RDY] iproute: copy files in /etc #39536
Conversation
Success on aarch64-linux (full log) Attempted: iproute Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: iproute Partial log (click to expand)
|
@@ -119,6 +119,12 @@ in | |||
|
|||
system.activationScripts.stdio = ""; # obsolete | |||
|
|||
system.activationScripts.iproute2 = '' | |||
cp -R ${pkgs.iproute}/etc/iproute2 /etc |
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.
but does this not overwrite any modification done by the user?
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 that case, would it not be better to have config options for those files? This feels wrong. The files should either be managed by nix or not touched like that at all..
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 agree with that.
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.
once iproute is installed, users expect ip route list table main
to work but if iproute can't find the file than it breaks this expection. While the file can be modified, it does have default. Maybe iproute should be patched look somewhere else than /etc/iproute2 (like in /var/run) but some sort of default should exist. To prevent overwriting user changes, the activationScript could write it only if it does'nt already exist.
yes it is a problem but i couldn't think of any better solution. in my case
restarting networkmanager should be enough to fix the rt_table file/the
routing tables (i update them through hm hooks).
Le ven. 27 avr. 2018 19:09, Jörg Thalheim <notifications@github.com> a
écrit :
… ***@***.**** commented on this pull request.
------------------------------
In nixos/modules/system/activation/activation-script.nix
<#39536 (comment)>:
> @@ -119,6 +119,12 @@ in
system.activationScripts.stdio = ""; # obsolete
+ system.activationScripts.iproute2 = ''
+ cp -R ${pkgs.iproute}/etc/iproute2 /etc
but does this not overwrite any modification done by the user?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#39536 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA2FOrAZh1vfhjhfsRkT5GPMGfWNDNkjks5tsudPgaJpZM4Tk6yt>
.
|
Hm... Does iproute follow any environment variables to change the location of these things? |
nope but you can configure an alternate path to look for on compilation (like /var/run). |
Maybe we should just patch it to look in To have /etc/iproute2 installed in /run/current-system/sw, you will need to add it to patchsToLink here: nixpkgs/nixos/modules/config/system-path.nix Lines 103 to 125 in b6ec6fd
|
For my specific scenario, the file is modified dynamically depending on network conditions. If a network pops up, it will create its own routing table alias in /etc/iproute2/rt_tables. So the file needs to be writable (ideally reset on boot), I don't think I can do this with pathsToLink. |
Ok. This would probably make sense as a module then. It definitely should not be done by default. Or at least not until other users start complaining about the missing routing tables. |
e9371da
to
18cfb6a
Compare
I made it a module, I can merge it with the networking module if need be. |
buildFlags = [ | ||
"CONFDIR=/etc/iproute2" | ||
"CONFDIR=/run/iproute2" |
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.
You can share this with the module by using something like config.iproute2.confdir or "/etc/iproute2"
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 was looking for a way to unify the setting too but not sure how to do it. I just tried sthg but it fails. Any suggestion ? Thanks for your patience
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 I think you would do this like:
"CONFDIR=${config.iproute2.confdir or "/run/iproute2"}"
& then add config as an arg.
Also add to your module implementation:
nixpkgs.config.iproute2.confdir = "/run/iproute2"
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.
just making sure:
- does it have to be a toplevel config.iproute2 or is the current config.networking.iproute2 ok ?
- I already have confDir as an option. isn't that enough ?
@matthewbauer is that conform to what you requested, if yes feel free to squash & merge. |
buildFlags = [ | ||
"CONFDIR=/etc/iproute2" | ||
"CONFDIR=${config.networking.iproute2.confDir or "/run/iproute2"}" |
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.
Can you verify if this works? That is can you change confDir and get a different value passed to buildFlags? I'm not 100% on this but I think you need to directly pass it with nixpkgs.config
in your module (see https://github.com/NixOS/nixpkgs/blob/release-18.03/nixos/modules/misc/nixpkgs.nix#L92-L106). Nixpkgs & NixOS have different config sets which can be confusing.
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.
IMHO this requires a change log entry.
I am also not so sure if changing the default to /run
is a good decision. If someone needs this the configuration will be set to whatever the user wants and the default behavior should not be altered if not used.
Am I missing something?
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 agree this can be cool to have as a changelogentry. How would I do that ? other PR ? what document ?
I don't see a usecase either to let the user set the path (he would lose the cache) so I am tempted to remove the confDir = mkOption {
but the paths between the module and the package must be in sync so I would let the nixpkgs.config.iproute2.confDir. If the user can't choose confDir, then we need to agree on the default. /etc/iproute2 is the common one but I guess /run/iproute2 matches dynamic files better. I am fine either way.
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.
Ok yeah just using /run/iproute2 makes sense.
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.
do you want me to hardcode it or current Pr is fine ?
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's fine 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.
many thanks for shepharding.
I tested it and the changes took effect. I squashed all. |
When doing source routing/multihoming, it's practical to give names to routing tables. The absence of the rt_table file in /etc make this impossible. This patch recreates these files on rebuild so that they can be modified by the user see NixOS#38638. iproute2 is modified to look into config.networking.iproute2.confDir instead of /etc/iproute2.
That sounds better, I don't think we need to have a configurable path. But I think this should be done by nixos so the module may still make sense. While I am just interested in rt_tables the other files in etc/iproute2/ should be copied too.
but for the whole |
You could iterate through that dir using builtins.readDir
"${pks.iproute}/etc/iproute2/". That will give you an attrset where the
key/name is the filename and the value is the type of the dir.
…On Fri, 8 Jun 2018, 05:37 Matthieu Coudron, ***@***.***> wrote:
That sounds better, I don't think we need to have a configurable path. But
I think this should be done by nixos so the module may still make sense.
While I am just interested in rt_tables the other files in etc/iproute2/
should be copied too.
Is there a way to do this
environment.etc."iproute2/rt_tables" = {
text = (lib.fileContents "${pkgs.iproute}/etc/iproute2/rt_tables") + '' any extras '';
mode = "0644";
};
but for the whole ${pkgs.iproute}/etc/iproute2 folder ?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#39536 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAm_dCncuDhWMizQbIZG8VfK-X940oNLks5t6fFlgaJpZM4Tk6yt>
.
|
doesn't seem simpler than the current |
What is that multihoming module ? I see your point in having the file generated. As for myself I use networkmanage hooks to achieve dynamic multihoming #39142 so I would need |
When doing source routing/multihoming, it's practical to give names to routing
tables. The absence of the rt_table file in /etc make this impossible.
This patch recreates these files on rebuild so that they can be modified
by the user
Motivation for this change
see #38638.
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)