{ lib, config, ... }: let cfg = config.modules.tempBuildStorage; in { options.modules.tempBuildStorage = { enable = lib.mkEnableOption "temporary build storage volume"; device = lib.mkOption { type = lib.types.str; default = "/dev/sdb"; description = "Block device to mount for temporary nix build storage."; }; mountPoint = lib.mkOption { type = lib.types.str; default = "/mnt/build"; description = "Mount point for the temporary build storage."; }; }; config = lib.mkIf cfg.enable { fileSystems.${cfg.mountPoint} = { device = cfg.device; fsType = "ext4"; options = [ "nofail" "defaults" ]; }; nix.settings.build-dir = cfg.mountPoint; }; }