mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-30 02:42:59 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
78 lines
2.3 KiB
Nix
78 lines
2.3 KiB
Nix
{ lib, stdenv, fetchurl, pkg-config
|
|
, libgcrypt, libgpg-error, libtasn1
|
|
|
|
# Optional Dependencies
|
|
, pam ? null, libidn ? null, gnutls ? null
|
|
}:
|
|
|
|
let
|
|
shouldUsePkg = pkg: if pkg != null && lib.meta.availableOn stdenv.hostPlatform pkg then pkg else null;
|
|
|
|
optPam = shouldUsePkg pam;
|
|
optLibidn = shouldUsePkg libidn;
|
|
optGnutls = shouldUsePkg gnutls;
|
|
|
|
inherit (lib) enableFeature withFeature optionalString;
|
|
in
|
|
stdenv.mkDerivation rec {
|
|
pname = "shishi";
|
|
version = "1.0.2";
|
|
|
|
src = fetchurl {
|
|
url = "mirror://gnu/shishi/shishi-${version}.tar.gz";
|
|
sha256 = "032qf72cpjdfffq1yq54gz3ahgqf2ijca4vl31sfabmjzq9q370d";
|
|
};
|
|
|
|
separateDebugInfo = true;
|
|
|
|
# Fixes support for gcrypt 1.6+
|
|
patches = [ ./gcrypt-fix.patch ./freebsd-unistd.patch ];
|
|
|
|
nativeBuildInputs = [ pkg-config ];
|
|
buildInputs = [ libgcrypt libgpg-error libtasn1 optPam optLibidn optGnutls ];
|
|
|
|
configureFlags = [
|
|
"--sysconfdir=/etc"
|
|
"--localstatedir=/var"
|
|
(enableFeature true "libgcrypt")
|
|
(enableFeature (optPam != null) "pam")
|
|
(enableFeature true "ipv6")
|
|
(withFeature (optLibidn != null) "stringprep")
|
|
(enableFeature (optGnutls != null) "starttls")
|
|
(enableFeature true "des")
|
|
(enableFeature true "3des")
|
|
(enableFeature true "aes")
|
|
(enableFeature true "md")
|
|
(enableFeature false "null")
|
|
(enableFeature true "arcfour")
|
|
];
|
|
|
|
env.NIX_CFLAGS_COMPILE
|
|
= optionalString stdenv.hostPlatform.isDarwin "-DBIND_8_COMPAT";
|
|
|
|
doCheck = true;
|
|
|
|
installFlags = [ "sysconfdir=\${out}/etc" ];
|
|
|
|
# Fix *.la files
|
|
postInstall = ''
|
|
sed -i $out/lib/libshi{sa,shi}.la \
|
|
'' + optionalString (optLibidn != null) ''
|
|
-e 's,\(-lidn\),-L${optLibidn.out}/lib \1,' \
|
|
'' + optionalString (optGnutls != null) ''
|
|
-e 's,\(-lgnutls\),-L${optGnutls.out}/lib \1,' \
|
|
'' + ''
|
|
-e 's,\(-lgcrypt\),-L${libgcrypt.out}/lib \1,' \
|
|
-e 's,\(-lgpg-error\),-L${libgpg-error.out}/lib \1,' \
|
|
-e 's,\(-ltasn1\),-L${libtasn1.out}/lib \1,'
|
|
'';
|
|
|
|
meta = with lib; {
|
|
homepage = "https://www.gnu.org/software/shishi/";
|
|
description = "Implementation of the Kerberos 5 network security system";
|
|
license = licenses.gpl3Plus;
|
|
maintainers = with maintainers; [ lovek323 ];
|
|
platforms = platforms.linux;
|
|
};
|
|
}
|