1{
2 config,
3 lib,
4 ...
5}:
6
7with lib;
8
9let
10 prl-tools = config.hardware.parallels.package;
11in
12
13{
14
15 imports = [
16 (mkRemovedOptionModule [
17 "hardware"
18 "parallels"
19 "autoMountShares"
20 ] "Shares are always automatically mounted since Parallels Desktop 20.")
21 ];
22
23 options = {
24 hardware.parallels = {
25
26 enable = mkOption {
27 type = types.bool;
28 default = false;
29 description = ''
30 This enables Parallels Tools for Linux guests, along with provided
31 video, mouse and other hardware drivers.
32 '';
33 };
34
35 package = mkOption {
36 type = types.nullOr types.package;
37 default = config.boot.kernelPackages.prl-tools;
38 defaultText = "config.boot.kernelPackages.prl-tools";
39 example = literalExpression "config.boot.kernelPackages.prl-tools";
40 description = ''
41 Defines which package to use for prl-tools. Override to change the version.
42 '';
43 };
44 };
45
46 };
47
48 config = mkIf config.hardware.parallels.enable {
49
50 services.udev.packages = [ prl-tools ];
51
52 environment.systemPackages = [ prl-tools ];
53
54 boot.extraModulePackages = [ prl-tools ];
55
56 boot.kernelModules = [
57 "prl_tg"
58 ];
59
60 services.timesyncd.enable = false;
61
62 systemd.services.prltoolsd = {
63 description = "Parallels Tools Service";
64 wantedBy = [ "multi-user.target" ];
65 path = [ prl-tools ];
66 serviceConfig = {
67 ExecStart = "${prl-tools}/bin/prltoolsd -f";
68 PIDFile = "/var/run/prltoolsd.pid";
69 WorkingDirectory = "${prl-tools}/bin";
70 };
71 };
72
73 systemd.services.prlshprint = {
74 description = "Parallels Printing Tool";
75 wantedBy = [ "multi-user.target" ];
76 bindsTo = [ "cups.service" ];
77 path = [ prl-tools ];
78 serviceConfig = {
79 ExecStart = "${prl-tools}/bin/prlshprint";
80 WorkingDirectory = "${prl-tools}/bin";
81 };
82 };
83
84 systemd.user.services.prlcc = {
85 description = "Parallels Control Center";
86 wantedBy = [ "graphical-session.target" ];
87 path = [ prl-tools ];
88 serviceConfig = {
89 ExecStart = "${prl-tools}/bin/prlcc";
90 WorkingDirectory = "${prl-tools}/bin";
91 };
92 };
93 };
94
95 meta.maintainers = with maintainers; [ codgician ];
96}