Added: Container Switch
This commit is contained in:
41
modules/containerization/default.nix
Normal file
41
modules/containerization/default.nix
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
containerization ? "none",
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
# Import the appropriate containerization module based on the parameter
|
||||
containerModule =
|
||||
if containerization == "podman" then
|
||||
import ./podman.nix
|
||||
else if containerization == "docker" then
|
||||
import ./docker.nix
|
||||
else if containerization == "none" then
|
||||
{ }
|
||||
else
|
||||
throw "Unknown containerization type: ${containerization}. Valid options are: podman, docker, none";
|
||||
in
|
||||
|
||||
{
|
||||
imports = [ containerModule ];
|
||||
|
||||
# Common packages and configuration for all systems
|
||||
environment.systemPackages = with pkgs; [
|
||||
# Remove the curly braces {}
|
||||
dive # docker layer viewer
|
||||
tailscale # VPN
|
||||
];
|
||||
|
||||
virtualisation.containers.enable = true;
|
||||
virtualisation.oci-containers.containers = {
|
||||
/*
|
||||
container-name = {
|
||||
image = "image";
|
||||
autoStart = true;
|
||||
ports = [ "127.0.0.1:1234:1234" ];
|
||||
};
|
||||
*/
|
||||
};
|
||||
}
|
18
modules/containerization/docker.nix
Normal file
18
modules/containerization/docker.nix
Normal file
@@ -0,0 +1,18 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
docker-compose
|
||||
lazydocker
|
||||
];
|
||||
|
||||
virtualisation.docker = {
|
||||
enable = true;
|
||||
rootless = {
|
||||
enable = true;
|
||||
setSocketVariable = true;
|
||||
};
|
||||
};
|
||||
|
||||
virtualisation.oci-containers.backend = "docker";
|
||||
}
|
17
modules/containerization/podman.nix
Normal file
17
modules/containerization/podman.nix
Normal file
@@ -0,0 +1,17 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
podman-compose # docker-compose alternative
|
||||
podman-tui # status of containers in terminal
|
||||
podman-desktop # Desktop client
|
||||
];
|
||||
|
||||
virtualisation.podman = {
|
||||
enable = true;
|
||||
dockerCompat = true;
|
||||
defaultNetwork.settings.dns_enabled = true;
|
||||
};
|
||||
|
||||
virtualisation.oci-containers.backend = "podman";
|
||||
}
|
@@ -1,36 +0,0 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
# Virtualisation
|
||||
docker-compose # docker-compose alternative
|
||||
dive # docker layer viewer
|
||||
tailscale # Vpn
|
||||
];
|
||||
# Virtualisation
|
||||
virtualisation = {
|
||||
containers.enable = true;
|
||||
|
||||
docker = {
|
||||
enable = true;
|
||||
rootless = {
|
||||
enable = true;
|
||||
setSocketVariable = true;
|
||||
};
|
||||
};
|
||||
|
||||
oci-containers = {
|
||||
backend = "docker";
|
||||
containers = {
|
||||
/*
|
||||
container-name = {
|
||||
image = "image";
|
||||
autoStart = true;
|
||||
ports = [ "127.0.0.1:1234:1234" ];
|
||||
};
|
||||
*/
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
@@ -4,7 +4,7 @@
|
||||
time.timeZone = "Europe/Berlin";
|
||||
|
||||
# Select internationalisation properties.
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
i18n.defaultLocale = "de_DE.UTF-8";
|
||||
|
||||
i18n.extraLocaleSettings = {
|
||||
LC_ADDRESS = "de_DE.UTF-8";
|
||||
|
@@ -1,36 +0,0 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
# Virtualisation
|
||||
podman-compose # docker-compose alternative
|
||||
dive # docker layer viewer
|
||||
podman-tui # status of containers in terminal
|
||||
podman-desktop # Desktop client
|
||||
tailscale # Vpn
|
||||
];
|
||||
# Virtualisation
|
||||
virtualisation = {
|
||||
containers.enable = true;
|
||||
|
||||
podman = {
|
||||
enable = true;
|
||||
dockerCompat = true;
|
||||
defaultNetwork.settings.dns_enabled = true;
|
||||
};
|
||||
|
||||
oci-containers = {
|
||||
backend = "podman";
|
||||
containers = {
|
||||
/*
|
||||
container-name = {
|
||||
image = "image";
|
||||
autoStart = true;
|
||||
ports = [ "127.0.0.1:1234:1234" ];
|
||||
};
|
||||
*/
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
Reference in New Issue
Block a user