distrobox

This commit is contained in:
2024-03-24 03:11:53 +01:00
parent 59a701bd73
commit c347e4b245
6 changed files with 53 additions and 12 deletions
+39
View File
@@ -0,0 +1,39 @@
{ pkgs, config, ... }:
{
assertions = [
{
assertion = config.virtualisation.docker.enable || config.virtualisation.podman.enable;
message = "distrobox requires either podman or docker";
}
];
environment.systemPackages = [
pkgs.distrobox
];
# update periodically
systemd.user = {
timers."distrobox-update" = {
enable = true;
wantedBy = ["timers.target"];
timerConfig = {
OnBootSec = "1h";
OnUnitActiveSec = "1d";
Unit = "distrobox-update.service";
};
};
services."distrobox-update" = {
enable = true;
script = ''
${pkgs.distrobox}/bin/distrobox upgrade --all
'';
serviceConfig = {
Type = "oneshot";
};
};
};
}
@@ -1,7 +1,8 @@
{ lib, pkgs, ... }:
{
virtualisation.docker.enable = true;
#virtualisation.oci-containers.backend = lib.mkDefault "docker";
virtualisation.oci-containers.backend = lib.mkDefault "docker";
virtualisation.docker.autoPrune.enable = true;
virtualisation.docker.autoPrune.dates = "weekly";
@@ -11,12 +12,13 @@
#docker-compose
];
# remember to add your user:
#users.users.USERNAME.extraGroups = [ "docker" ];
# Required for containers under podman-compose to be able to talk to each other.
#virtualisation.defaultNetwork.settings.dns_enabled = true;
# TODO: if root-on-zfs
#virtualisation.podman.extraPackages = [ pkgs.zfs ];
# remember to add your user:
#users.users.USERNAME.extraGroups = [ "docker" ];
}
@@ -1,8 +1,8 @@
{ config, pkgs, ... }:
{
virtualisation.podman.enable = true;
virtualisation.podman.dockerCompat = !config.virtualisation.docker.enable; # alias docker to podman
virtualisation.oci-containers.backend = "podman"; # default
virtualisation.podman.dockerCompat = !config.virtualisation.docker.enable; # alias docker to podman
virtualisation.podman.autoPrune.enable = true;
virtualisation.podman.autoPrune.dates = "weekly";
@@ -13,7 +13,6 @@
podman-tui
];
# Required for containers under podman-compose to be able to talk to each other.
#virtualisation.defaultNetwork.settings.dns_enabled = true;