lib: Improve the sandbox derivation
This commit is contained in:
@@ -66,4 +66,6 @@ in {
|
||||
discord-app = prev.callPackage applications/networking/instant-messengers/discord-app {
|
||||
chromium = prev.ungoogled-chromium;
|
||||
};
|
||||
|
||||
zoom-vm = prev.callPackage scripts/zoom-vm {};
|
||||
}
|
||||
|
||||
46
packages/scripts/zoom-vm/default.nix
Normal file
46
packages/scripts/zoom-vm/default.nix
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
stdenv, lib
|
||||
, makeDesktopItem, writeShellScriptBin
|
||||
, virt-manager, libvirt, notify-desktop
|
||||
}:
|
||||
|
||||
let
|
||||
zoomVmScript = writeShellScriptBin "start-zoom-vm.sh" ''
|
||||
${notify-desktop}/bin/notify-desktop "Zoom VM" "Starting VM..."
|
||||
output=$(/run/wrappers/bin/pkexec virsh start zoom 2>&1)
|
||||
if [[ ! "$?" = "0" ]]; then
|
||||
${notify-desktop}/bin/notify-desktop -u critical "Zoom VM" "$output"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
${virt-manager}/bin/virt-manager --connect qemu:///system --show-domain-console zoom
|
||||
'';
|
||||
zoomIcon = builtins.fetchurl {
|
||||
url = "https://dl.flathub.org/repo/appstream/x86_64/icons/128x128/us.zoom.Zoom.png";
|
||||
sha256 = "0d94vhjna2196s4wnq0vkga345ad5lpb7b5qp6cymwf1hnpg9lyh";
|
||||
};
|
||||
in stdenv.mkDerivation rec {
|
||||
pname = "zoom-vm";
|
||||
version = "1.0.0";
|
||||
|
||||
unpackPhase = ":";
|
||||
dontBuild = true;
|
||||
|
||||
desktopItem = makeDesktopItem {
|
||||
name = "zoom-vm";
|
||||
desktopName = "Zoom (VM)";
|
||||
exec = "start-zoom-vm";
|
||||
icon = "us.zoom.Zoom";
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
# Install the script
|
||||
mkdir -p $out/bin
|
||||
cp ${zoomVmScript}/bin/start-zoom-vm.sh $out/bin/start-zoom-vm
|
||||
|
||||
# Install the desktop file
|
||||
mkdir -p $out/share/icons
|
||||
cp ${zoomIcon} $out/share/icons/us.zoom.Zoom.png
|
||||
cp -r ${desktopItem}/share/applications $out/share
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user