New server docker

This commit is contained in:
soraefir
2026-05-04 23:04:48 +02:00
parent 1566aca2b8
commit 662424f1d1
10 changed files with 45 additions and 21 deletions

View File

@@ -11,9 +11,10 @@
dockerSocket.enable = true;
dockerCompat = true;
defaultNetwork.settings = {
dnsname.enable = true;
internal = true;
name = "internal";
#dnsname.enable = true;
dns_enabled = true;
#internal = true;
#name = "internal";
};
};
};

View File

@@ -1,13 +0,0 @@
{ config, pkgs, lib, ... }:{
config = lib.mkIf (config.syscfg.server.arion) {
environment.systemPackages = with pkgs; [ arion ];
virtualisation.arion = {
backend = "podman-socket";
projects = {
cloud.settings = import ../docker/cloud.nix { inherit config pkgs lib; };
authentik.settings =
import ../docker/authentik.nix { inherit config pkgs lib; };
};
};
};
}

View File

@@ -0,0 +1,27 @@
{ config, pkgs, lib, ... }:
let
# enabledContainers = lib.filterAttrs (name: cfg: cfg.enable) config.syscfg.server.containers;
# containerImports = {
# cloud = import ./defs/cloud.nix;
# authentik = import ./defs/authentik.nix;
# };
containerDir = ./defs;
allFiles = builtins.readDir containerDir;
enabledNames = lib.filterAttrs (name: cfg: cfg.enable) config.syscfg.server.containers;
activeContainers = lib.mapAttrs (name: cfg:
let
fileName = "${name}.nix";
in
if builtins.hasAttr fileName allFiles
then import (containerDir + "/${fileName}")
else throw "Container config for '${name}' enabled, but ${containerDir}/${fileName} does not exist!"
) enabledNames;
in
{
config = lib.mkIf ( enabledNames != {} ) {
virtualisation.oci-containers = {
backend = "podman";
containers = activeContainers;
};
};
}

View File

@@ -1,3 +1,3 @@
{ config, pkgs, lib, ... }:{
imports = [ ./sops ./nftables ./openssh ./arion ];
imports = [ ./sops ./nftables ./openssh ./containers ];
}

View File

@@ -102,9 +102,15 @@ let
type = types.str;
default = "/media/data";
};
arion = mkOption {
type = types.bool;
default = false;
containers = lib.mkOption {
type = lib.types.attrsOf (lib.types.submodule {
options = {
enable = {type = types.bool;default = false;};
port = lib.mkOption { type = lib.types.port; };
special_param = lib.mkOption { type = lib.types.str; default = ""; };
};
});
default = {};
};
sops = mkOption {
type = types.bool;

View File

@@ -29,7 +29,10 @@
dbHost = "localhost";
arion = true;
containers = {
cloud.enable = true;
authentik.enable = true;
};
};
};
}