nixpkgs/nixos/modules/virtualisation/parallels-guest.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

146 lines
4.4 KiB
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
2014-11-11 00:32:05 +01:00
with lib;
let
prl-tools = config.hardware.parallels.package;
2014-11-11 00:32:05 +01:00
in
{
options = {
hardware.parallels = {
enable = mkOption {
type = types.bool;
default = false;
description = lib.mdDoc ''
2015-09-15 08:01:02 +02:00
This enables Parallels Tools for Linux guests, along with provided
2014-11-11 00:32:05 +01:00
video, mouse and other hardware drivers.
'';
};
autoMountShares = mkOption {
type = types.bool;
default = true;
description = lib.mdDoc ''
Control prlfsmountd service. When this service is running, shares can not be manually
mounted through `mount -t prl_fs ...` as this service will remount and trample any set options.
Recommended to enable for simple file sharing, but extended share use such as for code should
disable this to manually mount shares.
'';
};
package = mkOption {
type = types.nullOr types.package;
default = config.boot.kernelPackages.prl-tools;
defaultText = "config.boot.kernelPackages.prl-tools";
example = literalExpression "config.boot.kernelPackages.prl-tools";
description = lib.mdDoc ''
Defines which package to use for prl-tools. Override to change the version.
'';
};
2014-11-11 00:32:05 +01:00
};
};
config = mkIf config.hardware.parallels.enable {
services.udev.packages = [ prl-tools ];
environment.systemPackages = [ prl-tools ];
boot.extraModulePackages = [ prl-tools ];
boot.kernelModules = [ "prl_fs" "prl_fs_freeze" "prl_tg" ]
++ optional (pkgs.stdenv.hostPlatform.system == "aarch64-linux") "prl_notifier";
2014-11-11 00:32:05 +01:00
services.timesyncd.enable = false;
2014-11-11 00:32:05 +01:00
systemd.services.prltoolsd = {
description = "Parallels Tools Service";
2014-11-11 00:32:05 +01:00
wantedBy = [ "multi-user.target" ];
path = [ prl-tools ];
2014-11-11 00:32:05 +01:00
serviceConfig = {
ExecStart = "${prl-tools}/bin/prltoolsd -f";
PIDFile = "/var/run/prltoolsd.pid";
WorkingDirectory = "${prl-tools}/bin";
2014-11-11 00:32:05 +01:00
};
};
systemd.services.prlfsmountd = mkIf config.hardware.parallels.autoMountShares {
description = "Parallels Guest File System Sharing Tool";
2014-11-11 00:32:05 +01:00
wantedBy = [ "multi-user.target" ];
path = [ prl-tools ];
2014-11-11 00:32:05 +01:00
serviceConfig = rec {
ExecStart = "${prl-tools}/sbin/prlfsmountd ${PIDFile}";
ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p /media";
ExecStopPost = "${prl-tools}/sbin/prlfsmountd -u";
PIDFile = "/run/prlfsmountd.pid";
WorkingDirectory = "${prl-tools}/bin";
2014-11-11 00:32:05 +01:00
};
};
systemd.services.prlshprint = {
description = "Parallels Printing Tool";
2014-11-11 00:32:05 +01:00
wantedBy = [ "multi-user.target" ];
bindsTo = [ "cups.service" ];
path = [ prl-tools ];
2014-11-11 00:32:05 +01:00
serviceConfig = {
ExecStart = "${prl-tools}/bin/prlshprint";
WorkingDirectory = "${prl-tools}/bin";
2014-11-11 00:32:05 +01:00
};
};
systemd.user.services = {
prlcc = {
description = "Parallels Control Center";
wantedBy = [ "graphical-session.target" ];
path = [ prl-tools ];
serviceConfig = {
ExecStart = "${prl-tools}/bin/prlcc";
WorkingDirectory = "${prl-tools}/bin";
};
};
prldnd = {
description = "Parallels Drag And Drop Tool";
wantedBy = [ "graphical-session.target" ];
path = [ prl-tools ];
serviceConfig = {
ExecStart = "${prl-tools}/bin/prldnd";
WorkingDirectory = "${prl-tools}/bin";
};
};
prlcp = {
description = "Parallels Copy Paste Tool";
wantedBy = [ "graphical-session.target" ];
path = [ prl-tools ];
serviceConfig = {
ExecStart = "${prl-tools}/bin/prlcp";
Restart = "always";
WorkingDirectory = "${prl-tools}/bin";
};
};
prlsga = {
description = "Parallels Shared Guest Applications Tool";
wantedBy = [ "graphical-session.target" ];
path = [ prl-tools ];
serviceConfig = {
ExecStart = "${prl-tools}/bin/prlsga";
WorkingDirectory = "${prl-tools}/bin";
};
};
prlshprof = {
description = "Parallels Shared Profile Tool";
wantedBy = [ "graphical-session.target" ];
path = [ prl-tools ];
serviceConfig = {
ExecStart = "${prl-tools}/bin/prlshprof";
WorkingDirectory = "${prl-tools}/bin";
};
};
};
2014-11-11 00:32:05 +01:00
};
}