container framework + initial work on signal-cli + hermes
This commit is contained in:
1 parent
50ef9c7238
commit
cf2f221a94
7 files changed
+461
-20
No files matched your search
@@ -1,19 +1,22 @@
|
||||
# modules/nixos/common/containers/
|
||||
|
||||
Container runtime configuration. Picks **one** of Docker or Podman based on
|
||||
`skyg.nixos.common.containers.runtime` and configures it consistently (compose tooling,
|
||||
user group membership, OCI backend, metrics).
|
||||
Container runtime configuration and compose-style service groups.
|
||||
|
||||
## Files
|
||||
|
||||
```
|
||||
containers/
|
||||
├── default.nix # Shared options: runtime, enableOnBoot, registries, metrics port
|
||||
├── docker.nix # Applied when runtime == "docker"
|
||||
└── podman.nix # Applied when runtime == "podman" (dockerCompat + socket)
|
||||
├── default.nix # Shared runtime options (runtime, enableOnBoot, registries, metrics)
|
||||
├── docker.nix # Applied when runtime == "docker"
|
||||
├── podman.nix # Applied when runtime == "podman" (dockerCompat + socket)
|
||||
├── container-services.nix # Compose-style groups → rendered compose.yml + systemd oneshot
|
||||
└── user-guide.md # Full usage docs for container-services
|
||||
```
|
||||
|
||||
## Behaviour
|
||||
## Runtime selection (`skyg.nixos.common.containers`)
|
||||
|
||||
Picks **one** of Docker or Podman based on `runtime` and configures it
|
||||
consistently (compose tooling, user group membership, OCI backend, metrics).
|
||||
|
||||
- `runtime` defaults to `"docker"`. Each backend file gates on `cfg.runtime == "<name>"`,
|
||||
so exactly one applies.
|
||||
@@ -24,7 +27,7 @@ containers/
|
||||
and installs `podman-compose` + `podman-tui`.
|
||||
- `openMetricsPort` opens the metrics port in the firewall (Docker only).
|
||||
|
||||
## Option Namespace
|
||||
### Option namespace
|
||||
|
||||
```
|
||||
skyg.nixos.common.containers.runtime → "docker" | "podman"
|
||||
@@ -34,8 +37,35 @@ skyg.nixos.common.containers.metricsPort
|
||||
skyg.nixos.common.containers.openMetricsPort
|
||||
```
|
||||
|
||||
## Container service groups (`skyg.nixos.common.container-services`)
|
||||
|
||||
A compose-like abstraction that:
|
||||
|
||||
1. Converts a Nix attrset into a real `compose.yml` via `pkgs.formats.yaml`.
|
||||
2. Stages it to `/var/lib/container-services/<group>/compose.yml` at activation.
|
||||
3. Manages the whole stack with one systemd oneshot unit per group:
|
||||
`container-services-<group>.service`.
|
||||
|
||||
```nix
|
||||
skyg.nixos.common.container-services.my-stack = {
|
||||
services.app = {
|
||||
image = "example/app:latest";
|
||||
ports = [ "8080:8080" ];
|
||||
volumes = [ "/var/lib/app:/data" ];
|
||||
environmentFiles = [ config.age.secrets.app-env.path ];
|
||||
extraConfig.shm_size = "512m";
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
See [user-guide.md](./user-guide.md) for the full option reference and day-2 ops.
|
||||
|
||||
## Conventions
|
||||
|
||||
- Always select the runtime via the `runtime` option; do not enable both backends manually.
|
||||
- Always select the runtime via `skyg.nixos.common.containers.runtime`; do not enable both
|
||||
backends manually.
|
||||
- `virtualisation.oci-containers.backend` is set by whichever runtime is active, so server
|
||||
service modules can declare containers backend-agnostically.
|
||||
service modules can declare containers backend-agnostically via `virtualisation.oci-containers`.
|
||||
- Prefer `container-services` for new stacks. Only reach for raw
|
||||
`virtualisation.oci-containers.containers` for single-container services with no
|
||||
inter-container networking needs.
|
||||
Reference in new issue
Block a user