mprasil
December 16, 2023, 8:23pm
1
I can see nixos in the “Currently available images” list at https://images.linuxcontainers.org/ but if I try to do:
# lxc image list images: nix
I get back empty table. I can list other images like debian without any issues. I feel like I’m missing something basic here.
I’ve noticed pretty recent discussion here that suggests these images might not be available yet unless they were added recently. But I see the builds in Jenkins and nixos in the above mentioned list.
I am able to list the nixos images, inspect and launch them.
─❯ incus image show images:nixos/23.11
auto_update: false
properties:
architecture: amd64
description: Nixos 23.11 amd64 (20231216_01:00)
os: Nixos
release: "23.11"
requirements.privileged: "false"
serial: "20231216_01:00"
type: squashfs
variant: default
public: true
expires_at: 1970-01-01T00:00:00Z
profiles: []
~
─❯ incus image show images:nixos/unstable
auto_update: false
properties:
architecture: amd64
description: Nixos unstable amd64 (20231216_01:00)
os: Nixos
release: unstable
requirements.privileged: "false"
serial: "20231216_01:00"
type: squashfs
variant: default
public: true
expires_at: 1970-01-01T00:00:00Z
profiles: []
mprasil
December 16, 2023, 9:13pm
3
Hmm… I’m not sure what I could be doing wrong.
The remote looks correct:
$ lxc remote list | head -n5
+----------------------+---------------------------------------------------+---------------+-------------+--------+--------+--------+
| NAME | URL | PROTOCOL | AUTH TYPE | PUBLIC | STATIC | GLOBAL |
+----------------------+---------------------------------------------------+---------------+-------------+--------+--------+--------+
| images | https://images.linuxcontainers.org | simplestreams | none | YES | NO | NO |
+----------------------+---------------------------------------------------+---------------+-------------+--------+--------+--------+
Yet if I try to list the image:
$ lxc image show images:nixos/23.11
Error: Failed getting image: The requested image couldn't be found
I’m not using some super old version of LXD either:
$ lxc version
Client version: 5.19
Server version: 5.19
I assume this is not incus-only image or something like that?
stgraber
(Stéphane Graber)
December 17, 2023, 4:58am
4
As the NixOS image were only very recently added and were only ever developed and tested on Incus, they are not being presented to LXD users.
1 Like
mprasil
December 17, 2023, 12:02pm
5
That explains it I guess. Any ETA for providing this to LXD users or any workaround I could use to use these images?
stgraber
(Stéphane Graber)
December 17, 2023, 3:19pm
6
Given the recent developments around LXD, effectively the fact that Canonical is making it impossible for us to collaborate with LXD or even pull any of their bugfixes, it seems unlikely that we would want to increase the number of images we provide to LXD users moving forward.
Given a system with nix installed and a checkout of nixpkgs, you can build and import nixos images.
Here’s a script I use, just replace incus with lxc and run it in the nixpkgs checkout.
Incus import nixpkgs.nu
#!/usr/bin/env nu
def main [--vm: bool = true, --container: bool = true] {
if ($vm) {
print ":: [virtual-machine] building image"
let paths = nix-build -A lxdVirtualMachineImageMeta.x86_64-linux -A lxdVirtualMachineImage.x86_64-linux ./nixos/release.nix | lines
print ":: [virtual-machine] importing image"
incus image import --alias nixos/unstable/virtual-machine ($paths.0 + /tarball/nixos-system-x86_64-linux.tar.xz) ($paths.1 + /nixos.qcow2)
}
This file has been truncated. show original
mprasil
December 17, 2023, 10:21pm
8
Thank you. That’s helpful. I ended up using hydra-built LXD image as a starting point. I might get to building my own image instead.
I was just hoping to quickly try a bunch of stuff using NixOS from the upstream repo like I do for the other distributions. But importing custom image is not that much extra work either.
Yep those Hydra builds are the same. Also the same as what is being published to the image server.