glibc: split getent into its own output

Many dependents only require getent and not all the locale generation
tools that are included in the `bin` output. This can save some
closure size!
This commit is contained in:
Linus Heckemann 2023-05-22 19:53:52 +02:00
parent 4e036dd92e
commit 4d649f2b63
4 changed files with 14 additions and 4 deletions

View File

@ -26,6 +26,8 @@
- `mariadb` now defaults to `mariadb_1011` instead of `mariadb_106`, meaning the default version was upgraded from 10.6.x to 10.11.x. See the [upgrade notes](https://mariadb.com/kb/en/upgrading-from-mariadb-10-6-to-mariadb-10-11/) for potential issues.
- `getent` has been moved from `glibc`'s `bin` output to its own dedicated output, reducing closure size for many dependents. Dependents using the `getent` alias should not be affected; others should move from using `glibc.bin` or `getBin glibc` to `getent` (which also improves compatibility with non-glibc platforms).
- `etcd` has been updated to 3.5, you will want to read the [3.3 to 3.4](https://etcd.io/docs/v3.5/upgrades/upgrade_3_4/) and [3.4 to 3.5](https://etcd.io/docs/v3.5/upgrades/upgrade_3_5/) upgrade guides
- `himalaya` has been updated to `0.8.0`, which drops the native TLS support (in favor of Rustls) and add OAuth 2.0 support. See the [release note](https://github.com/soywod/himalaya/releases/tag/v0.8.0) for more details.

View File

@ -165,10 +165,18 @@ stdenv.mkDerivation ({
"OBJCOPY=${stdenv.cc.targetPrefix}objcopy"
];
postInstall = (args.postInstall or "") + ''
moveToOutput bin/getent $getent
'';
installFlags = [ "sysconfdir=$(out)/etc" ];
# out as the first output is an exception exclusive to glibc
outputs = [ "out" "bin" "dev" "static" ];
# getent is its own output, not kept in bin, since many things
# depend on getent but not on the locale generation tools in the bin
# output. This saves a couple of megabytes of closure size in many cases.
outputs = [ "out" "bin" "dev" "static" "getent" ];
strictDeps = true;
depsBuildBuild = [ buildPackages.stdenv.cc ];
@ -188,7 +196,7 @@ stdenv.mkDerivation ({
passthru = { inherit version; minorRelease = version; };
}
// (removeAttrs args [ "withLinuxHeaders" "withGd" ]) //
// (removeAttrs args [ "withLinuxHeaders" "withGd" "postInstall" ]) //
{
src = fetchurl {

View File

@ -94,7 +94,7 @@ in
"user-defined-trusted-dirs=${stdenv.cc.cc.libgcc}/lib"
];
postInstall = (if stdenv.hostPlatform == stdenv.buildPlatform then ''
postInstall = previousAttrs.postInstall + (if stdenv.hostPlatform == stdenv.buildPlatform then ''
echo SUPPORTED-LOCALES=C.UTF-8/UTF-8 > ../glibc-2*/localedata/SUPPORTED
make -j''${NIX_BUILD_CORES:-1} localedata/install-locales
'' else lib.optionalString stdenv.buildPlatform.isLinux ''

View File

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