apt: adopt and refactor

- finalAttrs design pattern
- split outputs
- remove nested with
This commit is contained in:
Anderson Torres
2023-11-22 16:09:50 -03:00
parent 4648a958e3
commit 18c71e751b
3 changed files with 98 additions and 89 deletions
+98
View File
@@ -0,0 +1,98 @@
{ lib
, stdenv
, fetchurl
, bzip2
, cmake
, curl
, db
, docbook_xml_dtd_45
, docbook_xsl
, doxygen
, dpkg
, gettext
, gnutls
, gtest
, libgcrypt
, libgpg-error
, libseccomp
, libtasn1
, libxslt
, lz4
, p11-kit
, perlPackages
, pkg-config
, triehash
, udev
, w3m
, xxHash
, xz
, zstd
, withDocs ? true
, withNLS ? true
}:
stdenv.mkDerivation (finalAttrs: {
pname = "apt";
version = "2.7.6";
src = fetchurl {
url = "mirror://debian/pool/main/a/apt/apt_${finalAttrs.version}.tar.xz";
hash = "sha256-hoP1Tv8L9U5R4CWzSL0HdND9Q3eZYW9IUSlWzxXAX2c=";
};
# cycle detection; lib can't be split
outputs = [ "out" "dev" "doc" "man" ];
nativeBuildInputs = [
cmake
gtest
(lib.getBin libxslt)
pkg-config
triehash
];
buildInputs = [
bzip2
curl
db
dpkg
gnutls
libgcrypt
libgpg-error
libseccomp
libtasn1
lz4
p11-kit
perlPackages.perl
udev
xxHash
xz
zstd
] ++ lib.optionals withDocs [
docbook_xml_dtd_45
doxygen
perlPackages.Po4a
w3m
] ++ lib.optionals withNLS [
gettext
];
cmakeFlags = [
(lib.cmakeOptionType "filepath" "BERKELEY_INCLUDE_DIRS" "${lib.getDev db}/include")
(lib.cmakeOptionType "filepath" "DOCBOOK_XSL""${docbook_xsl}/share/xml/docbook-xsl")
(lib.cmakeOptionType "filepath" "GNUTLS_INCLUDE_DIR" "${lib.getDev gnutls}/include")
(lib.cmakeFeature "DROOT_GROUP" "root")
(lib.cmakeBool "USE_NLS" withNLS)
(lib.cmakeBool "WITH_DOC" withDocs)
];
meta = {
homepage = "https://salsa.debian.org/apt-team/apt";
description = "Command-line package management tools used on Debian-based systems";
changelog = "https://salsa.debian.org/apt-team/apt/-/raw/${finalAttrs.version}/debian/changelog";
license = with lib.licenses; [ gpl2Plus ];
mainProgram = "apt";
maintainers = with lib.maintainers; [ AndersonTorres ];
platforms = lib.platforms.linux;
};
})
@@ -1,87 +0,0 @@
{ lib
, stdenv
, fetchurl
, bzip2
, cmake
, curl
, db
, docbook_xml_dtd_45
, docbook_xsl
, dpkg
, gnutls
, gtest
, libgcrypt
, libseccomp
, libtasn1
, libxslt
, lz4
, perlPackages
, pkg-config
, triehash
, udev
, xxHash
, xz
, zstd
, withDocs ? true , w3m, doxygen
, withNLS ? true , gettext
}:
stdenv.mkDerivation rec {
pname = "apt";
version = "2.7.6";
src = fetchurl {
url = "mirror://debian/pool/main/a/apt/apt_${version}.tar.xz";
hash = "sha256-hoP1Tv8L9U5R4CWzSL0HdND9Q3eZYW9IUSlWzxXAX2c=";
};
nativeBuildInputs = [
cmake
gtest
libxslt.bin
pkg-config
triehash
];
buildInputs = [
bzip2
curl
db
dpkg
gnutls
libgcrypt
libseccomp
libtasn1
lz4
perlPackages.perl
udev
xxHash
xz
zstd
] ++ lib.optionals withDocs [
docbook_xml_dtd_45
doxygen
perlPackages.Po4a
w3m
] ++ lib.optionals withNLS [
gettext
];
cmakeFlags = [
"-DBERKELEY_INCLUDE_DIRS=${db.dev}/include"
"-DDOCBOOK_XSL=${docbook_xsl}/share/xml/docbook-xsl"
"-DGNUTLS_INCLUDE_DIR=${gnutls.dev}/include"
"-DROOT_GROUP=root"
"-DUSE_NLS=${if withNLS then "ON" else "OFF"}"
"-DWITH_DOC=${if withDocs then "ON" else "OFF"}"
];
meta = with lib; {
homepage = "https://salsa.debian.org/apt-team/apt";
description = "Command-line package management tools used on Debian-based systems";
changelog = "https://salsa.debian.org/apt-team/apt/-/raw/${version}/debian/changelog";
license = licenses.gpl2Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ ];
};
}
-2
View File
@@ -40291,8 +40291,6 @@ with pkgs;
eiciel = callPackage ../tools/filesystems/eiciel { };
apt = callPackage ../tools/package-management/apt { };
apx = callPackage ../tools/package-management/apx { };
dpkg = callPackage ../tools/package-management/dpkg { };