virtualboxGuestAdditions: Additional 7.1.4 fixes (#366080)
* virtualboxGuestAddtitions: Load required dynamic libs * virtualboxGuestAdditions: Remove unused code * virtualboxGuestAdditions: introduce verbose logging option * virtualboxGuestAdditions: only load vboxsf if enabled in module options
This commit is contained in:
parent
2490a12cd4
commit
c792c60b8a
@ -9,7 +9,7 @@ let
|
|||||||
cfg = config.virtualisation.virtualbox.guest;
|
cfg = config.virtualisation.virtualbox.guest;
|
||||||
kernel = config.boot.kernelPackages;
|
kernel = config.boot.kernelPackages;
|
||||||
|
|
||||||
mkVirtualBoxUserService = serviceArgs: {
|
mkVirtualBoxUserService = serviceArgs: verbose: {
|
||||||
description = "VirtualBox Guest User Services ${serviceArgs}";
|
description = "VirtualBox Guest User Services ${serviceArgs}";
|
||||||
|
|
||||||
wantedBy = [ "graphical-session.target" ];
|
wantedBy = [ "graphical-session.target" ];
|
||||||
@ -24,12 +24,22 @@ let
|
|||||||
# Check if the display environment is ready, otherwise fail
|
# Check if the display environment is ready, otherwise fail
|
||||||
preStart = "${pkgs.bash}/bin/bash -c \"if [ -z $DISPLAY ]; then exit 1; fi\"";
|
preStart = "${pkgs.bash}/bin/bash -c \"if [ -z $DISPLAY ]; then exit 1; fi\"";
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "@${kernel.virtualboxGuestAdditions}/bin/VBoxClient --foreground ${serviceArgs}";
|
ExecStart =
|
||||||
|
"@${kernel.virtualboxGuestAdditions}/bin/VBoxClient"
|
||||||
|
+ (lib.strings.optionalString verbose " --verbose")
|
||||||
|
+ " --foreground ${serviceArgs}";
|
||||||
# Wait after a failure, hoping that the display environment is ready after waiting
|
# Wait after a failure, hoping that the display environment is ready after waiting
|
||||||
RestartSec = 2;
|
RestartSec = 2;
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mkVirtualBoxUserX11OnlyService =
|
||||||
|
serviceArgs: verbose:
|
||||||
|
(mkVirtualBoxUserService serviceArgs verbose)
|
||||||
|
// {
|
||||||
|
unitConfig.ConditionEnvironment = "XDG_SESSION_TYPE=x11";
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
@ -73,6 +83,18 @@ in
|
|||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
description = "Whether to enable drag and drop support.";
|
description = "Whether to enable drag and drop support.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
verbose = lib.mkOption {
|
||||||
|
default = false;
|
||||||
|
type = lib.types.bool;
|
||||||
|
description = "Whether to verbose logging for guest services.";
|
||||||
|
};
|
||||||
|
|
||||||
|
vboxsf = lib.mkOption {
|
||||||
|
default = true;
|
||||||
|
type = lib.types.bool;
|
||||||
|
description = "Whether to load vboxsf";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
###### implementation
|
###### implementation
|
||||||
@ -91,11 +113,6 @@ in
|
|||||||
|
|
||||||
boot.extraModulePackages = [ kernel.virtualboxGuestAdditions ];
|
boot.extraModulePackages = [ kernel.virtualboxGuestAdditions ];
|
||||||
|
|
||||||
boot.supportedFilesystems = [ "vboxsf" ];
|
|
||||||
boot.initrd.supportedFilesystems = [ "vboxsf" ];
|
|
||||||
|
|
||||||
users.groups.vboxsf.gid = config.ids.gids.vboxsf;
|
|
||||||
|
|
||||||
systemd.services.virtualbox = {
|
systemd.services.virtualbox = {
|
||||||
description = "VirtualBox Guest Services";
|
description = "VirtualBox Guest Services";
|
||||||
|
|
||||||
@ -117,16 +134,22 @@ in
|
|||||||
SUBSYSTEM=="misc", KERNEL=="vboxguest", TAG+="systemd"
|
SUBSYSTEM=="misc", KERNEL=="vboxguest", TAG+="systemd"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
systemd.user.services.virtualboxClientVmsvga = mkVirtualBoxUserService "--vmsvga-session";
|
systemd.user.services.virtualboxClientVmsvga = mkVirtualBoxUserService "--vmsvga-session" cfg.verbose;
|
||||||
}
|
}
|
||||||
|
(lib.mkIf cfg.vboxsf {
|
||||||
|
boot.supportedFilesystems = [ "vboxsf" ];
|
||||||
|
boot.initrd.supportedFilesystems = [ "vboxsf" ];
|
||||||
|
|
||||||
|
users.groups.vboxsf.gid = config.ids.gids.vboxsf;
|
||||||
|
})
|
||||||
(lib.mkIf cfg.clipboard {
|
(lib.mkIf cfg.clipboard {
|
||||||
systemd.user.services.virtualboxClientClipboard = mkVirtualBoxUserService "--clipboard";
|
systemd.user.services.virtualboxClientClipboard = mkVirtualBoxUserService "--clipboard" cfg.verbose;
|
||||||
})
|
})
|
||||||
(lib.mkIf cfg.seamless {
|
(lib.mkIf cfg.seamless {
|
||||||
systemd.user.services.virtualboxClientSeamless = mkVirtualBoxUserService "--seamless";
|
systemd.user.services.virtualboxClientSeamless = mkVirtualBoxUserX11OnlyService "--seamless" cfg.verbose;
|
||||||
})
|
})
|
||||||
(lib.mkIf cfg.dragAndDrop {
|
(lib.mkIf cfg.dragAndDrop {
|
||||||
systemd.user.services.virtualboxClientDragAndDrop = mkVirtualBoxUserService "--draganddrop";
|
systemd.user.services.virtualboxClientDragAndDrop = mkVirtualBoxUserService "--draganddrop" cfg.verbose;
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -8,14 +8,12 @@
|
|||||||
zlib,
|
zlib,
|
||||||
patchelf,
|
patchelf,
|
||||||
makeWrapper,
|
makeWrapper,
|
||||||
|
wayland,
|
||||||
|
libX11,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
virtualBoxNixGuestAdditionsBuilder = callPackage ./builder.nix { };
|
virtualBoxNixGuestAdditionsBuilder = callPackage ./builder.nix { };
|
||||||
|
|
||||||
# Forced to 1.18; vboxvideo doesn't seem to provide any newer ABI,
|
|
||||||
# and nixpkgs doesn't support older ABIs anymore.
|
|
||||||
xserverABI = "118";
|
|
||||||
|
|
||||||
# Specifies how to patch binaries to make sure that libraries loaded using
|
# Specifies how to patch binaries to make sure that libraries loaded using
|
||||||
# dlopen are found. We grep binaries for specific library names and patch
|
# dlopen are found. We grep binaries for specific library names and patch
|
||||||
# RUNPATH in matching binaries to contain the needed library paths.
|
# RUNPATH in matching binaries to contain the needed library paths.
|
||||||
@ -32,6 +30,18 @@ let
|
|||||||
name = "libXrandr.so";
|
name = "libXrandr.so";
|
||||||
pkg = xorg.libXrandr;
|
pkg = xorg.libXrandr;
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
name = "libwayland-client.so";
|
||||||
|
pkg = wayland;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "libX11.so";
|
||||||
|
pkg = libX11;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "libXt.so";
|
||||||
|
pkg = xorg.libXt;
|
||||||
|
}
|
||||||
];
|
];
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user