Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchurl, 5}: 6 7# Note: this package is used for bootstrapping fetchurl, and thus 8# cannot use fetchpatch! All mutable patches (generated by GitHub or 9# cgit) that are needed here should be included directly in Nixpkgs as 10# files. 11 12stdenv.mkDerivation rec { 13 pname = "keyutils"; 14 version = "1.6.3"; 15 16 src = fetchurl { 17 url = "https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/keyutils.git/snapshot/${pname}-${version}.tar.gz"; 18 sha256 = "sha256-ph1XBhNq5MBb1I+GGGvP29iN2L1RB+Phlckkz8Gzm7Q="; 19 }; 20 21 patches = [ 22 ./conf-symlink.patch 23 # This patch solves a duplicate symbol error when building with a clang stdenv 24 # Before removing this patch, please ensure the package still builds by running eg. 25 # nix-build -E 'with import ./. {}; pkgs.keyutils.override { stdenv = pkgs.clangStdenv; }' 26 ./0001-Remove-unused-function-after_eq.patch 27 28 ./pkg-config-static.patch 29 30 # Fix build for s390-linux, where size_t is different from ptrdiff_t. 31 (fetchurl { 32 url = "https://lore.kernel.org/keyrings/20230301134250.301819-1-hi@alyssa.is/raw"; 33 sha256 = "1cbgwxq28fw5ldh38ngcs7xiqvpnmrw0hw9zzhbhb1hdxkavrc1s"; 34 }) 35 ]; 36 37 makeFlags = lib.optionals stdenv.hostPlatform.isStatic "NO_SOLIB=1"; 38 39 outputs = [ 40 "out" 41 "lib" 42 "dev" 43 "man" 44 ]; 45 46 postPatch = '' 47 # https://github.com/archlinux/svntogit-packages/blob/packages/keyutils/trunk/reproducible.patch 48 substituteInPlace Makefile \ 49 --replace \ 50 'VCPPFLAGS := -DPKGBUILD="\"$(shell date -u +%F)\""' \ 51 'VCPPFLAGS := -DPKGBUILD="\"$(date -ud "@$SOURCE_DATE_EPOCH" +%F)\""' 52 ''; 53 54 enableParallelBuilding = true; 55 56 env = lib.optionalAttrs (stdenv.hostPlatform.useLLVM) { 57 NIX_LDFLAGS = "--undefined-version"; 58 }; 59 60 installFlags = [ 61 "ETCDIR=$(out)/etc" 62 "BINDIR=$(out)/bin" 63 "SBINDIR=$(out)/sbin" 64 "SHAREDIR=$(out)/share/keyutils" 65 "MANDIR=$(out)/share/man" 66 "INCLUDEDIR=$(dev)/include" 67 "LIBDIR=$(lib)/lib" 68 "USRLIBDIR=$(lib)/lib" 69 ]; 70 71 meta = with lib; { 72 homepage = "https://people.redhat.com/dhowells/keyutils/"; 73 description = "Tools used to control the Linux kernel key management system"; 74 license = licenses.gpl2Plus; 75 platforms = platforms.linux; 76 }; 77}