From e821fed3ffc63c149b3b7ede75dcebf9e25943cb Mon Sep 17 00:00:00 2001 From: derped Date: Wed, 7 Jun 2023 01:14:47 +0200 Subject: [PATCH] Add podman service. --- config/users.nix | 3 ++- machines/Lilim/options.nix | 2 +- services/docker.nix | 3 +-- services/podman.nix | 15 +++++++++++++++ 4 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 services/podman.nix diff --git a/config/users.nix b/config/users.nix index 56c24e9..39403ad 100644 --- a/config/users.nix +++ b/config/users.nix @@ -19,7 +19,8 @@ let extraGroups = [ "audio" "wheel" "network" ] ++ (optionals cfg.xserver.enable ["input" "video"]) ++ (optionals cfg.printing.enable [ "cups" "lp" ]) - ++ (optional config.virtualisation.docker.enable "docker"); + ++ (optional (config.virtualisation.docker.enable && !config.virtualisation.podman.enable) "docker") + ++ (optional config.virtualisation.podman.enable "podman"); shell = "${pkgs.zsh}/bin/zsh"; passwordFile = passPath; # TODO: Fix for sops diff --git a/machines/Lilim/options.nix b/machines/Lilim/options.nix index b6bcaf3..d469045 100644 --- a/machines/Lilim/options.nix +++ b/machines/Lilim/options.nix @@ -56,7 +56,7 @@ with lib; "mullvad" "mariaDB" "nspawn" - "docker" + "docker" "podman" ]; firewall = { enable = true; diff --git a/services/docker.nix b/services/docker.nix index 23dd181..82feba2 100644 --- a/services/docker.nix +++ b/services/docker.nix @@ -3,12 +3,11 @@ # Note: add privileged users to docker group for access with lib; -mkIf (elem "docker" config.machine.services) { +mkIf ((elem "docker" config.machine.services) && !(elem "podman" config.machine.services)) { virtualisation.docker= { enable = true; # Disable live restore as it tends to delay/block system shutdown liveRestore = false; }; environment.systemPackages = with pkgs; [ docker-compose docker-machine ]; - ### Docker Image stuff will probably follow here } diff --git a/services/podman.nix b/services/podman.nix new file mode 100644 index 0000000..f1e9d3e --- /dev/null +++ b/services/podman.nix @@ -0,0 +1,15 @@ +{ config, lib, pkgs, ... }: + +with lib; + +mkIf (elem "podman" config.machine.services) { + virtualisation.podman = { + enable = true; + dockerSocket.enable = (elem "docker" config.machine.services); + dockerCompat = (elem "docker" config.machine.services); + defaultNetwork = { + settings.dns_enabled = true; + }; + }; + environment.systemPackages = with pkgs; [ podman-compose ]; +}