config/profiles/oci/distrobox.nix

57 lines
1.5 KiB
Nix
Raw Normal View History

2024-03-24 03:11:53 +01:00
{ pkgs, config, ... }:
2024-10-19 04:05:19 +02:00
/*
# via https://distrobox.it/compatibility/#containers-distros
use --nvidia for cuda support
distrobox create --name alpine --init --yes --image docker.io/libary/alpine:latest
distrobox create --name arch --init --yes --image docker.io/libary/archlinux:latest
distrobox create --name debian --init --yes --image docker.io/libary/debian:testing
distrobox create --name fedora --init --yes --image quay.io/fedora/fedora:rawhide
distrobox create --name gentoo --init --yes --image docker.io/gentoo/stage3:latest
#distrobox create --name ubuntu --init --yes --image quay.io/toolbx/ubuntu-toolbox:latest
*/
2024-03-24 03:11:53 +01:00
{
assertions = [
{
assertion = config.virtualisation.docker.enable || config.virtualisation.podman.enable;
message = "distrobox requires either podman or docker";
}
];
environment.systemPackages = [
pkgs.distrobox
];
2024-10-19 04:05:19 +02:00
# ++ lib.optionals (!config.virtualisation.docker.enable && !config.virtualisation.podman.enable) [
# pkgs.lilipod
#];
2024-03-24 03:11:53 +01:00
# update periodically
systemd.user = {
timers."distrobox-update" = {
2024-10-19 04:05:19 +02:00
enable = config.system.autoUpgrade.enable;
2024-03-24 03:11:53 +01:00
wantedBy = ["timers.target"];
timerConfig = {
OnBootSec = "1h";
OnUnitActiveSec = "1d";
Unit = "distrobox-update.service";
};
};
services."distrobox-update" = {
2024-10-19 04:05:19 +02:00
enable = config.system.autoUpgrade.enable;
2024-03-24 03:11:53 +01:00
script = ''
${pkgs.distrobox}/bin/distrobox upgrade --all
'';
serviceConfig = {
Type = "oneshot";
};
};
};
}