Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Hooks support. #27

Open
Svenum opened this issue Apr 10, 2024 · 6 comments
Open

Feature Request: Hooks support. #27

Svenum opened this issue Apr 10, 2024 · 6 comments

Comments

@Svenum
Copy link
Contributor

Svenum commented Apr 10, 2024

I would love to add hooks to the VMs via this module. I know its already possible https://search.nixos.org/options?channel=unstable&show=virtualisation.libvirtd.hooks&from=0&size=50&sort=relevance&type=packages&query=hooks but it would be nice to do this also over this module.

@AshleyYakeley
Copy link
Owner

What kind of hooks? Could you give me an example of what you want to do?

@Svenum
Copy link
Contributor Author

Svenum commented Apr 11, 2024

I mean this hooks here: https://www.libvirt.org/hooks.html

I want to add some scripts before the VM starts and after it is shutdown.

@AshleyYakeley
Copy link
Owner

The libvirt hooks are already available in NixOS: https://search.nixos.org/options?channel=23.11&from=0&size=50&sort=relevance&type=packages&query=libvirtd.hooks

Alternatively I can add hooks for when NixVirt does activation/deactivation of domains (and other objects).

@AshleyYakeley
Copy link
Owner

Will the NixOS libvirtd hooks work for you or should I add something?

@Svenum
Copy link
Contributor Author

Svenum commented Apr 14, 2024

Yes it would be nice if you add the support for hooks. For example the default module form Nix could not create supfolders in the hook directory. That is usefull If you dont want to write a complex script with much if else conditions, only to check if the host and the vm stat is right. (https://passthroughpo.st/simple-per-vm-libvirt-hooks-with-the-vfio-tools-hook-helper/). And maybe its possible to write hooks for user sessions (qemu:///session), but I do not know.

@AshleyYakeley
Copy link
Owner

OK, if I did this it would add per-domain hooks via NixOS virtualisation.libvirtd.hooks.* and therefore only work with NixOS, not Home Manager.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants