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
lxd: Add VMs support #105651
lxd: Add VMs support #105651
Conversation
I did not update the tests because I can't upload a VM image to tarballs.nixos.org |
pkgs/tools/admin/lxd/default.nix
Outdated
[ iptables ebtables ]; | ||
lxd-agent = buildGoPackage rec { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[ iptables ebtables ]; | |
lxd-agent = buildGoPackage rec { | |
[ iptables ebtables ]; | |
lxd-agent = buildGoPackage rec { |
pkgs/tools/admin/lxd/default.nix
Outdated
|
||
goPackagePath = "github.com/lxc/lxd"; | ||
|
||
buildFlags = [ "-ldflags=-extldflags=-static" "-tags libsqlite3" ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it hurt to add -s -w
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had trouble figuring out quotation. We could do this. Not sure if there's any better solution.
- buildFlags = [ "-ldflags=-extldflags=-static" "-tags libsqlite3" ];
+ buildFlags = [ "-ldflags=-extldflags=-static" "-ldflags=-s" "-ldflags=-w" "-tags libsqlite3" ];
pkgs/tools/admin/lxd/default.nix
Outdated
buildFlags = [ "-ldflags=-extldflags=-static" "-tags libsqlite3" ]; | ||
|
||
src = fetchurl { | ||
url = "https://github.com/lxc/lxd/releases/download/lxd-${version}/lxd-${version}.tar.gz"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a question: Whats the difference with those compared to the github tarball?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't use ${pname}, because it's lxd-agent in this context. Should I put src in a let? Anyhow nix caches blobs by their hash, so it won't get downloaded twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason why you did not put this into a separate package?
I did not think it necessary to have an independent lxd-agent available for installation. lxd takes care of mounting it on the guest. It also may not be wise to have a different version of lxd than lxd-agent. |
Result of 1 package built:
|
Should I add lxd-agent to buildInputs? It seems to get built anyway and placed in the lxd package. |
Hello, sorry for the long delay. |
pkgs/tools/admin/lxd/default.nix
Outdated
|
||
goPackagePath = "github.com/lxc/lxd"; | ||
|
||
buildFlags = [ "-ldflags=-extldflags=-static" "-ldflags=-s" "-ldflags=-w" "-tags libsqlite3" ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buildFlags = [ "-ldflags=-extldflags=-static" "-ldflags=-s" "-ldflags=-w" "-tags libsqlite3" ]; | |
buildFlags = [ "-ldflags=-extldflags=-static" "-ldflags=-s -w" "-tags libsqlite3" ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This gives me a build error
I think that is a good idea because qemu is quite big. |
In that case we'll also need an extra config flag in the virtualisation.lxd module. |
Can we change the package there already? |
Yes, we can. My bad. |
* Moved the code for lxd-agent into a separate file * lxd-agent is now staically linked, as required for being copied into vms * Moved the code for lxd into a separate file represeting the unwraped exeuctable. So that we don't have to build lxd more than once for various configurations * The lxd package is now a wrapper around lxd, lxd-agent and various dependencies
I marked this as stale due to inactivity. → More info |
What's the status on this? I know it's marked as stale, but I'd be happy to see this feature merged. If needed, I'd be interested in contributing as well. |
I'll try building off of this and submit a different PR. |
Motivation for this change
LXD has support for virtual machines, but this support isn't present in nixpkgs.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)