diff --git a/hosts/othalan/virt/default.nix b/hosts/othalan/virt/default.nix index b3c06ff..071dad9 100644 --- a/hosts/othalan/virt/default.nix +++ b/hosts/othalan/virt/default.nix @@ -15,25 +15,19 @@ let } ); }; - win-desktop = pkgs.stdenvNoCC.mkDerivation rec { - name = "win11-vm"; - unpackPhase = "true"; - version = "unstable"; - windows10Logo = pkgs.fetchurl { - url = "https://upload.wikimedia.org/wikipedia/commons/c/c7/Windows_logo_-_2012.png"; - hash = "sha256-uVNgGUo0NZN+mUmvMzyk0HKnhx64uqT4YWGSdeBz3T4="; - }; - desktopItem = pkgs.makeDesktopItem { - name = "win11-vm"; - # exec = "VBoxManage startvm win10"; - exec = "${pkgs.libvirt}/bin/virsh start win11 && ${pkgs.virt-viewer}/bin/virt-viewer --wait -c qemu:///system win11 && ${pkgs.libvirt}/bin/virsh shutdown win11"; - icon = "${windows10Logo}"; - desktopName = "Windows 11 VM"; - }; - installPhase = '' - install -Dm0644 {${desktopItem},$out}/share/applications/win11vm.desktop + windows10Logo = pkgs.fetchurl { + url = "https://upload.wikimedia.org/wikipedia/commons/c/c7/Windows_logo_-_2012.png"; + hash = "sha256-uVNgGUo0NZN+mUmvMzyk0HKnhx64uqT4YWGSdeBz3T4="; + }; + + windows-desktopItem = pkgs.makeDesktopItem { + name = "win11-vm"; + exec = '' + ${pkgs.bash}/bin/sh -c "${pkgs.libvirt}/bin/virsh start win11 && ${pkgs.virt-viewer}/bin/virt-viewer --wait -c qemu:///system win11 && ${pkgs.libvirt}/bin/virsh shutdown win11" ''; + icon = "${windows10Logo}"; + desktopName = "Windows 11 VM"; }; in @@ -67,5 +61,9 @@ in extraGroups = [ "libvirtd" ]; }; - environment.systemPackages = [ win-desktop ]; + environment.systemPackages = [ + (pkgs.runCommand "windows-vm-desktop-item" { } '' + install -Dm444 -t $out/share/applications ${windows-desktopItem}/share/applications/*.desktop + '') + ]; }