generated from nix-community/nur-packages-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapt.nix
117 lines (109 loc) · 3.11 KB
/
apt.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
{ 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"}"
];
# dont use /nix/store for these paths
# dont create these paths: /etc/apt/apt.conf.d ...
# TODO substituteInPlace with regex? or perl regex?
# TODO allow to pass multiple paths instead of $out/libexec/apt
# so we can use more handlers than /libexec/apt/methods/http etc
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace '"''${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/lib/apt"' '"/var/lib/apt"' \
--replace '"''${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/cache/apt"' '/var/cache/apt' \
--replace '"''${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/log/apt"' '/var/log/apt' \
--replace '"''${CMAKE_INSTALL_FULL_SYSCONFDIR}/apt"' '/etc/apt' \
--replace '"''${CMAKE_INSTALL_FULL_LIBEXECDIR}/apt"' "$out/libexec/apt" \
--replace $' ''${CONF_DIR}/apt.conf.d\n' "" \
--replace $' ''${CONF_DIR}/auth.conf.d\n' "" \
--replace $' ''${CONF_DIR}/preferences.d\n' "" \
--replace $' ''${CONF_DIR}/sources.list.d\n' "" \
--replace $' ''${CONF_DIR}/trusted.gpg.d\n' "" \
--replace $' ''${CACHE_DIR}/archives/partial\n' "" \
--replace $' ''${STATE_DIR}/lists/partial\n' "" \
--replace $' ''${STATE_DIR}/mirrors/partial\n' "" \
--replace $' ''${STATE_DIR}/periodic\n' "" \
--replace $' ''${LOG_DIR}\n' "" \
--replace $'\n# Create our directories.\ninstall_empty_directories(\n)\n' ""
substituteInPlace apt-pkg/init.cc \
--replace \
'Cnf.CndSet("APT::Sandbox::User", "_apt");' \
'Cnf.CndSet("APT::Sandbox::User", "nobody");'
'';
meta = with lib; {
homepage = "https://salsa.debian.org/apt-team/apt";
description = "Command-line package management tools used on Debian-based systems [fixed default config path /etc/apt]";
changelog = "https://salsa.debian.org/apt-team/apt/-/raw/${version}/debian/changelog";
license = licenses.gpl2Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ ];
};
}