treewide/nixos: use stdenv.cc.libc instead of glibc when available

This prevents duplication in cross-compiled nixos machines. The
bootstrapped glibc differs from the natively compiled one, so we get
two glibc’s in the closure. To reduce closure size, just use
stdenv.cc.libc where available.
This commit is contained in:
Matthew Bauer 2020-02-28 12:04:10 -05:00
parent 8a5059e1cc
commit 7cc40e15e4
3 changed files with 11 additions and 7 deletions

View File

@ -197,7 +197,7 @@ in
} // optionalAttrs (pkgs.stdenv.hostPlatform.libc == "glibc") {
# /etc/rpc: RPC program numbers.
rpc.source = pkgs.glibc.out + "/etc/rpc";
rpc.source = pkgs.stdenv.cc.libc.out + "/etc/rpc";
};
networking.proxy.envVars =

View File

@ -7,6 +7,10 @@ let
nssModulesPath = config.system.nssModules.path;
cfg = config.services.nscd;
nscd = if pkgs.stdenv.hostPlatform.libc == "glibc"
then pkgs.stdenv.cc.libc.bin
else pkgs.glibc.bin;
in
{
@ -59,16 +63,16 @@ in
# files. So prefix the ExecStart command with "!" to prevent systemd
# from dropping privileges early. See ExecStart in systemd.service(5).
serviceConfig =
{ ExecStart = "!@${pkgs.glibc.bin}/sbin/nscd nscd";
{ ExecStart = "!@${nscd}/sbin/nscd nscd";
Type = "forking";
DynamicUser = true;
RuntimeDirectory = "nscd";
PIDFile = "/run/nscd/nscd.pid";
Restart = "always";
ExecReload =
[ "${pkgs.glibc.bin}/sbin/nscd --invalidate passwd"
"${pkgs.glibc.bin}/sbin/nscd --invalidate group"
"${pkgs.glibc.bin}/sbin/nscd --invalidate hosts"
[ "${nscd}/sbin/nscd --invalidate passwd"
"${nscd}/sbin/nscd --invalidate group"
"${nscd}/sbin/nscd --invalidate hosts"
];
};
};

View File

@ -66,12 +66,12 @@ let
linux = pkgs.utillinux;
};
getconf = {
linux = if stdenv.hostPlatform.libc == "glibc" then pkgs.glibc
linux = if stdenv.hostPlatform.libc == "glibc" then pkgs.stdenv.cc.libc
else pkgs.netbsd.getconf;
darwin = pkgs.darwin.system_cmds;
};
getent = {
linux = if stdenv.hostPlatform.libc == "glibc" then pkgs.glibc
linux = if stdenv.hostPlatform.libc == "glibc" then pkgs.stdenv.cc.libc
else pkgs.netbsd.getent;
darwin = pkgs.netbsd.getent;
};