distrobox: add module (#6528)
Added programs/distrobox.nix module. It provides the option "programs.distrobox.containers", which makes it possible to declare a list of containers to be created. Since building those containers is not possible at build time (because none container backend is available at that time), I also added a Systemd Unit to build those containers after switching the configuration.
This commit is contained in:
parent
d61711497b
commit
8a68f18e96
6 changed files with 160 additions and 0 deletions
1
tests/modules/programs/distrobox/default.nix
Normal file
1
tests/modules/programs/distrobox/default.nix
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ distrobox-example-config = ./example-config.nix; }
|
||||
20
tests/modules/programs/distrobox/example-config.ini
Normal file
20
tests/modules/programs/distrobox/example-config.ini
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
[common-debian]
|
||||
additional_packages=git
|
||||
entry=true
|
||||
image=debian:13
|
||||
init_hooks=ln -sf /usr/bin/distrobox-host-exec /usr/local/bin/docker
|
||||
init_hooks=ln -sf /usr/bin/distrobox-host-exec /usr/local/bin/docker-compose
|
||||
|
||||
[office]
|
||||
additional_packages=libreoffice onlyoffice
|
||||
clone=common-debian
|
||||
entry=true
|
||||
|
||||
[python-project]
|
||||
additional_packages=python3 git
|
||||
image=fedora:40
|
||||
init_hooks=pip3 install numpy pandas torch torchvision
|
||||
|
||||
[random-things]
|
||||
clone=common-debian
|
||||
entry=false
|
||||
41
tests/modules/programs/distrobox/example-config.nix
Normal file
41
tests/modules/programs/distrobox/example-config.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
programs.distrobox = {
|
||||
enable = true;
|
||||
containers = {
|
||||
|
||||
python-project = {
|
||||
image = "fedora:40";
|
||||
additional_packages = "python3 git";
|
||||
init_hooks = "pip3 install numpy pandas torch torchvision";
|
||||
};
|
||||
|
||||
common-debian = {
|
||||
image = "debian:13";
|
||||
entry = true;
|
||||
additional_packages = "git";
|
||||
init_hooks = [
|
||||
"ln -sf /usr/bin/distrobox-host-exec /usr/local/bin/docker"
|
||||
"ln -sf /usr/bin/distrobox-host-exec /usr/local/bin/docker-compose"
|
||||
];
|
||||
};
|
||||
|
||||
office = {
|
||||
clone = "common-debian";
|
||||
additional_packages = "libreoffice onlyoffice";
|
||||
entry = true;
|
||||
};
|
||||
|
||||
random-things = {
|
||||
clone = "common-debian";
|
||||
entry = false;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/distrobox/containers.ini
|
||||
assertFileContent home-files/.config/distrobox/containers.ini \
|
||||
${./example-config.ini}
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue