nixops-libvirtd
nixops-libvirtd copied to clipboard
How can the module be used
It is not clear to me how this module can be used with NixOps. If I install NixOps from the NixOps GitHub repository, this libvirtd backend is not found. If I try to enter a nix-shell in this (nixops-libvirtdd) repository, I get the compilation error appended below. Maybe I misunderstand something, but it would be very nice, if a working example is available somewhere!
Thank you!
The compilation error:
/build/attrs-19.3.0/dist /build/attrs-19.3.0
Building wheel for libvirt-python (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /nix/store/d44wd6n98f93hjr6q1d1phhh1hw7a17d-python3-3.8.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/build/pip-req-build-fyzfaq7y/setup.py'"'"'; __file__='"'"'/build/pip-req-build-fyzfaq7y/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /build/pip-wheel-smh3gsqx
cwd: /build/pip-req-build-fyzfaq7y/
Complete output (13 lines):
running bdist_wheel
running build
pkg-config --print-errors --atleast-version=0.9.11 libvirt
/nix/store/d44wd6n98f93hjr6q1d1phhh1hw7a17d-python3-3.8.8/bin/python3.8 generator.py libvirt /nix/store/4xqh13fvpbas5ssl9hdnjgy9l3xvvxaq-libvirt-7.0.0/share/libvirt/api/libvirt-api.xml
Found 480 functions in /nix/store/4xqh13fvpbas5ssl9hdnjgy9l3xvvxaq-libvirt-7.0.0/share/libvirt/api/libvirt-api.xml
Found 0 functions in libvirt-override-api.xml
Generated 389 wrapper functions
Missing type converters:
char ** *:1
char **:1
ERROR: failed virDomainAuthorizedSSHKeysGet
ERROR: failed virDomainAuthorizedSSHKeysSet
error: command '/nix/store/d44wd6n98f93hjr6q1d1phhh1hw7a17d-python3-3.8.8/bin/python3.8' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for libvirt-python
Running setup.py clean for libvirt-python
Failed to build libvirt-python
ERROR: Failed to build one or more wheels
builder for '/nix/store/n37vvich127z79ksmrx0cp38dxzxr99r-python3.8-libvirt-python-6.4.0.drv' failed with exit code 1
cannot build derivation '/nix/store/j6l03g3nkxyv6rp9kdc6k68v685yhlxm-python3-3.8.8-env.drv': 1 dependencies couldn't be built
error: build of '/nix/store/j6l03g3nkxyv6rp9kdc6k68v685yhlxm-python3-3.8.8-env.drv' failed
OK, so I answer this question myself. It took me a while to figure everthing out. (Is anybody reading these issues? If so, is this module still developed?)
I used the NixOS unstable channel and installed nixopsUnstable (this already installs nixops-libvirtd, so no need to even clone this reopository. Then I followed the steps in the Readme.md.
virtualisation.libvirtd.enable = true;
users.extraUsers.myuser.extraGroups = [ "libvirtd" ];
networking.firewall.checkReversePath = false;
images=/var/lib/libvirt/images
sudo mkdir $images
sudo chgrp libvirtd $images
sudo chmod g+w $images
sudo virsh pool-define-as default dir --target $images
sudo virsh pool-autostart default
sudo virsh pool-start default
Then, I had to create my own machine configuration file (both the example and the test file didn't work).
Let's call it workingExample.nix.
{
machine =
{ resources, ... }:
{
deployment.targetEnv = "libvirtd";
deployment.libvirtd = {
headless = true;
};
};
network =
{
description = "libvirtd test";
};
}
Then, I used
nixops create -d lv workingExample.nix
nixops deploy -d lv
Also, I rebooted after switching to the new system configuration.