Update docker/podman config

This commit is contained in:
DashieTM 2024-11-02 12:51:50 +01:00
parent d703b4dec0
commit 0c1291d3fd
7 changed files with 85 additions and 72 deletions

View file

@ -1,7 +1,6 @@
{
config,
lib,
options,
...
}:
let
@ -41,7 +40,7 @@ in
};
nix = {
extraOptions = lib.mkIf (options ? config.sops.secrets.access.path) ''
extraOptions = lib.mkIf (config ? sops.secrets && config.sops.secrets ? access.path) ''
!include ${config.sops.secrets.access.path}
'';
};

View file

@ -0,0 +1,79 @@
{
lib,
config,
options,
pkgs,
...
}:
{
options.mods.containers = {
variant = lib.mkOption {
default = "";
example = "podman";
type = lib.types.enum [
""
"podman"
"docker"
];
description = "Enables and configures a containerization solution: podman/docker";
};
podmanPackages = lib.mkOption {
default = with pkgs; [
podman-tui
podman-compose
];
example = [ ];
type = with lib.types; listOf package;
description = "Podman packages";
};
dockerPackages = lib.mkOption {
default = with pkgs; [
docker-compose
];
example = [ ];
type = with lib.types; listOf package;
description = "Docker packages";
};
combinedPackages = lib.mkOption {
default = with pkgs; [
dive
];
example = [ ];
type = with lib.types; listOf package;
description = "Container packages";
};
};
config = (
lib.optionalAttrs (options ? environment.systemPackages) {
environment.systemPackages =
(lib.lists.optionals (
config.mods.containers.variant == "podman"
) config.mods.containers.podmanPackages)
++ (lib.lists.optionals (
config.mods.containers.variant == "docker"
) config.mods.containers.dockerPackages)
++ (lib.lists.optionals (
config.mods.containers.variant == "podman" || config.mods.containers.variant == "docker"
) config.mods.containers.combinedPackages);
virtualisation =
if (config.mods.containers.variant == "podman") then
{
containers.enable = true;
podman = {
enable = true;
dockerCompat = true;
defaultNetwork.settings.dns_enabled = true;
};
}
else if (config.mods.containers.variant == "docker") then
{
containers.enable = true;
docker = {
enable = true;
};
}
else
{ };
}
);
}

View file

@ -5,6 +5,7 @@
./bluetooth.nix
./browser
./coding.nix
./containers.nix
./drives.nix
./fish.nix
./flatpak.nix
@ -22,12 +23,11 @@
./keepassxc.nix
./kitty.nix
./media.nix
./mime.nix
./ncspot.nix
./nextcloud.nix
./oxi
./piper.nix
./podman.nix
./docker.nix
./printing.nix
./scripts.nix
./sddm.nix
@ -36,7 +36,6 @@
./stylix.nix
./teams.nix
./virtualbox.nix
./mime.nix
./xkb.nix
./xone.nix
./yazi

View file

@ -1,32 +0,0 @@
{
lib,
config,
options,
pkgs,
...
}:
{
# TODO make exclusive with docker
options.mods.docker = {
enable = lib.mkOption {
default = false;
example = false;
type = lib.types.bool;
description = "Enables and configures docker";
};
};
config = lib.mkIf config.mods.docker.enable (
lib.optionalAttrs (options ? virtualisation.docker) {
environment.systemPackages = with pkgs; [
docker-compose
dive
];
virtualisation = {
containers.enable = true;
docker = {
enable = true;
};
};
}
);
}

View file

@ -64,6 +64,8 @@
abbr --add cat 'bat'
abbr --add find 'fd'
abbr --add rm 'rip'
abbr --add cp 'fcp'
abbr --add cd 'z'
set fish_greeting
# pwd based on the value of _ZO_RESOLVE_SYMLINKS.

View file

@ -87,7 +87,6 @@
if config.mods.homePackages.useDefaultPackages then
with pkgs;
[
# TODO add fcp once fixed....
(lib.mkIf config.mods.homePackages.ncspot ncspot)
(lib.mkIf config.mods.homePackages.vesktop vesktop)
(lib.mkIf config.mods.homePackages.nextcloudClient nextcloud-client)
@ -120,6 +119,7 @@
pulseaudio
libsForQt5.qt5ct
qt6ct
fcp
ripgrep
rm-improved
system-config-printer

View file

@ -1,34 +0,0 @@
{
lib,
config,
options,
pkgs,
...
}:
{
options.mods.podman = {
enable = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
description = "Enables and configures podman";
};
};
config = lib.mkIf config.mods.podman.enable (
lib.optionalAttrs (options ? virtualisation.podman) {
environment.systemPackages = with pkgs; [
podman-tui
podman-compose
dive
];
virtualisation = {
containers.enable = true;
podman = {
enable = true;
dockerCompat = true;
defaultNetwork.settings.dns_enabled = true;
};
};
}
);
}