summary refs log tree commit diff
path: root/pkgs/os-specific/linux/shadow
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2020-03-11 16:51:10 -0400
committerMilan <milan@petabyte.dev>2021-04-11 02:42:53 +0200
commitfbb26ab53694b5370d11a160e313ebda145b19e4 (patch)
tree452fb34ea2acbe083cfe46f8f55b6696fcfe6291 /pkgs/os-specific/linux/shadow
parent9e4a925caf5d5649686402b52815503bddadd457 (diff)
downloadnixpkgs-fbb26ab53694b5370d11a160e313ebda145b19e4.tar
nixpkgs-fbb26ab53694b5370d11a160e313ebda145b19e4.tar.gz
nixpkgs-fbb26ab53694b5370d11a160e313ebda145b19e4.tar.bz2
nixpkgs-fbb26ab53694b5370d11a160e313ebda145b19e4.tar.lz
nixpkgs-fbb26ab53694b5370d11a160e313ebda145b19e4.tar.xz
nixpkgs-fbb26ab53694b5370d11a160e313ebda145b19e4.tar.zst
nixpkgs-fbb26ab53694b5370d11a160e313ebda145b19e4.zip
shadow: add runtime-shell.patch
This gets the right shell in the closure.

By default, shadow wants to pull in the bash we are building it with,
while we would prefer it used the runtime bash.
Diffstat (limited to 'pkgs/os-specific/linux/shadow')
-rw-r--r--pkgs/os-specific/linux/shadow/default.nix7
-rw-r--r--pkgs/os-specific/linux/shadow/runtime-shell.patch13
2 files changed, 19 insertions, 1 deletions
diff --git a/pkgs/os-specific/linux/shadow/default.nix b/pkgs/os-specific/linux/shadow/default.nix
index 0ff6fa1f341..e20023b2b6e 100644
--- a/pkgs/os-specific/linux/shadow/default.nix
+++ b/pkgs/os-specific/linux/shadow/default.nix
@@ -1,5 +1,5 @@
 { lib, stdenv, nixosTests, fetchpatch, fetchFromGitHub, autoreconfHook, libxslt
-, libxml2 , docbook_xml_dtd_45, docbook_xsl, itstool, flex, bison
+, libxml2 , docbook_xml_dtd_45, docbook_xsl, itstool, flex, bison, runtimeShell
 , pam ? null, glibcCross ? null
 }:
 
@@ -38,8 +38,11 @@ stdenv.mkDerivation rec {
       # Obtain XML resources from XML catalog (patch adapted from gtk-doc)
       ./respect-xml-catalog-files-var.patch
       dots_in_usernames
+      ./runtime-shell.patch
     ];
 
+  RUNTIME_SHELL = runtimeShell;
+
   # The nix daemon often forbids even creating set[ug]id files.
   postPatch =
     ''sed 's/^\(s[ug]idperms\) = [0-9]755/\1 = 0755/' -i src/Makefile.am
@@ -77,6 +80,8 @@ stdenv.mkDerivation rec {
       mv $out/bin/su $su/bin
     '';
 
+  disallowedReferences = lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) stdenv.shellPackage;
+
   meta = with lib; {
     homepage = "https://github.com/shadow-maint";
     description = "Suite containing authentication-related tools such as passwd and su";
diff --git a/pkgs/os-specific/linux/shadow/runtime-shell.patch b/pkgs/os-specific/linux/shadow/runtime-shell.patch
new file mode 100644
index 00000000000..0b2e68e330e
--- /dev/null
+++ b/pkgs/os-specific/linux/shadow/runtime-shell.patch
@@ -0,0 +1,13 @@
+diff --git a/configure.ac b/configure.ac
+index e4c6aaec..03883ad7 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -682,7 +682,7 @@ if test "$enable_utmpx" = "yes"; then
+ 	          [Define if utmpx should be used])
+ fi
+ 
+-AC_DEFINE_UNQUOTED(SHELL, ["$SHELL"], [The default shell.])
++AC_DEFINE_UNQUOTED(SHELL, ["$RUNTIME_SHELL"], [The runtime shell.])
+ 
+ AM_GNU_GETTEXT_VERSION(0.16)
+ AM_GNU_GETTEXT([external], [need-ngettext])