feat(nixos): add podman module
This commit is contained in:
parent
b4dc19d65c
commit
4cc2b50e15
1 changed files with 37 additions and 0 deletions
37
nix/modules/options/virtualisation.nix
Normal file
37
nix/modules/options/virtualisation.nix
Normal 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" ];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue