diff options
author | Jörg Thalheim <Mic92@users.noreply.github.com> | 2021-09-21 08:07:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-21 08:07:02 +0100 |
commit | a65e3b66cbe1d030f00764d764e67fa906ccbfcf (patch) | |
tree | a56246f512740aa4f955cec8cda1e10a87786b61 /doc/builders | |
parent | e36b3326209b404bfd7b87ee60edf43bfe8fafc8 (diff) | |
parent | 4687d7523bd068bcf0a87ed6ac4e4bfa6f7f4e11 (diff) |
Merge pull request #137601 from fzakaria/faridzakaria/glibc-netbase
glibc: allow environment variable for /etc/ files (i.e. /etc/protocols)
Diffstat (limited to 'doc/builders')
-rw-r--r-- | doc/builders/packages/etc-files.section.md | 17 | ||||
-rw-r--r-- | doc/builders/packages/index.xml | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/doc/builders/packages/etc-files.section.md b/doc/builders/packages/etc-files.section.md new file mode 100644 index 0000000000000..0b83793835911 --- /dev/null +++ b/doc/builders/packages/etc-files.section.md @@ -0,0 +1,17 @@ +# /etc files {#etc} + +Certain calls in glibc require access to runtime files found in /etc such as `/etc/protocols` or `/etc/services` -- [getprotobyname](https://linux.die.net/man/3/getprotobyname) is one such function. + +On non-NixOS distributions these files are typically provided by packages (i.e. [netbase](https://packages.debian.org/sid/netbase)) if not already pre-installed in your distribution. This can cause non-reproducibility for code if they rely on these files being present. + +If [iana-etc](https://hydra.nixos.org/job/nixos/trunk-combined/nixpkgs.iana-etc.x86_64-linux) is part of your _buildInputs_ then it will set the environment varaibles `NIX_ETC_PROTOCOLS` and `NIX_ETC_SERVICES` to the corresponding files in the package through a _setup-hook_. + +```bash +❯ nix-shell -p iana-etc + +[nix-shell:~]$ env | grep NIX_ETC +NIX_ETC_SERVICES=/nix/store/aj866hr8fad8flnggwdhrldm0g799ccz-iana-etc-20210225/etc/services +NIX_ETC_PROTOCOLS=/nix/store/aj866hr8fad8flnggwdhrldm0g799ccz-iana-etc-20210225/etc/protocols +``` + +Nixpkg's version of [glibc](https://hydra.nixos.org/job/nixos/trunk-combined/nixpkgs.glibc.x86_64-linux) has been patched to check for the existence of these environment variables. If the environment variable are *not set*, then it will attempt to find the files at the default location within _/etc_. diff --git a/doc/builders/packages/index.xml b/doc/builders/packages/index.xml index f5b05b0bbccfc..206e1e49f1f85 100644 --- a/doc/builders/packages/index.xml +++ b/doc/builders/packages/index.xml @@ -17,6 +17,7 @@ <xi:include href="kakoune.section.xml" /> <xi:include href="linux.section.xml" /> <xi:include href="locales.section.xml" /> + <xi:include href="etc-files.section.xml" /> <xi:include href="nginx.section.xml" /> <xi:include href="opengl.section.xml" /> <xi:include href="shell-helpers.section.xml" /> |