New server docker
This commit is contained in:
@@ -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";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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; };
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
27
modules/server/containers/default.nix
Normal file
27
modules/server/containers/default.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
{ config, pkgs, lib, ... }:{
|
||||
imports = [ ./sops ./nftables ./openssh ./arion ];
|
||||
imports = [ ./sops ./nftables ./openssh ./containers ];
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -29,7 +29,10 @@
|
||||
|
||||
dbHost = "localhost";
|
||||
|
||||
arion = true;
|
||||
containers = {
|
||||
cloud.enable = true;
|
||||
authentik.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user