From 74209a4ca8baedb7bf1b3e3720a9abf132f8c05e Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Thu, 20 Aug 2015 00:29:20 +0200 Subject: [PATCH] virtualbox service: add support for vboxsf guest filesystem Closes #9358 Signed-off-by: Jaka Hudoklin Fix reference to bin/mount.vboxsf. Signed-off-by: aszlig --- nixos/modules/module-list.nix | 1 + nixos/modules/tasks/filesystems/vboxsf.nix | 23 +++++++++++++++++++ .../virtualisation/virtualbox-guest.nix | 3 ++- 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 nixos/modules/tasks/filesystems/vboxsf.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index b03f4494522b..1d6ddcbe9410 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -472,6 +472,7 @@ ./tasks/filesystems/ntfs.nix ./tasks/filesystems/reiserfs.nix ./tasks/filesystems/unionfs-fuse.nix + ./tasks/filesystems/vboxsf.nix ./tasks/filesystems/vfat.nix ./tasks/filesystems/xfs.nix ./tasks/filesystems/zfs.nix diff --git a/nixos/modules/tasks/filesystems/vboxsf.nix b/nixos/modules/tasks/filesystems/vboxsf.nix new file mode 100644 index 000000000000..87f1984f084f --- /dev/null +++ b/nixos/modules/tasks/filesystems/vboxsf.nix @@ -0,0 +1,23 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + inInitrd = any (fs: fs == "vboxsf") config.boot.initrd.supportedFilesystems; + + package = pkgs.runCommand "mount.vboxsf" {} '' + mkdir -p $out/bin + cp ${pkgs.linuxPackages.virtualboxGuestAdditions}/bin/mount.vboxsf $out/bin + ''; +in + +{ + config = mkIf (any (fs: fs == "vboxsf") config.boot.supportedFilesystems) { + + system.fsPackages = [ package ]; + + boot.initrd.kernelModules = mkIf inInitrd [ "vboxsf" ]; + + }; +} diff --git a/nixos/modules/virtualisation/virtualbox-guest.nix b/nixos/modules/virtualisation/virtualbox-guest.nix index 642ea3154b1b..a025aee7cfeb 100644 --- a/nixos/modules/virtualisation/virtualbox-guest.nix +++ b/nixos/modules/virtualisation/virtualbox-guest.nix @@ -32,7 +32,8 @@ in boot.extraModulePackages = [ kernel.virtualboxGuestAdditions ]; - boot.kernelModules = [ "vboxsf" ]; + boot.supportedFilesystems = [ "vboxsf" ]; + boot.initrd.supportedFilesystems = [ "vboxsf" ]; users.extraGroups.vboxsf.gid = config.ids.gids.vboxsf;