feat(nixos): add podman module

This commit is contained in:
Mohammad Rafiq 2025-07-07 18:40:25 +08:00
parent b4dc19d65c
commit 4cc2b50e15
No known key found for this signature in database

View file

@ -0,0 +1,37 @@
{ lib, config, ... }:
let
inherit (lib.modules) mkIf;
inherit (lib.options) mkEnableOption;
inherit (cfg.lib.modules) forAllUsers;
cfg = config.flake;
in
{
flake.modules.nixos.default =
{ pkgs, config, ... }:
{
options = {
podman.enable = mkEnableOption "";
podman.distrobox.enable = mkEnableOption "";
};
config = mkIf config.podman.enable {
virtualisation = {
containers.enable = true;
podman = {
enable = true;
dockerCompat = true;
defaultNetwork.settings.dns_enabled = true;
};
};
users.users = forAllUsers {
extraGroups = [ "podman" ];
autoSubUidGidRange = true;
};
home-manager.sharedModules = [
{
home.packages = [ pkgs.distrobox ];
persistDirs = [ ".local/share/containers" ];
}
];
};
};
}