1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-27 05:29:46 +01:00

Merge pull request #1 from bamhm182/suggestions-dawidd6-podman

podman: moved settings under config
This commit is contained in:
Dawid Dziurla 2024-11-08 17:04:06 +01:00 committed by GitHub
commit c6e927e632
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 84 additions and 79 deletions

View file

@ -11,7 +11,8 @@ in {
options.services.podman = { options.services.podman = {
enable = lib.mkEnableOption "Podman, a daemonless container engine"; enable = lib.mkEnableOption "Podman, a daemonless container engine";
containersConf.settings = lib.mkOption { config = {
containers.settings = lib.mkOption {
type = toml.type; type = toml.type;
default = { }; default = { };
description = "containers.conf configuration"; description = "containers.conf configuration";
@ -68,6 +69,7 @@ in {
''; '';
}; };
}; };
};
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = assertions =
@ -75,22 +77,23 @@ in {
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];
services.podman.storage.settings = { services.podman.config.storage.settings = {
storage.driver = lib.mkDefault "overlay"; storage.driver = lib.mkDefault "overlay";
}; };
xdg.configFile = { xdg.configFile = {
"containers/policy.json".source = if cfg.policy != { } then "containers/policy.json".source = if cfg.config.policy != { } then
pkgs.writeText "policy.json" (builtins.toJSON cfg.policy) pkgs.writeText "policy.json" (builtins.toJSON cfg.config.policy)
else else
"${pkgs.skopeo.policy}/default-policy.json"; "${pkgs.skopeo.policy}/default-policy.json";
"containers/registries.conf".source = toml.generate "registries.conf" { "containers/registries.conf".source = toml.generate "registries.conf" {
registries = lib.mapAttrs (n: v: { registries = v; }) cfg.registries; registries =
lib.mapAttrs (n: v: { registries = v; }) cfg.config.registries;
}; };
"containers/storage.conf".source = "containers/storage.conf".source =
toml.generate "storage.conf" cfg.storage.settings; toml.generate "storage.conf" cfg.config.storage.settings;
"containers/containers.conf".source = "containers/containers.conf".source =
toml.generate "containers.conf" cfg.containersConf.settings; toml.generate "containers.conf" cfg.config.containers.settings;
}; };
}; };
} }

View file

@ -3,7 +3,8 @@
{ {
services.podman = { services.podman = {
enable = true; enable = true;
containersConf.settings = { config = {
containers.settings = {
network = { network = {
default_subnet = "172.16.10.0/24"; default_subnet = "172.16.10.0/24";
default_subnet_pools = [ default_subnet_pools = [
@ -31,6 +32,7 @@
}; };
policy = { default = [{ type = "insecureAcceptAnything"; }]; }; policy = { default = [{ type = "insecureAcceptAnything"; }]; };
}; };
};
nmt.script = '' nmt.script = ''
configPath=home-files/.config/containers configPath=home-files/.config/containers