diff --git a/nixos-modules/host/default.nix b/nixos-modules/host/default.nix index b0da31b3..256b47a6 100644 --- a/nixos-modules/host/default.nix +++ b/nixos-modules/host/default.nix @@ -283,6 +283,9 @@ in --rlimit-nofile ${toString serviceConfig.LimitNOFILE} \ --thread-pool-size `nproc` \ --posix-acl --xattr \ + ${lib.optionalString (config.microvm.virtiofsd.inodeFileHandles != null) + "--inode-file-handles=${config.microvm.virtiofsd.inodeFileHandles}" + } \ & # detach from shell, but remain in systemd cgroup disown diff --git a/nixos-modules/host/options.nix b/nixos-modules/host/options.nix index 8de8b791..bafb2356 100644 --- a/nixos-modules/host/options.nix +++ b/nixos-modules/host/options.nix @@ -137,5 +137,20 @@ This includes declarative `config.microvm.vms` as well as MicroVMs that are managed through the `microvm` command. ''; }; + + virtiofsd.inodeFileHandles = mkOption { + type = with types; nullOr (enum [ + "never" "prefer" "mandatory" + ]); + default = null; + description = '' + When to use file handles to reference inodes instead of O_PATH file descriptors + (never, prefer, mandatory) + + Allows you to overwrite default behavior in case you hit "too + many open files" on eg. ZFS. + + ''; + }; }; }