summary refs log tree commit diff
path: root/pkgs/os-specific/linux/systemd
diff options
context:
space:
mode:
authorWill Dietz <w@wdtz.org>2018-02-12 20:20:14 -0600
committerWill Dietz <w@wdtz.org>2018-02-13 09:45:05 -0600
commit8323123e95d2995933aa415ae90ae387b5ca2bc6 (patch)
tree8f1d7791b98563ea4014a93f66fbc1946846eeeb /pkgs/os-specific/linux/systemd
parent84a527ea5e8db2a1ec095ff95dd66d6271246bc4 (diff)
downloadnixlib-8323123e95d2995933aa415ae90ae387b5ca2bc6.tar
nixlib-8323123e95d2995933aa415ae90ae387b5ca2bc6.tar.gz
nixlib-8323123e95d2995933aa415ae90ae387b5ca2bc6.tar.bz2
nixlib-8323123e95d2995933aa415ae90ae387b5ca2bc6.tar.lz
nixlib-8323123e95d2995933aa415ae90ae387b5ca2bc6.tar.xz
nixlib-8323123e95d2995933aa415ae90ae387b5ca2bc6.tar.zst
nixlib-8323123e95d2995933aa415ae90ae387b5ca2bc6.zip
systemd: use musl-getent on musl instead of glibc.bin's getent
Diffstat (limited to 'pkgs/os-specific/linux/systemd')
-rw-r--r--pkgs/os-specific/linux/systemd/default.nix11
1 files changed, 9 insertions, 2 deletions
diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix
index 0a2ebb05277f..f8093921e6eb 100644
--- a/pkgs/os-specific/linux/systemd/default.nix
+++ b/pkgs/os-specific/linux/systemd/default.nix
@@ -7,11 +7,18 @@
 , autoreconfHook, gettext, docbook_xsl, docbook_xml_dtd_42, docbook_xml_dtd_45
 , ninja, meson, python3Packages, glibcLocales
 , patchelf
+, musl-getent ? null
 }:
 
 assert stdenv.isLinux;
 
-let pythonLxmlEnv = python3Packages.python.withPackages ( ps: with ps; [ python3Packages.lxml ]);
+let
+  pythonLxmlEnv = python3Packages.python.withPackages ( ps: with ps; [ python3Packages.lxml ]);
+  getent-bin =
+         if stdenv.hostPlatform.libc == "glibc" then stdenv.cc.libc.bin
+    else if stdenv.hostPlatform.isMusl then "${musl-getent}"
+    else throw "unsupported abi for systemd";
+  getent = "${getent-bin}/bin/getent";
 
 in
 
@@ -107,7 +114,7 @@ in
         for i in src/remount-fs/remount-fs.c src/core/mount.c src/core/swap.c src/fsck/fsck.c units/emergency.service.in units/rescue.service.in src/journal/cat.c src/core/shutdown.c src/nspawn/nspawn.c src/shared/generator.c; do
           test -e $i
           substituteInPlace $i \
-            --replace /usr/bin/getent ${stdenv.glibc.bin}/bin/getent \
+            --replace /usr/bin/getent ${getent} \
             --replace /sbin/swapon ${utillinux.bin}/sbin/swapon \
             --replace /sbin/swapoff ${utillinux.bin}/sbin/swapoff \
             --replace /sbin/fsck ${utillinux.bin}/sbin/fsck \