-
-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathdefault.nix
More file actions
207 lines (185 loc) · 5.33 KB
/
Copy pathdefault.nix
File metadata and controls
207 lines (185 loc) · 5.33 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
{
lib,
stdenv,
fetchgit,
perl540,
glib,
json_c,
pkgconf,
libsysprof-capture,
pcre2,
makeWrapper,
proxmox-backup-client,
pve-apiclient,
pve-cluster,
pve-common,
pve-edk2-firmware,
pve-firewall,
pve-guest-common,
pve-qemu,
pve-storage,
util-linux,
uuid,
findbin,
termreadline,
socat,
conntrack-tools,
vncterm,
swtpm,
libglvnd,
pve-update-script,
python3Packages,
}:
let
perlDeps = with perl540.pkgs; [
CryptOpenSSLRandom
ClassMethodMaker
DataDumper
DigestSHA
FilePath
findbin
HTTPMessage
GetoptLong
IO
IOMultiplex
IOSocketIP
JSON
MIMEBase64
NetSSLeay
PathTools
pve-apiclient
pve-cluster
pve-common
pve-firewall
pve-guest-common
pve-storage
ScalarListUtils
Socket
Storable
termreadline
TestHarness
TestMockModule
TestMore
TimeHiRes
uuid
XMLLibXML
];
perlEnv = perl540.withPackages (_: perlDeps);
perlLibPath = lib.makeSearchPath "${perl540.libPrefix}/${perl540.version}" perlDeps;
in
perl540.pkgs.toPerlModule (
stdenv.mkDerivation rec {
pname = "pve-qemu-server";
version = "9.1.4";
src = fetchgit {
url = "git://git.proxmox.com/git/qemu-server.git";
rev = "29ea3d0c10b2cd8b426a0a2f8f4dd5c90929be39";
hash = "sha256-cxX+D2g9FayzI4zdYXe/924qedyKfOfD9+xJG+LvMxI=";
};
sourceRoot = "${src.name}/src";
postPatch = ''
sed -i {qmeventd/,bin/}Makefile \
-e "/GITVERSION/d" \
-e "/default.mk/d" \
-e "/pve-doc-generator/d" \
-e "/install -m 0644 -D qm.bash-completion/,+3d" \
-e "/install -m 0644 qm.1/,+4d" \
-e "s/qmeventd docs/qmeventd/" \
-e "/qmeventd.8/d" \
-e "/modules-load.conf/d" \
-e "s,usr/,,g"
# Fix QEMU version check
sed -i PVE/QemuServer/Helpers.pm -e "s/\[,\\\s\]//"
# Fix libGL and libEGL detection
sed -i PVE/QemuServer.pm -e "s|/usr/lib/x86_64-linux-gnu/lib|${libglvnd}/lib/lib|"
'';
buildInputs = [
glib
json_c
pkgconf
makeWrapper
perlEnv
libsysprof-capture
pcre2
];
propagatedBuildInputs = perlDeps;
dontPatchShebangs = true;
dontBuild = true;
# Create missing dirs
preInstall = ''
mkdir -p $out/lib/systemd/system
mkdir -p $out/share/dbus-1/system.d
'';
installPhase = ''
runHook preInstall
make install \
PKGSOURCES="qm qmrestore qmextract" \
DESTDIR=$out \
PREFIX= \
SBINDIR=/.bin \
USRSHAREDIR=$out/share/qemu-server \
PERLDIR=/${perl540.libPrefix}/${perl540.version}
runHook postInstall
'';
postFixup = ''
mv "$out"/usr/lib/systemd/system/* "$out/lib/systemd/system/"
mv "$out"/usr/share/dbus-1/system.d/* "$out/share/dbus-1/system.d/"
find $out/lib $out/libexec -type f | xargs sed -i \
-e "/ENV{'PATH'}/d" \
-e "s|/usr/lib/qemu-server|$out/lib/qemu-server|" \
-e "s|/usr/libexec/qemu-server|$out/libexec/qemu-server|" \
-e "s|/usr/share/qemu-server|$out/share/qemu-server|" \
-e "s|/usr/share/kvm|${pve-qemu}/share/qemu|" \
-Ee "s|(/usr)?/s?bin/kvm|qemu-kvm|" \
-Ee "s|(/usr)?/s?bin/||" \
-e "s|socat|${socat}/bin/socat|" \
-e "s|vncterm|${vncterm}/bin/vncterm|" \
-e "s|qemu-kvm|${pve-qemu}/bin/qemu-kvm|" \
-e "s|qemu-system|${pve-qemu}/bin/qemu-system|" \
-e "s|/var/lib/qemu-server|$out/lib/qemu-server|" \
-e "s|/usr/share/pve-edk2-firmware|${pve-edk2-firmware}/usr/share/pve-edk2-firmware|" \
-e 's|/etc/swtpm_setup.conf|${swtpm}/etc/swtpm_setup.conf|' \
-e "s|virt-fw-vars|${python3Packages.virt-firmware}/bin/virt-fw-vars|g" \
#-e "s|/usr/bin/proxmox-backup-client|${proxmox-backup-client}/bin/proxmox-backup-client|" \
#-e "s|/usr/sbin/qm|$out/bin/qm|" \
#-e "s|/usr/bin/qemu|${pve-qemu}/bin/qemu|" \
#-e "s|/usr/bin/taskset|${util-linux}/bin/taskset|" \
#-e "s|/usr/bin/vncterm||" \
#-e "s|/usr/bin/termproxy||" \
#-e "s|/usr/bin/vma||" \
#-e "s|/usr/bin/pbs-restore||" \
find $out/lib/systemd/system -type f | xargs sed -i \
-e "s|/usr/libexec/qemu-server|$out/libexec/qemu-server|"
patchShebangs $out/.bin/
patchShebangs $out/lib/
patchShebangs $out/libexec/
find $out/.bin $out/libexec/qemu-server -type f -executable ! -name dbus-vmstate | while read -r bin; do
wrapProgram "$bin" \
--prefix PATH : ${lib.makeBinPath [ pve-qemu ]} \
--prefix PERL5LIB : $out/${perl540.libPrefix}/${perl540.version}:${perlLibPath}
done
wrapProgram $out/libexec/qemu-server/dbus-vmstate \
--prefix PATH : ${lib.makeBinPath [
conntrack-tools
pve-qemu
]} \
--prefix PERL5LIB : $out/${perl540.libPrefix}/${perl540.version}:${perlLibPath}
'';
passthru.updateScript = pve-update-script {
extraArgs = [
"--deb-name"
"qemu-server"
];
};
meta = with lib; {
description = "Proxmox VE's Virtual Machine Manager";
homepage = "https://git.proxmox.com/?p=qemu-server.git";
license = licenses.agpl3Plus;
maintainers = with maintainers; [
camillemndn
julienmalka
];
platforms = platforms.linux;
};
}
)