Moved container config
This commit is contained in:
1 parent
818e0f3ff3
commit
a86fd67f5a
7 files changed
+67
-46
No files matched your search
@@ -0,0 +1,26 @@
|
||||
{ lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
imports = [
|
||||
./docker.nix
|
||||
./podman.nix
|
||||
];
|
||||
options = {
|
||||
skyg.common.containers = {
|
||||
runtime = mkOption {
|
||||
description = "DOcker vs podman";
|
||||
type = types.str;
|
||||
default = "docker";
|
||||
};
|
||||
enableOnBoot = mkOption {
|
||||
type = types.boolean;
|
||||
default = false;
|
||||
};
|
||||
localDockerRegistries = mkOption {
|
||||
type = types.listOf types.str;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.skyg.common.containers;
|
||||
in
|
||||
{
|
||||
config = lib.mkIf cfg.runtime == "docker" {
|
||||
virtualisation.docker = {
|
||||
enable = true;
|
||||
autoPrune.enable = true;
|
||||
enableOnBoot = cfg.enableOnBoot;
|
||||
liveRestore = false;
|
||||
daemon.settings = {
|
||||
insecure-registries = cfg.localDockerRegistries;
|
||||
};
|
||||
};
|
||||
environment.systemPackages = with pkgs; [ docker-compose ];
|
||||
users.users.${config.skyg.user.name}.extraGroups = [ "docker" ];
|
||||
virtualisation.oci-containers.backend = "docker";
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
cfg = config.skyg.common.containers;
|
||||
in
|
||||
{
|
||||
config = lib.mkIf cfg.runtime == "podman" {
|
||||
virtualisation.oci-containers.backend = "podman";
|
||||
virtualisation = {
|
||||
podman = {
|
||||
enable = true;
|
||||
dockerCompat = true;
|
||||
defaultNetwork.settings.dns_enabled = true;
|
||||
dockerSocket.enable = true;
|
||||
autoPrune.enable = true;
|
||||
};
|
||||
};
|
||||
environment.systemPackages = with pkgs; [ podman-compose podman-tui ];
|
||||
};
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
{
|
||||
imports = [
|
||||
./hardware
|
||||
./containers
|
||||
./core.nix
|
||||
./networking.nix
|
||||
./user.nix
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
{ user, runtime ? null, enableOnBoot ? false, localDockerRegistries ? [ ] }:
|
||||
{ pkgs, ... }: {
|
||||
virtualisation.containers.enable = true;
|
||||
environment.systemPackages = with pkgs; [ dive ];
|
||||
imports = (if runtime == "podman" then
|
||||
[ (import ./podman.nix { user = user; localDockerRegistries = localDockerRegistries; }) ]
|
||||
else if runtime == "docker" then
|
||||
[
|
||||
(import ./docker.nix {
|
||||
user = user;
|
||||
enableOnBoot = enableOnBoot;
|
||||
localDockerRegistries = localDockerRegistries;
|
||||
})
|
||||
]
|
||||
else
|
||||
[ ]);
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
{ user, enableOnBoot ? false, localDockerRegistries ? [ ], ... }:
|
||||
{ pkgs, ... }: {
|
||||
virtualisation.docker = {
|
||||
enable = true;
|
||||
autoPrune.enable = true;
|
||||
enableOnBoot = enableOnBoot;
|
||||
liveRestore = false;
|
||||
daemon.settings = {
|
||||
insecure-registries = localDockerRegistries;
|
||||
};
|
||||
};
|
||||
environment.systemPackages = with pkgs; [ docker-compose ];
|
||||
users.users.${user.name}.extraGroups = [ "docker" ];
|
||||
virtualisation.oci-containers.backend = "docker";
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
{ user, ... }:
|
||||
{ pkgs, ... }: {
|
||||
virtualisation.oci-containers.backend = "podman";
|
||||
virtualisation = {
|
||||
podman = {
|
||||
enable = true;
|
||||
dockerCompat = true;
|
||||
defaultNetwork.settings.dns_enabled = true;
|
||||
dockerSocket.enable = true;
|
||||
autoPrune.enable = true;
|
||||
};
|
||||
};
|
||||
environment.systemPackages = with pkgs; [ podman-compose podman-tui ];
|
||||
}
|
||||
Reference in new issue
Block a user