mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-11-13 12:13:46 +01:00
refactor(youko): run homepage from the native NixOS module
services.homepage-dashboard runs the nixpkgs package with DynamicUser, replacing the :latest container, its system user and the activation script that rsynced the YAML into place. The YAML stays as is and is linked into /etc/homepage-dashboard. Assisted-by: Claude Code (claude-opus-5-5)
This commit is contained in:
1 parent
c8d8b17a27
commit
6fa6e6626e
13 files changed
+20
-57
No files matched your search
@@ -32,7 +32,7 @@ retired `aquamarine` VM — the name now belongs to the inference server, not th
|
|||||||
1. caddy: Reverse proxy / TLS front end and the `file.writefor.fun` file server (`caddy.nix`).
|
1. caddy: Reverse proxy / TLS front end and the `file.writefor.fun` file server (`caddy.nix`).
|
||||||
1. victoriametrics + vmalert + alertmanager + grafana: Monitor the metrics of my homelab
|
1. victoriametrics + vmalert + alertmanager + grafana: Monitor the metrics of my homelab
|
||||||
(`monitoring/`).
|
(`monitoring/`).
|
||||||
1. homepage + uptime-kuma: Service dashboard and uptime checks (`oci-containers/`).
|
1. homepage (`homepage/`) + uptime-kuma (`oci-containers/`): Service dashboard and uptime checks.
|
||||||
|
|
||||||
All the services assume a reverse proxy in front: they listen on localhost, and a caddy service
|
All the services assume a reverse proxy in front: they listen on localhost, and a caddy service
|
||||||
listens on the local network interface and proxies requests to them. The exception is transmission,
|
listens on the local network interface and proxies requests to them. The exception is transmission,
|
||||||
|
|||||||
File renamed without changes.
@@ -0,0 +1,18 @@
|
|||||||
|
{ lib, ... }:
|
||||||
|
{
|
||||||
|
services.homepage-dashboard = {
|
||||||
|
enable = true;
|
||||||
|
listenPort = 54401;
|
||||||
|
allowedHosts = "home.writefor.fun";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Keep the config as plain YAML instead of the module's Nix options.
|
||||||
|
environment.etc = lib.listToAttrs (
|
||||||
|
map (f: lib.nameValuePair "homepage-dashboard/${f}" { source = lib.mkForce ./${f}; }) [
|
||||||
|
"bookmarks.yaml"
|
||||||
|
"services.yaml"
|
||||||
|
"settings.yaml"
|
||||||
|
"widgets.yaml"
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -101,7 +101,7 @@ Applied — immich runs on youko. The steps below are the procedure as deployed:
|
|||||||
2. `./default.nix`: the `services.immich` configuration (server, database, machine-learning,
|
2. `./default.nix`: the `services.immich` configuration (server, database, machine-learning,
|
||||||
tmpfiles).
|
tmpfiles).
|
||||||
3. `../caddy.nix`: the `immich.writefor.fun` vhost.
|
3. `../caddy.nix`: the `immich.writefor.fun` vhost.
|
||||||
4. `../oci-containers/homepage/config/services.yaml`: dashboard entry.
|
4. `../homepage/services.yaml`: dashboard entry.
|
||||||
5. Preview and deploy: `just youko dry-activate`, then `just youko`.
|
5. Preview and deploy: `just youko dry-activate`, then `just youko`.
|
||||||
6. Register the first user (becomes admin), disable open signup, add the external library, trigger a
|
6. Register the first user (becomes admin), disable open signup, add the external library, trigger a
|
||||||
scan.
|
scan.
|
||||||
|
|||||||
Whitespace-only changes.
Whitespace-only changes.
@@ -1,3 +0,0 @@
|
|||||||
# kana-docker:
|
|
||||||
# socket: /var/run/docker.sock
|
|
||||||
#
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
# https://gethomepage.dev/latest/configs/kubernetes/
|
|
||||||
|
|
||||||
# uses the default kubeconfig to access the cluster
|
|
||||||
# read kubbecofig from $KUBECONFIG or $HOME/.kube/config
|
|
||||||
# mode: default
|
|
||||||
mode: disabled
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
{
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
user = "homepage";
|
|
||||||
configDir = "/var/lib/homepage-dashboard";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
users.groups.${user} = { };
|
|
||||||
users.users.${user} = {
|
|
||||||
group = user;
|
|
||||||
home = configDir;
|
|
||||||
isSystemUser = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Install the homepage-dashboard configuration files
|
|
||||||
system.activationScripts.installHomepageDashboardConfig = ''
|
|
||||||
mkdir -p ${configDir}
|
|
||||||
${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F644 ${./config}/ ${configDir}/
|
|
||||||
chown -R ${user}:${user} ${configDir}
|
|
||||||
'';
|
|
||||||
|
|
||||||
# https://github.com/NixOS/nixpkgs/blob/nixos-26.05/nixos/modules/virtualisation/oci-containers.nix
|
|
||||||
virtualisation.oci-containers.containers = {
|
|
||||||
# check its logs via `journalctl -u podman-homepage`
|
|
||||||
homepage = {
|
|
||||||
hostname = "homepage";
|
|
||||||
image = "ghcr.io/gethomepage/homepage:latest";
|
|
||||||
ports = [ "127.0.0.1:54401:3000" ];
|
|
||||||
# https://github.com/gethomepage/homepage#environment-variables
|
|
||||||
environment = {
|
|
||||||
# homepage rejects requests whose Host header it does not know about.
|
|
||||||
# caddy proxies with the original Host (`home.writefor.fun`).
|
|
||||||
HOMEPAGE_ALLOWED_HOSTS = "home.writefor.fun";
|
|
||||||
};
|
|
||||||
volumes = [
|
|
||||||
"${configDir}:/app/config"
|
|
||||||
];
|
|
||||||
autoStart = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -22,7 +22,6 @@
|
|||||||
node-exporter.uid = 992;
|
node-exporter.uid = 992;
|
||||||
microvm.uid = 993;
|
microvm.uid = 993;
|
||||||
immich.uid = 994;
|
immich.uid = 994;
|
||||||
homepage.uid = 995;
|
|
||||||
gitea.uid = 996;
|
gitea.uid = 996;
|
||||||
btrbk.uid = 997;
|
btrbk.uid = 997;
|
||||||
avahi.uid = 998;
|
avahi.uid = 998;
|
||||||
@@ -43,7 +42,6 @@
|
|||||||
plugdev.gid = 987;
|
plugdev.gid = 987;
|
||||||
node-exporter.gid = 989;
|
node-exporter.gid = 989;
|
||||||
immich.gid = 990;
|
immich.gid = 990;
|
||||||
homepage.gid = 991;
|
|
||||||
grafana.gid = 992;
|
grafana.gid = 992;
|
||||||
gitea.gid = 993;
|
gitea.gid = 993;
|
||||||
fileshare.gid = 994;
|
fileshare.gid = 994;
|
||||||
|
|||||||
Reference in new issue
Block a user