tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
prl-tools: add package
Nikolay Amiantov
11 years ago
3c8fe179
ea49ac04
+207
3 changed files
expand all
collapse all
unified
split
pkgs
os-specific
linux
prl-tools
autostart.desktop
default.nix
top-level
all-packages.nix
+8
pkgs/os-specific/linux/prl-tools/autostart.desktop
···
1
1
+
[Desktop Entry]
2
2
+
Version=@version@
3
3
+
Encoding=UTF-8
4
4
+
Name=@description@
5
5
+
Type=Application
6
6
+
Exec=@exec@
7
7
+
X-KDE-autostart-phase=1
8
8
+
GenericName[en_US]=
+197
pkgs/os-specific/linux/prl-tools/default.nix
···
1
1
+
{ stdenv, lib, requireFile, makeWrapper, substituteAll, p7zip
2
2
+
, gawk, utillinux, xorg, glib, dbus_glib, zlib
3
3
+
, kernel ? null, libsOnly ? false
4
4
+
}:
5
5
+
6
6
+
assert (!libsOnly) -> kernel != null;
7
7
+
8
8
+
let xorgFullVer = (builtins.parseDrvName xorg.xorgserver.name).version;
9
9
+
xorgVer = lib.concatStringsSep "." (lib.take 2 (lib.splitString "." xorgFullVer));
10
10
+
x64 = if stdenv.system == "x86_64-linux" then true
11
11
+
else if stdenv.system == "i686-linux" then false
12
12
+
else abort "Parallels Tools for Linux only support {x86-64,i686}-linux targets";
13
13
+
# We autostart user services by ourselves, because prlcc uses hardcoded paths.
14
14
+
autostart = [ { exec = "prlcc";
15
15
+
description = "Parallels Control Center";
16
16
+
}
17
17
+
{ exec = "prldhd";
18
18
+
description = "Parallels Control Center"; # not a mistake
19
19
+
}
20
20
+
{ exec = "prl_wmouse_d";
21
21
+
description = "Parallels Walking Mouse Daemon";
22
22
+
}
23
23
+
{ exec = "prlcp";
24
24
+
description = "Parallels CopyPaste Tool";
25
25
+
}
26
26
+
{ exec = "prlsga";
27
27
+
description = "Parallels Shared Guest Applications Tool";
28
28
+
}
29
29
+
{ exec = "prlshprof";
30
30
+
description = "Parallels Shared Profile Tool";
31
31
+
}
32
32
+
];
33
33
+
in
34
34
+
stdenv.mkDerivation rec {
35
35
+
version = "10.0.2.27712";
36
36
+
name = "prl-tools-${version}";
37
37
+
38
38
+
src = requireFile rec {
39
39
+
name = "prl-tools-lin.iso";
40
40
+
sha256 = "07960jvyv7gihjlg922znjm6db6l6bd23x9mg6ympwibzf2mylmx";
41
41
+
message = ''
42
42
+
Please, place Parallel Tools for Linux image into Nix store
43
43
+
using either
44
44
+
nix-store --add-fixed sha256 ${name}
45
45
+
or
46
46
+
nix-prefetch-url file://path/to/${name}
47
47
+
'';
48
48
+
};
49
49
+
50
50
+
# also maybe python2 to generate xorg.conf
51
51
+
nativeBuildInputs = [ p7zip ] ++ lib.optionals (!libsOnly) [ makeWrapper ];
52
52
+
53
53
+
inherit libsOnly;
54
54
+
55
55
+
unpackPhase = ''
56
56
+
7z x $src
57
57
+
export sourceRoot=.
58
58
+
if test -z "$libsOnly"; then
59
59
+
( cd kmods; tar -xaf prl_mod.tar.gz )
60
60
+
fi
61
61
+
( cd tools; tar -xaf prltools${if x64 then ".x64" else ""}.tar.gz )
62
62
+
'';
63
63
+
64
64
+
kernelVersion = if libsOnly then "" else (builtins.parseDrvName kernel.name).version;
65
65
+
kernelDir = if libsOnly then "" else "${kernel.dev}/lib/modules/${kernelVersion}";
66
66
+
scriptPath = lib.concatStringsSep ":" (lib.optionals (!libsOnly) [ "${utillinux}/bin" "${gawk}/bin" ]);
67
67
+
68
68
+
buildPhase = ''
69
69
+
if test -z "$libsOnly"; then
70
70
+
( # kernel modules
71
71
+
cd kmods
72
72
+
make -f Makefile.kmods \
73
73
+
KSRC=$kernelDir/source \
74
74
+
HEADERS_CHECK_DIR=$kernelDir/source \
75
75
+
KERNEL_DIR=$kernelDir/build \
76
76
+
SRC=$kernelDir/build \
77
77
+
KVER=$kernelVersion
78
78
+
)
79
79
+
80
80
+
# Xorg config (maybe would be useful for other versions)
81
81
+
#python2 installer/xserver-config.py xorg ${xorgVer} /dev/null parallels.conf
82
82
+
fi
83
83
+
'';
84
84
+
85
85
+
libPath = with xorg;
86
86
+
stdenv.lib.makeLibraryPath ([ stdenv.gcc.gcc libXrandr libXext libX11 libXcomposite libXinerama ]
87
87
+
++ lib.optionals (!libsOnly) [ libXi glib dbus_glib zlib ]);
88
88
+
89
89
+
desktops = map (x: substituteAll ({
90
90
+
src = ./autostart.desktop;
91
91
+
name = x.exec + ".desktop";
92
92
+
version = version;
93
93
+
} // x)) autostart;
94
94
+
95
95
+
installPhase = ''
96
96
+
if test -z "$libsOnly"; then
97
97
+
( # kernel modules
98
98
+
cd kmods
99
99
+
mkdir -p $out/lib/modules/${kernelVersion}/extra
100
100
+
cp prl_eth/pvmnet/prl_eth.ko $out/lib/modules/${kernelVersion}/extra
101
101
+
cp prl_tg/Toolgate/Guest/Linux/prl_tg/prl_tg.ko $out/lib/modules/${kernelVersion}/extra
102
102
+
cp prl_fs/SharedFolders/Guest/Linux/prl_fs/prl_fs.ko $out/lib/modules/${kernelVersion}/extra
103
103
+
cp prl_fs_freeze/Snapshot/Guest/Linux/prl_freeze/prl_fs_freeze.ko $out/lib/modules/${kernelVersion}/extra
104
104
+
)
105
105
+
fi
106
106
+
107
107
+
( # tools
108
108
+
cd tools
109
109
+
mkdir -p $out/lib
110
110
+
111
111
+
if test -z "$libsOnly"; then
112
112
+
# install binaries
113
113
+
for i in bin/* sbin/prl_nettool sbin/prl_snapshot; do
114
114
+
install -Dm755 $i $out/$i
115
115
+
done
116
116
+
# other binaries
117
117
+
for i in xorg.7.1/usr/bin/*; do
118
118
+
cp $i $out/bin
119
119
+
done
120
120
+
121
121
+
for i in $out/bin/* $out/sbin/*; do
122
122
+
patchelf \
123
123
+
--interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
124
124
+
--set-rpath "$out/lib:$libPath" \
125
125
+
$i
126
126
+
done
127
127
+
128
128
+
mkdir -p $out/bin
129
129
+
install -Dm755 ../installer/prlfsmountd.sh $out/sbin/prlfsmountd
130
130
+
wrapProgram $out/sbin/prlfsmountd \
131
131
+
--prefix PATH ':' "$scriptPath"
132
132
+
133
133
+
for i in lib/*.a; do
134
134
+
cp $i $out/lib
135
135
+
done
136
136
+
137
137
+
for i in xorg.7.1/usr/lib/libprl_wmouse_watcher.*; do
138
138
+
cp $i $out/lib
139
139
+
done
140
140
+
141
141
+
mkdir -p $out/lib/udev/rules.d
142
142
+
for i in *.rules; do
143
143
+
sed 's,/bin/bash,${stdenv.shell},g' $i > $out/lib/udev/rules.d/$i
144
144
+
done
145
145
+
146
146
+
mkdir -p $out/share/autostart
147
147
+
for i in $desktops; do
148
148
+
cat $i | sed "s,^Exec=,Exec=$out/bin/," > $out/share/autostart/$(basename $i)
149
149
+
done
150
150
+
151
151
+
(
152
152
+
cd xorg.${xorgVer}
153
153
+
# Install the X modules.
154
154
+
(
155
155
+
cd x-server/modules
156
156
+
for i in */*; do
157
157
+
install -Dm755 $i $out/lib/xorg/modules/$i
158
158
+
done
159
159
+
)
160
160
+
(
161
161
+
cd usr/lib
162
162
+
libGLXname=$(echo libglx.so*)
163
163
+
install -Dm755 $libGLXname $out/lib/xorg/modules/extensions/$libGLXname
164
164
+
ln -s $libGLXname $out/lib/xorg/modules/extensions/libglx.so
165
165
+
ln -s $libGLXname $out/lib/xorg/modules/extensions/libglx.so.1
166
166
+
)
167
167
+
)
168
168
+
fi
169
169
+
170
170
+
for i in xorg.7.1/usr/lib/libGL.*; do
171
171
+
cp $i $out/lib
172
172
+
done
173
173
+
174
174
+
cd $out
175
175
+
find -name \*.so\* -type f -exec \
176
176
+
patchelf --set-rpath "$out/lib:$libPath" {} \;
177
177
+
178
178
+
cd lib
179
179
+
libGLname=$(echo libGL.so*)
180
180
+
ln -s $libGLname libGL.so
181
181
+
ln -s $libGLname libGL.so.1
182
182
+
)
183
183
+
'';
184
184
+
185
185
+
dontStrip = true;
186
186
+
dontPatchELF = true;
187
187
+
188
188
+
meta = with stdenv.lib; {
189
189
+
description = "Parallels Tools for Linux guests";
190
190
+
homepage = http://parallels.com;
191
191
+
platforms = platforms.linux;
192
192
+
license = licenses.unfree;
193
193
+
# I was making this package blindly and requesting testing from the real user,
194
194
+
# so I can't even test it by myself and won't provide future updates.
195
195
+
maintainers = with maintainers; [ abbradar ];
196
196
+
};
197
197
+
}
+2
pkgs/top-level/all-packages.nix
···
8290
8290
8291
8291
perf = callPackage ../os-specific/linux/kernel/perf.nix { };
8292
8292
8293
8293
+
prl-tools = callPackage ../os-specific/linux/prl-tools { };
8294
8294
+
8293
8295
psmouse_alps = callPackage ../os-specific/linux/psmouse-alps { };
8294
8296
8295
8297
seturgent = callPackage ../os-specific/linux/seturgent { };