at 23.11-beta 966 B view raw
1{ config, pkgs, lib, ... }: 2 3with lib; 4let 5 cfg = config.services.spice-webdavd; 6in 7{ 8 options = { 9 services.spice-webdavd = { 10 enable = mkEnableOption (lib.mdDoc "the spice guest webdav proxy daemon"); 11 12 package = mkOption { 13 default = pkgs.phodav; 14 defaultText = literalExpression "pkgs.phodav"; 15 type = types.package; 16 description = lib.mdDoc "spice-webdavd provider package to use."; 17 }; 18 }; 19 }; 20 21 config = mkIf cfg.enable { 22 # ensure the webdav fs this exposes can actually be mounted 23 services.davfs2.enable = true; 24 25 # add the udev rule which starts the proxy when the spice socket is present 26 services.udev.packages = [ cfg.package ]; 27 28 systemd.services.spice-webdavd = { 29 description = "spice-webdav proxy daemon"; 30 31 serviceConfig = { 32 Type = "simple"; 33 ExecStart = "${cfg.package}/bin/spice-webdavd -p 9843"; 34 Restart = "on-success"; 35 }; 36 }; 37 }; 38}