shadow: cleanup

This commit is contained in:
Izorkin 2022-12-17 08:09:41 +03:00
parent 0e32191623
commit 05046655d8
No known key found for this signature in database
GPG Key ID: 1436C1B3F3679F09

View File

@ -1,14 +1,16 @@
{ lib, stdenv, nixosTests, fetchpatch, fetchFromGitHub, autoreconfHook, libxslt
, libxml2 , docbook_xml_dtd_45, docbook_xsl, itstool, flex, bison, runtimeShell
, libxcrypt, pam ? null, glibcCross ? null
{ lib, stdenv, fetchFromGitHub
, runtimeShell, nixosTests, fetchpatch
, autoreconfHook, bison, flex
, docbook_xml_dtd_45, docbook_xsl
, itstool , libxml2, libxslt
, libxcrypt
, glibcCross ? null
, pam ? null
, withTcb ? stdenv.isLinux, tcb
}:
let
glibc =
if stdenv.hostPlatform != stdenv.buildPlatform
then glibcCross
if stdenv.hostPlatform != stdenv.buildPlatform then glibcCross
else assert stdenv.hostPlatform.libc == "glibc"; stdenv.cc.libc;
in
@ -24,12 +26,19 @@ stdenv.mkDerivation rec {
sha256 = "sha256-L54DhdBYthfB9436t/XWXiqKhW7rfd0GLS7pYGB32rA=";
};
outputs = [ "out" "su" "dev" "man" ];
RUNTIME_SHELL = runtimeShell;
nativeBuildInputs = [
autoreconfHook bison flex
docbook_xml_dtd_45 docbook_xsl
itstool libxml2 libxslt
];
buildInputs = [ libxcrypt ]
++ lib.optional (pam != null && stdenv.isLinux) pam
++ lib.optional withTcb tcb;
nativeBuildInputs = [autoreconfHook libxslt libxml2
docbook_xml_dtd_45 docbook_xsl flex bison itstool
];
patches = [
./keep-path.patch
@ -44,16 +53,10 @@ stdenv.mkDerivation rec {
})
];
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
'';
outputs = [ "out" "su" "dev" "man" ];
enableParallelBuilding = true;
postPatch = ''
sed 's/^\(s[ug]idperms\) = [0-9]755/\1 = 0755/' -i src/Makefile.am
'';
# Assume System V `setpgrp (void)', which is the default on GNU variants
# (`AC_FUNC_SETPGRP' is not cross-compilation capable.)
@ -70,21 +73,21 @@ stdenv.mkDerivation rec {
] ++ lib.optional (stdenv.hostPlatform.libc != "glibc") "--disable-nscd"
++ lib.optional withTcb "--with-tcb";
preBuild = lib.optionalString (stdenv.hostPlatform.libc == "glibc")
''
substituteInPlace lib/nscd.c --replace /usr/sbin/nscd ${glibc.bin}/bin/nscd
'';
preBuild = lib.optionalString (stdenv.hostPlatform.libc == "glibc") ''
substituteInPlace lib/nscd.c --replace /usr/sbin/nscd ${glibc.bin}/bin/nscd
'';
postInstall =
''
# Don't install groups, since coreutils already provides it.
rm $out/bin/groups
rm $man/share/man/man1/groups.*
postInstall = ''
# Don't install groups, since coreutils already provides it.
rm $out/bin/groups
rm $man/share/man/man1/groups.*
# Move the su binary into the su package
mkdir -p $su/bin
mv $out/bin/su $su/bin
'';
# Move the su binary into the su package
mkdir -p $su/bin
mv $out/bin/su $su/bin
'';
enableParallelBuilding = true;
disallowedReferences = lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) stdenv.shellPackage;