add core configuration
This commit is contained in:
parent
ad124505da
commit
c556ce55b6
94 changed files with 2816 additions and 959 deletions
48
modules/containers/default.nix
Normal file
48
modules/containers/default.nix
Normal file
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
cfg = config.lily.containers;
|
||||
in {
|
||||
options.lily.containers = {
|
||||
enable = lib.mkEnableOption "activate containers";
|
||||
docker = lib.mkEnableOption "activate docker";
|
||||
podman = lib.mkEnableOption "activate podman";
|
||||
};
|
||||
|
||||
config = lib.mkMerge [
|
||||
# (lib.mkIf (cfg.enable && cfg.docker && cfg.podman)
|
||||
# (builtins.throw "You can't enable both docker and podman at the same time"))
|
||||
{
|
||||
assertions = [
|
||||
{
|
||||
assertion = !(cfg.docker && cfg.podman);
|
||||
message = "You cannot enable docker and podman at the same time";
|
||||
}
|
||||
];
|
||||
}
|
||||
(lib.mkIf (cfg.enable && cfg.docker) {
|
||||
# Enable docker support:
|
||||
virtualisation.containers.enable = true;
|
||||
virtualisation.docker.enable = true;
|
||||
})
|
||||
(lib.mkIf (cfg.enable && cfg.podman) {
|
||||
# Enable podman support:
|
||||
virtualisation.containers.enable = true;
|
||||
virtualisation.podman = {
|
||||
enable = true;
|
||||
dockerCompat = true;
|
||||
dockerSocket.enable = true;
|
||||
defaultNetwork.settings = {
|
||||
dns_enabled = true;
|
||||
};
|
||||
};
|
||||
environment.systemPackages = with pkgs; [
|
||||
podman
|
||||
podman-compose
|
||||
];
|
||||
})
|
||||
];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue