Cache podman containers for authentik
parent
d779caea87
commit
44d274c606
|
@ -40,7 +40,6 @@ SSO for almost everything running.
|
||||||
|
|
||||||
|
|
||||||
## TODO:
|
## TODO:
|
||||||
- Docker/podman images are currently not persisted, maybe they should be.
|
|
||||||
|
|
||||||
### Services
|
### Services
|
||||||
**For sure**:
|
**For sure**:
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
AUTHENTIK_VERSION = "2024.12.3";
|
|
||||||
publicEnv = pkgs.writeText "authentik-public.env" ''
|
publicEnv = pkgs.writeText "authentik-public.env" ''
|
||||||
AUTHENTIK_EMAIL__USE_TLS=false
|
AUTHENTIK_EMAIL__USE_TLS=false
|
||||||
AUTHENTIK_EMAIL__USE_SSL=true
|
AUTHENTIK_EMAIL__USE_SSL=true
|
||||||
|
@ -113,14 +112,14 @@
|
||||||
podman.containers = {
|
podman.containers = {
|
||||||
# TODO: Does using system redis make sense here?
|
# TODO: Does using system redis make sense here?
|
||||||
"authentik-redis" = {
|
"authentik-redis" = {
|
||||||
image = "docker.io/library/redis:7.4.2-alpine";
|
imageMetadata = import ./images/redis.nix;
|
||||||
autoStart = true;
|
autoStart = true;
|
||||||
volumes = [
|
volumes = [
|
||||||
"/appdata/authentik/redis:/data"
|
"/appdata/authentik/redis:/data"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
"authentik-server" = {
|
"authentik-server" = {
|
||||||
image = "ghcr.io/goauthentik/server:${AUTHENTIK_VERSION}";
|
imageMetadata = import ./images/server.nix;
|
||||||
autoStart = true;
|
autoStart = true;
|
||||||
cmd = [ "server" ];
|
cmd = [ "server" ];
|
||||||
environment = {
|
environment = {
|
||||||
|
@ -141,7 +140,7 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
"authentik-worker" = {
|
"authentik-worker" = {
|
||||||
image = "ghcr.io/goauthentik/server:${AUTHENTIK_VERSION}";
|
imageMetadata = import ./images/server.nix;
|
||||||
user = "root";
|
user = "root";
|
||||||
autoStart = true;
|
autoStart = true;
|
||||||
cmd = [ "worker" ];
|
cmd = [ "worker" ];
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
imageName = "docker.io/library/redis";
|
||||||
|
imageDigest = "sha256:5c30ac9c59d8fcddc368d0dd98f544b8b5ab3a981c633db59da7eff9d76b97cc"; # 7.4.2-alpine
|
||||||
|
sha256 = "8a4937f259307fa724fb1a9eac9862b5a9bfba555eba2a43e816cd40104e1692";
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
imageName = "ghcr.io/goauthentik/server";
|
||||||
|
imageDigest = "sha256:7464a70c0d84df0816858106116a3306a80359b4300aa656c3a5ab790a38c229"; # 2024.12.3
|
||||||
|
sha256 = "fadbb55b7ae1d84d7322538101e933caa021582e5120828040c3883a18b1b3d5";
|
||||||
|
}
|
|
@ -10,5 +10,5 @@
|
||||||
# Services
|
# Services
|
||||||
sonarr = utils.mkRole (import ./sonarr.nix);
|
sonarr = utils.mkRole (import ./sonarr.nix);
|
||||||
traefik = utils.mkRole (import ./traefik.nix);
|
traefik = utils.mkRole (import ./traefik.nix);
|
||||||
authentik = utils.mkRole (import ./authentik.nix);
|
authentik = utils.mkRole (import ./authentik);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,12 @@
|
||||||
'';
|
'';
|
||||||
|
|
||||||
nixosModule =
|
nixosModule =
|
||||||
{ lib, config, ... }:
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
{
|
{
|
||||||
options.podman = {
|
options.podman = {
|
||||||
containers = lib.mkOption {
|
containers = lib.mkOption {
|
||||||
|
@ -23,9 +28,21 @@
|
||||||
virtualisation.podman.defaultNetwork.settings.dns_enabled = true;
|
virtualisation.podman.defaultNetwork.settings.dns_enabled = true;
|
||||||
virtualisation.oci-containers.backend = "podman";
|
virtualisation.oci-containers.backend = "podman";
|
||||||
|
|
||||||
# TODO: Maybe we want to pre-fetch the images during build?
|
virtualisation.oci-containers.containers = lib.mapAttrs (
|
||||||
# This would ensure the config always reproduces the exact same system
|
_: container:
|
||||||
virtualisation.oci-containers.containers = cfg.containers;
|
lib.mkMerge [
|
||||||
|
(lib.mkIf (lib.hasAttr "imageMetadata" container) (
|
||||||
|
let
|
||||||
|
metadata = container.imageMetadata;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
image = "${metadata.imageName}:latest";
|
||||||
|
imageFile = pkgs.dockerTools.pullImage metadata;
|
||||||
|
}
|
||||||
|
))
|
||||||
|
(builtins.removeAttrs container [ "imageMetadata" ])
|
||||||
|
]
|
||||||
|
) cfg.containers;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue