nixpkgs-suyu/pkgs/os-specific/linux/keyutils/default.nix
Alyssa Ross ecc1ec2c72 llvmPackages_latest: move to aliases.nix
Because llvmPackages_latest is used in Nixpkgs, by quite a few
packages, it's difficult to keep it up to date, because updating it
requires some level of confidence that every package that uses it is
going to keep working after the update.  The result of this is that
llvmPackages_latest is not updated, and so we end up in the situation
that "latest" is two versions older than the latest version we
actually provide.  This is confusing and unexpected.

"But won't this end up fragmenting our LLVM versions, if every package
previously using _latest is separately pinned to LLVM 14?", I hear you
ask.  No.  That fragmentation is already happening, even with an
llvmPackages_latest, because packages that actually require the
_latest_ version of LLVM (15/16), have already been decoupled from
llvmPackages_latest since it hasn't been upgraded.  So like it or not,
we can't escape packages depending on specific recent LLVMs.  The only
real fix is to get better at keeping the default LLVM up to
date (which I'm reasonably confident we're getting into a better
position to be feasibly better able to do).

So, unless we want to double down on providing a confusingly named
"llvmPackages_latest" attribute that refers to some arbitrary LLVM
version that's probably not the latest one (or even the latest one
available in Nixpkgs), we only have two options here: either we don't
provide such an attribute at all, or we don't use it in Nixpkgs so we
don't become scared to bump it as soon as we have a new LLVM available.
2023-05-08 13:05:33 +00:00

62 lines
2 KiB
Nix

{ lib, stdenv, fetchurl }:
# Note: this package is used for bootstrapping fetchurl, and thus
# cannot use fetchpatch! All mutable patches (generated by GitHub or
# cgit) that are needed here should be included directly in Nixpkgs as
# files.
stdenv.mkDerivation rec {
pname = "keyutils";
version = "1.6.3";
src = fetchurl {
url = "https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/keyutils.git/snapshot/${pname}-${version}.tar.gz";
sha256 = "sha256-ph1XBhNq5MBb1I+GGGvP29iN2L1RB+Phlckkz8Gzm7Q=";
};
patches = [
./conf-symlink.patch
# This patch solves a duplicate symbol error when building with a clang stdenv
# Before removing this patch, please ensure the package still builds by running eg.
# nix-build -E 'with import ./. {}; pkgs.keyutils.override { stdenv = pkgs.clangStdenv; }'
./0001-Remove-unused-function-after_eq.patch
# Fix build for s390-linux, where size_t is different from ptrdiff_t.
(fetchurl {
url = "https://lore.kernel.org/keyrings/20230301134250.301819-1-hi@alyssa.is/raw";
sha256 = "1cbgwxq28fw5ldh38ngcs7xiqvpnmrw0hw9zzhbhb1hdxkavrc1s";
})
];
makeFlags = lib.optionals stdenv.hostPlatform.isStatic "NO_SOLIB=1";
outputs = [ "out" "lib" "dev" ];
postPatch = ''
# https://github.com/archlinux/svntogit-packages/blob/packages/keyutils/trunk/reproducible.patch
substituteInPlace Makefile \
--replace \
'VCPPFLAGS := -DPKGBUILD="\"$(shell date -u +%F)\""' \
'VCPPFLAGS := -DPKGBUILD="\"$(date -ud "@$SOURCE_DATE_EPOCH" +%F)\""'
'';
enableParallelBuilding = true;
installFlags = [
"ETCDIR=$(out)/etc"
"BINDIR=$(out)/bin"
"SBINDIR=$(out)/sbin"
"SHAREDIR=$(out)/share/keyutils"
"MANDIR=$(out)/share/man"
"INCLUDEDIR=$(dev)/include"
"LIBDIR=$(lib)/lib"
"USRLIBDIR=$(lib)/lib"
];
meta = with lib; {
homepage = "https://people.redhat.com/dhowells/keyutils/";
description = "Tools used to control the Linux kernel key management system";
license = licenses.gpl2Plus;
platforms = platforms.linux;
};
}