Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib 2, stdenv 3, fetchpatch 4, fetchurl 5, asciidoc 6, binutils 7, coreutils 8, curl 9, gpgme 10, installShellFiles 11, libarchive 12, makeWrapper 13, meson 14, ninja 15, openssl 16, perl 17, pkg-config 18, zlib 19 20# Compression tools in scripts/libmakepkg/util/compress.sh.in 21, gzip 22, bzip2 23, xz 24, zstd 25, lrzip 26, lzop 27, ncompress 28, lz4 29, lzip 30 31# pacman-key runtime dependencies 32, gawk 33, gettext 34, gnugrep 35, gnupg 36 37# Tells pacman where to find ALPM hooks provided by packages. 38# This path is very likely to be used in an Arch-like root. 39, sysHookDir ? "/usr/share/libalpm/hooks/" 40}: 41 42stdenv.mkDerivation rec { 43 pname = "pacman"; 44 version = "6.0.2"; 45 46 src = fetchurl { 47 url = "https://sources.archlinux.org/other/${pname}/${pname}-${version}.tar.xz"; 48 hash = "sha256-fY4+jFEhrsCWXfcfWb7fRgUsbPFPljZcRBHsPeCkwaU="; 49 }; 50 51 nativeBuildInputs = [ 52 asciidoc 53 installShellFiles 54 makeWrapper 55 meson 56 ninja 57 pkg-config 58 ]; 59 60 buildInputs = [ 61 curl 62 gpgme 63 libarchive 64 openssl 65 perl 66 zlib 67 ]; 68 69 patches = [ 70 ./dont-create-empty-dirs.patch 71 # Add keyringdir meson option to configure the keyring directory 72 (fetchpatch { 73 url = "https://gitlab.archlinux.org/pacman/pacman/-/commit/79bd512181af12ec80fd8f79486fc9508fa4a1b3.patch"; 74 hash = "sha256-ivTPwWe06Q5shn++R6EY0x3GC0P4X0SuC+F5sndfAtM="; 75 }) 76 ]; 77 78 postPatch = let compressionTools = [ 79 gzip 80 bzip2 81 xz 82 zstd 83 lrzip 84 lzop 85 ncompress 86 lz4 87 lzip 88 ]; in '' 89 echo 'export PATH=${lib.makeBinPath compressionTools}:$PATH' >> scripts/libmakepkg/util/compress.sh.in 90 substituteInPlace meson.build \ 91 --replace "install_dir : SYSCONFDIR" "install_dir : '$out/etc'" \ 92 --replace "join_paths(DATAROOTDIR, 'libalpm/hooks/')" "'${sysHookDir}'" \ 93 --replace "join_paths(PREFIX, DATAROOTDIR, get_option('keyringdir'))" "'\$KEYRING_IMPORT_DIR'" 94 substituteInPlace doc/meson.build \ 95 --replace "/bin/true" "${coreutils}/bin/true" 96 substituteInPlace scripts/repo-add.sh.in \ 97 --replace bsdtar "${libarchive}/bin/bsdtar" 98 substituteInPlace scripts/pacman-key.sh.in \ 99 --replace "local KEYRING_IMPORT_DIR='@keyringdir@'" "" \ 100 --subst-var-by keyringdir '\$KEYRING_IMPORT_DIR' \ 101 --replace "--batch --check-trustdb" "--batch --check-trustdb --allow-weak-key-signatures" 102 ''; # the line above should be removed once Arch migrates to gnupg 2.3.x 103 104 mesonFlags = [ 105 "--sysconfdir=/etc" 106 "--localstatedir=/var" 107 ]; 108 109 postInstall = '' 110 installShellCompletion --bash scripts/pacman --zsh scripts/_pacman 111 wrapProgram $out/bin/makepkg \ 112 --prefix PATH : ${lib.makeBinPath [ binutils ]} 113 wrapProgram $out/bin/pacman-key \ 114 --prefix PATH : ${lib.makeBinPath [ 115 "${placeholder "out"}" 116 coreutils 117 gawk 118 gettext 119 gnugrep 120 gnupg 121 ]} 122 ''; 123 124 meta = with lib; { 125 description = "A simple library-based package manager"; 126 homepage = "https://archlinux.org/pacman/"; 127 changelog = "https://gitlab.archlinux.org/pacman/pacman/-/raw/v${version}/NEWS"; 128 license = licenses.gpl2Plus; 129 platforms = platforms.linux; 130 maintainers = with maintainers; [ samlukeyes123 ]; 131 }; 132}