1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7
8with lib;
9
10let
11 prl-tools = config.hardware.parallels.package;
12in
13
14{
15
16 imports = [
17 (mkRemovedOptionModule [
18 "hardware"
19 "parallels"
20 "autoMountShares"
21 ] "Shares are always automatically mounted since Parallels Desktop 20.")
22 ];
23
24 options = {
25 hardware.parallels = {
26
27 enable = mkOption {
28 type = types.bool;
29 default = false;
30 description = ''
31 This enables Parallels Tools for Linux guests, along with provided
32 video, mouse and other hardware drivers.
33 '';
34 };
35
36 package = mkOption {
37 type = types.nullOr types.package;
38 default = config.boot.kernelPackages.prl-tools;
39 defaultText = "config.boot.kernelPackages.prl-tools";
40 example = literalExpression "config.boot.kernelPackages.prl-tools";
41 description = ''
42 Defines which package to use for prl-tools. Override to change the version.
43 '';
44 };
45 };
46
47 };
48
49 config = mkIf config.hardware.parallels.enable {
50
51 services.udev.packages = [ prl-tools ];
52
53 environment.systemPackages = [ prl-tools ];
54
55 boot.extraModulePackages = [ prl-tools ];
56
57 boot.kernelModules = [
58 "prl_fs"
59 "prl_fs_freeze"
60 "prl_tg"
61 ] ++ optional (pkgs.stdenv.hostPlatform.system == "aarch64-linux") "prl_notifier";
62
63 services.timesyncd.enable = false;
64
65 systemd.services.prltoolsd = {
66 description = "Parallels Tools Service";
67 wantedBy = [ "multi-user.target" ];
68 path = [ prl-tools ];
69 serviceConfig = {
70 ExecStart = "${prl-tools}/bin/prltoolsd -f";
71 PIDFile = "/var/run/prltoolsd.pid";
72 WorkingDirectory = "${prl-tools}/bin";
73 };
74 };
75
76 systemd.services.prlshprint = {
77 description = "Parallels Printing Tool";
78 wantedBy = [ "multi-user.target" ];
79 bindsTo = [ "cups.service" ];
80 path = [ prl-tools ];
81 serviceConfig = {
82 ExecStart = "${prl-tools}/bin/prlshprint";
83 WorkingDirectory = "${prl-tools}/bin";
84 };
85 };
86
87 systemd.user.services = {
88 prlcc = {
89 description = "Parallels Control Center";
90 wantedBy = [ "graphical-session.target" ];
91 path = [ prl-tools ];
92 serviceConfig = {
93 ExecStart = "${prl-tools}/bin/prlcc";
94 WorkingDirectory = "${prl-tools}/bin";
95 };
96 };
97 prldnd = {
98 description = "Parallels Drag And Drop Tool";
99 wantedBy = [ "graphical-session.target" ];
100 path = [ prl-tools ];
101 serviceConfig = {
102 ExecStart = "${prl-tools}/bin/prldnd";
103 WorkingDirectory = "${prl-tools}/bin";
104 };
105 };
106 prlcp = {
107 description = "Parallels Copy Paste Tool";
108 wantedBy = [ "graphical-session.target" ];
109 path = [ prl-tools ];
110 serviceConfig = {
111 ExecStart = "${prl-tools}/bin/prlcp";
112 Restart = "always";
113 WorkingDirectory = "${prl-tools}/bin";
114 };
115 };
116 prlsga = {
117 description = "Parallels Shared Guest Applications Tool";
118 wantedBy = [ "graphical-session.target" ];
119 path = [ prl-tools ];
120 serviceConfig = {
121 ExecStart = "${prl-tools}/bin/prlsga";
122 WorkingDirectory = "${prl-tools}/bin";
123 };
124 };
125 prlshprof = {
126 description = "Parallels Shared Profile Tool";
127 wantedBy = [ "graphical-session.target" ];
128 path = [ prl-tools ];
129 serviceConfig = {
130 ExecStart = "${prl-tools}/bin/prlshprof";
131 WorkingDirectory = "${prl-tools}/bin";
132 };
133 };
134 };
135
136 };
137}