summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorgnidorah <gnidorah@users.noreply.github.com>2019-05-26 22:02:43 +0300
committergnidorah <gnidorah@users.noreply.github.com>2019-05-26 22:02:43 +0300
commiteac62f61d17181a82292a18fa1bfb46bafe33487 (patch)
tree39fb7f61b4b4a19ec344b51c646d7fca1fb85fb5 /nixos
parentbc94dcf500286495e3c478a9f9322debc94c4304 (diff)
downloadnixpkgs-eac62f61d17181a82292a18fa1bfb46bafe33487.tar
nixpkgs-eac62f61d17181a82292a18fa1bfb46bafe33487.tar.gz
nixpkgs-eac62f61d17181a82292a18fa1bfb46bafe33487.tar.bz2
nixpkgs-eac62f61d17181a82292a18fa1bfb46bafe33487.tar.lz
nixpkgs-eac62f61d17181a82292a18fa1bfb46bafe33487.tar.xz
nixpkgs-eac62f61d17181a82292a18fa1bfb46bafe33487.tar.zst
nixpkgs-eac62f61d17181a82292a18fa1bfb46bafe33487.zip
nixos/kvmgt: fix starting condition
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/virtualisation/kvmgt.nix18
1 files changed, 10 insertions, 8 deletions
diff --git a/nixos/modules/virtualisation/kvmgt.nix b/nixos/modules/virtualisation/kvmgt.nix
index 132815a0ad6..bfcf51d09c4 100644
--- a/nixos/modules/virtualisation/kvmgt.nix
+++ b/nixos/modules/virtualisation/kvmgt.nix
@@ -46,22 +46,24 @@ in {
       message = "KVMGT is not properly supported for kernels older than 4.16";
     };
     boot.kernelParams = [ "i915.enable_gvt=1" ];
+    systemd.paths = mapAttrs' (name: value:
+      nameValuePair "kvmgt-${name}" {
+        description = "KVMGT VGPU ${name} path";
+        wantedBy = [ "multi-user.target" ];
+        pathConfig = {
+          PathExists = "/sys/bus/pci/devices/${cfg.device}/mdev_supported_types/${name}/create";
+        };
+      }
+    ) cfg.vgpus;
     systemd.services = mapAttrs' (name: value:
       nameValuePair "kvmgt-${name}" {
         description = "KVMGT VGPU ${name}";
         serviceConfig = {
-          Type = "forking";
+          Type = "oneshot";
           RemainAfterExit = true;
-          Restart = "on-failure";
-          RestartSec = 5;
           ExecStart = "${pkgs.runtimeShell} -c 'echo ${value.uuid} > /sys/bus/pci/devices/${cfg.device}/mdev_supported_types/${name}/create'";
           ExecStop = "${pkgs.runtimeShell} -c 'echo 1 > /sys/bus/pci/devices/${cfg.device}/${value.uuid}/remove'";
         };
-        unitConfig = {
-          StartLimitBurst = 5;
-          StartLimitIntervalSec = 30;
-        };
-        wantedBy = [ "multi-user.target" ];
       }
     ) cfg.vgpus;
   };