Code Monkey home page Code Monkey logo

libvirt-hooks-nushell's Introduction

Libvirt Hooks via Nu

Strengthen Your Virtual Machine Workflow with Libvirt Hooks.

What are Libvirt Hooks?

Libvirt hooks are scripts that Libvirt triggers based on VM states. Dive deeper at Libvirt Hooks Documentation.

Enhance Your VM Experience

Imagine seamlessly transitioning into gaming nirvana. Your Gaming VM awakens, guided by your pre-configured Libvirt hooks, acting like loyal minions fulfilling your every command. They vanquish distractions, summon OBS Studio for flawless streaming, and set the ambiance with subtle lighting adjustments. It's automation excellence in action.

Installation

Get started with a straightforward installation process.

git clone https://atahabaki/libvirt-hooks-nushell
cd libvirt-hooks-nushell
sudo just install

Usage

This README, purely focuses on the qemu hook. Other hooks basically the same, so please take a look at their documentation, here.

According to the official documentation, valid QEMU hook states include:

  • guest_name/prepare/begin
  • guest_name/start/begin
  • guest_name/release/end

Example Scenario

Suppose you're on a gaming laptop with a discrete GPU. You want to pass the dGPU to a VM. Start by killing processes using the dGPU in the /prepare/begin state.

Navigate to the VM's hook directory, e.g., /etc/libvirt/hooks/qemu.d/win10:

cd /etc/libvirt/hooks/qemu.d/win10

Create a file 00-kill-dgpu-processes.nu in prepare/begin:

touch ./prepare/begin/00-kill-dgpu-processes.nu

You can customize this script as needed. Similarly, for other VM states, create corresponding nushell scripts for automation.

Advanced Techniques

Default Hooks

If you frequently create similar VMs with identical hook requirements, simplify with a default hooks folder. These hooks will apply by default to all VMs unless specified otherwise. To exclude hooks entirely, name your VMs ending with -woh or -no-hook, e.g., win10-gaming-woh.

Pure State Files

If you do not want to create seperate files for each action, (e.g., 00-kill-dgpu-processes, 01-create-hugepages...) just create a file with that state name, (e.g., prepare/begin, release/end...). And even further, you can just rewrite the hook file (they are inside the /etc/libvirt/hooks/ folder), (e.g., qemu, lxc...)

Unlock the full potential of your VM workflow with Libvirt hooks via NuShell!

libvirt-hooks-nushell's People

Contributors

atahabaki avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.