dotfiles/hosts/h001/containers/homarr.nix
2025-06-23 17:50:09 -05:00

47 lines
1 KiB
Nix

{
...
}:
let
name = "homarr";
hostDataDir = "/var/lib/${name}";
v_port = 7575;
in
{
virtualisation.oci-containers.containers = {
"${name}" = {
image = "ghcr.io/homarr-labs/homarr:latest";
ports = [
"127.0.0.1:${toString v_port}:${toString v_port}"
];
volumes = [
"${hostDataDir}:/appdata"
"/var/run/docker.sock:/var/run/docker.sock"
];
environment = {
SECRET_ENCRYPTION_KEY = "0b7e80116a742d16a8f07452a2d9b206b1997d32a6dd2c29cfe4df676e281295";
};
};
};
system.activationScripts."${name}_directories" = ''
mkdir -p ${hostDataDir}
chown -R root:root ${hostDataDir}
chmod -R 777 ${hostDataDir}
'';
services.nginx.virtualHosts = {
"100.64.0.13" = {
locations."/" = {
return = "301 http://h001.net.joshuabell.xyz";
};
};
"h001.net.joshuabell.xyz" = {
locations = {
"/" = {
proxyWebsockets = true;
proxyPass = "http://127.0.0.1:${builtins.toString v_port}";
};
};
};
};
}