This commit is contained in:
aloslider committed 2026-10-01 13:59:54 +03:00
1 parent 13e407847f
commit 374428658a
80 files changed
+2517 -1058

No files matched your search

@@ -0,0 +1,26 @@
{ config, lib, ... }:
with lib;
let
rootCfg = config.selfhosted.homarr;
poCfg = config.selfhosted.pocket-id;
oidpDomain = "https://${poCfg.subdomain}.${config.sops.placeholder."domains/serv"}";
in
{
config = mkIf rootCfg.enable {
sops.templates."homarr.env" = {
content = ''
SECRET_ENCRYPTION_KEY=${config.sops.placeholder."homarr/enc_key"}
NEXTAUTH_SECRET=${config.sops.placeholder."homarr/nextauth_secret"}
AUTH_PROVIDERS=oidc
AUTH_OIDC_CLIENT_ID=${config.sops.placeholder."homarr/client_id"}
AUTH_OIDC_CLIENT_SECRET=${config.sops.placeholder."homarr/client_secret"}
AUTH_OIDC_ISSUER=${oidpDomain}
AUTH_OIDC_CLIENT_NAME="Pocket ID"
AUTH_OIDC_SCOPE_OVERWRITE=openid email profile groups
AUTH_OIDC_GROUPS_ATTRIBUTE=groups
AUTH_LOGOUT_REDIRECT_URL=${oidpDomain}
AUTH_OIDC_AUTO_LOGIN=true
'';
};
};
}
@@ -0,0 +1,52 @@
{ config, lib, ... }:
with lib;
let
common = config.selfhosted.common;
rootCfg = config.selfhosted.homarr;
cfg = rootCfg.server;
hostDataPath = "${common.dataDir}/homarr";
in
{
imports = [ ./config.nix ];
options.selfhosted.homarr.server = {
name = mkOption {
type = types.str;
};
subdomain = mkOption {
type = types.str;
};
hostHttpPort = mkOption {
type = types.port;
};
};
config = mkIf rootCfg.enable {
virtualisation.oci-containers.containers."${cfg.name}" = {
image = "ghcr.io/homarr-labs/homarr:latest";
ports = [
"0.0.0.0:${toString cfg.hostHttpPort}:7575"
];
environmentFiles = [ config.sops.templates."homarr.env".path ];
volumes = [
"${hostDataPath}/data:/appdata"
"/var/run/docker.sock:/var/run/docker.sock"
];
log-driver = "journald";
extraOptions = [
"--network=${common.network.name}"
];
};
systemd.services."${common.backend}-${cfg.name}" = {
serviceConfig = {
Restart = lib.mkOverride 90 "always";
};
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
preStart = ''
mkdir -p ${hostDataPath}/data
'';
};
};
}