Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Add initial support fo guix #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

phodina
Copy link

@phodina phodina commented May 17, 2022

Hi,

I'd like to add another Linux distro. More information can be find here.

It's similar to NixOS, however I don't know how to integrate it correctly into VPSFree.

Could you provide guidance please?

@aither64
Copy link
Member

Wow, that'd be cool! I tried to play with guix support myself, but I'm not familiar with the language and get lost in it...

Scripts in this repository have to build or download a root filesystem, which is then cloned to create VPS. build.sh should prepare this filesystem in directory at $INSTALL. Our VPS are containers, so there's no bootloader, we start the init system directly, e.g. /sbin/init.

The build scripts are run by osctl-image from vpsAdminOS, which you could download here: https://iso.vpsadminos.org. But maybe it'd be sufficient to run ./bin/runner manually, e.g.

./bin/runner image build 1234 <work-dir> <install-dir> guix

<install-dir> is where the result should be.

Otherwise feel free to ask concretely, you can also join us on IRC in #vpsfree or #vpsadminos on irc.libera.chat.

@aither64
Copy link
Member

Based on the last time I looked at it, I think we'd need something like command guix system docker-image. guix system container unfortunately seems to be rely on the host's store, but now I see guix system init, which has a --no-bootloader option, that might be worth a try, although I think it didn't work for me.

If they at least supported LXC images like docker, we could fit into that.

@phodina
Copy link
Author

phodina commented May 19, 2022

Hi @aither64, thanks for the information. True, it takes time to learn all the parentheses ...

Well my idea was to follow the guide published for Linode

As you correctly said we probably need to use guix system docker-image as this is independent of the host which is probably Nix based, right? And it needs also separation for all the VPS running there which is what the guix system container does not provide.

Here's list of supported Guix images:

guix system image --list-image-types
The available image types are:

   - rock64-raw
   - pinebook-pro-raw
   - pine64-raw
   - novena-raw
   - hurd-raw
   - hurd-qcow2
   - uncompressed-iso9660
   - iso9660
   - efi-raw
   - docker
   - raw-with-offset
   - qcow2

I'll look into osctl-image.

Basically what is needed is to build the rootfs in correct format and then let the ./bin/runner to start Sheppard (the initd process in Guix), right?

@aither64
Copy link
Member

aither64 commented May 19, 2022

I'll try to explain the process a bit better. The build scripts's job is to build a container image, which is essentially a tarball of its root filesystem, i.e. /. It's just directories and files that you place in directory $INSTALL.

osctl-image is a tool which can run the build script in a container on vpsAdminOS, this is the builder. Builders are needed, because e.g. it is best to build ubuntu on ubuntu, fedora on fedora, etc. osctl-image executes ./bin/runner with proper arguments and creates the tarball of $INSTALL. What I meant is that you could avoid having to use vpsAdminOS and osctl-image by executing ./bin/runner directly, just for testing purposes.

The builder containers are created from previously built images, so as it is, it cannot be guixsd. That shouldn't be a problem afaik, because it should be possible to run guix from another distribution. Built images are put into a repository at https://images.vpsadminos.org.

When creating a VPS, the tarball is downloaded, extracted and then the init system is run, usually sbin/init.

The problem I see with guixsd is that it does not support building the kind of image that we need, i.e. a normal system without needing bootloader and a disk to mount root filesystem from. The container's filesystem is already mounted when we run its sbin/init.

I can demonstrate on NixOS. The build scripts calls make template from vpsAdminOS, which uses nixpkgs/nixos/lib/make-system-tarball.nix to create the tarball. So there's support for this kind of thing in nixpkgs itself. The question is if guixsd supports something like this :)

In theory, you could build the docker image, then extract it to $INSTALL... and maybe then it would be possible to create a VPS from it. But could such a system be managed by guix from the inside? I don't know.

Edit: and when I say "container on vpsAdminOS" and "VPS", that's the same thing.

@phodina
Copy link
Author

phodina commented May 22, 2022

I looked into creating the initial rootfs and the best option might be to download the guix installer and then run:

guix system init --no-bootloader server.scm /tmp/rootfs

I'll try to implement it and send the updated PR.

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

Successfully merging this pull request may close these issues.

2 participants