summary refs log tree commit diff
path: root/nixos/modules/tasks/filesystems/vboxsf.nix
blob: 5497194f6a8d125890ffc5a6dc22d7201f5c9aa0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{ config, lib, pkgs, ... }:

with lib;

let

  inInitrd = any (fs: fs == "vboxsf") config.boot.initrd.supportedFilesystems;

  package = pkgs.runCommand "mount.vboxsf" { preferLocalBuild = true; } ''
    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" ];

  };
}