Compare commits

...

2 commits

Author SHA1 Message Date
Felix Buehler
f1b9c9edca flake: update
Some checks failed
/ Build Nix targets (push) Has been cancelled
2025-05-28 21:55:33 +02:00
Felix Buehler
6d3a814015 service/homer: simplify 2025-05-28 20:48:17 +02:00
3 changed files with 45 additions and 47 deletions

18
flake.lock generated
View file

@ -7,11 +7,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1747742835, "lastModified": 1748225455,
"narHash": "sha256-kYL4GCwwznsypvsnA20oyvW8zB/Dvn6K5G/tgMjVMT4=", "narHash": "sha256-AzlJCKaM4wbEyEpV3I/PUq5mHnib2ryEy32c+qfj6xk=",
"owner": "nix-community", "owner": "nix-community",
"repo": "disko", "repo": "disko",
"rev": "df522e787fdffc4f32ed3e1fca9ed0968a384d62", "rev": "a894f2811e1ee8d10c50560551e50d6ab3c392ba",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -242,11 +242,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1747953325, "lastModified": 1748302896,
"narHash": "sha256-y2ZtlIlNTuVJUZCqzZAhIw5rrKP4DOSklev6c8PyCkQ=", "narHash": "sha256-ixMT0a8mM091vSswlTORZj93WQAJsRNmEvqLL+qwTFM=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "55d1f923c480dadce40f5231feb472e81b0bab48", "rev": "7848cd8c982f7740edf76ddb3b43d234cb80fc4d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -296,11 +296,11 @@
}, },
"nixpkgs-unstable": { "nixpkgs-unstable": {
"locked": { "locked": {
"lastModified": 1747744144, "lastModified": 1748370509,
"narHash": "sha256-W7lqHp0qZiENCDwUZ5EX/lNhxjMdNapFnbErcbnP11Q=", "narHash": "sha256-QlL8slIgc16W5UaI3w7xHQEP+Qmv/6vSNTpoZrrSlbk=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "2795c506fe8fb7b03c36ccb51f75b6df0ab2553f", "rev": "4faa5f5321320e49a78ae7848582f684d64783e9",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -105,39 +105,46 @@
config = config =
let let
cfg = config.webapps; cfg = config.webapps;
appsWithName = builtins.filter (app: app.dashboard.name != null) (lib.attrValues cfg.apps);
in in
{ {
lib.webapps.homerServices = lib.webapps.homerServices = lib.forEach cfg.dashboardCategories (
category:
let let
apps = builtins.filter (a: a.dashboard.name != null) (lib.attrValues cfg.apps); catTag = category.tag;
catApps = lib.sort (a: b: a.dashboard.name < b.dashboard.name) (
builtins.filter (
app:
let
cat = app.dashboard.category;
in
(cat != null && cat == catTag) || (cat == null && catTag == "misc")
) appsWithName
);
in in
lib.forEach cfg.dashboardCategories ( {
cat: inherit (category) name;
let items = lib.forEach catApps (
catApps = lib.sort (a: b: a.dashboard.name < b.dashboard.name) ( app:
builtins.filter ( let
a: dash = app.dashboard;
a.dashboard.category != null && a.dashboard.category == cat.tag in
|| a.dashboard.category == null && cat.tag == "misc" {
) apps inherit (dash)
);
in
{
inherit (cat) name;
items = lib.forEach catApps (a: {
inherit (a.dashboard)
method method
name name
type type
url url
; ;
icon = lib.optionalString (a.dashboard.icon != null) "fas fa-${a.dashboard.icon}"; icon = lib.optionalString (dash.icon != null) "fas fa-${dash.icon}";
target = "_blank"; target = "_blank";
}); }
} );
); }
my.services.blackbox.http_endpoints = );
lib.mapAttrsToList (_key: value: value.dashboard.url) config.webapps.apps
++ [ "https://${config.networking.domain}/" ]; my.services.blackbox.http_endpoints = lib.mapAttrsToList (_: app: app.dashboard.url) cfg.apps ++ [
"https://${config.networking.domain}/"
];
}; };
} }

View file

@ -10,10 +10,8 @@ let
inherit (config.networking) domain; inherit (config.networking) domain;
homeConfig = { homeConfig = {
title = "Dashboard";
header = false; header = false;
footer = false; footer = false;
connectivityCheck = true;
columns = "auto"; columns = "auto";
services = config.lib.webapps.homerServices; services = config.lib.webapps.homerServices;
}; };
@ -26,18 +24,11 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
# TODO: 25.05 use stable services.homer = {
services.caddy.virtualHosts.${domain} = { enable = true;
extraConfig = '' virtualHost.caddy.enable = true;
import common virtualHost.domain = domain;
root * ${pkgs.unstable.homer} settings = homeConfig;
file_server
handle_path /assets/config.yml {
root * ${pkgs.writeText "homerConfig.yml" (builtins.toJSON homeConfig)}
file_server
}
'';
useACMEHost = domain;
}; };
webapps = { webapps = {