feat: Homepage
This commit is contained in:
@@ -6,9 +6,69 @@
|
||||
}:
|
||||
let
|
||||
cfg = config.my.profiles.homepage;
|
||||
dashboardPort = 8082;
|
||||
dashboardHost = config.networking.hostName;
|
||||
dashboardUrl = "http://${dashboardHost}:${toString dashboardPort}";
|
||||
|
||||
groupedServices =
|
||||
lib.foldl'
|
||||
(
|
||||
acc: entry:
|
||||
acc
|
||||
// {
|
||||
${entry.group} = (acc.${entry.group} or [ ]) ++ [ entry ];
|
||||
}
|
||||
)
|
||||
{ }
|
||||
config.my.homepage.services;
|
||||
|
||||
homepageServices = lib.mapAttrsToList (
|
||||
group: entries:
|
||||
{
|
||||
${group} = map (
|
||||
entry:
|
||||
{
|
||||
${entry.name} = builtins.removeAttrs entry [
|
||||
"group"
|
||||
"name"
|
||||
];
|
||||
}
|
||||
) entries;
|
||||
}
|
||||
) groupedServices;
|
||||
in
|
||||
{
|
||||
|
||||
options.my.homepage.services = with lib; mkOption {
|
||||
type = types.listOf (
|
||||
types.submodule {
|
||||
options = {
|
||||
group = mkOption {
|
||||
type = types.str;
|
||||
description = "Homepage service group";
|
||||
};
|
||||
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
description = "Homepage service name";
|
||||
};
|
||||
|
||||
description = mkOption {
|
||||
type = types.str;
|
||||
description = "Homepage service description";
|
||||
};
|
||||
|
||||
href = mkOption {
|
||||
type = types.str;
|
||||
description = "Homepage service URL";
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
default = [ ];
|
||||
description = "Merged homepage service metadata contributed by repo modules.";
|
||||
};
|
||||
|
||||
options.my.profiles.homepage = with lib; {
|
||||
enable = mkEnableOption "getHomepage.dev Dashboard";
|
||||
};
|
||||
@@ -16,13 +76,17 @@ in
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.homepage-dashboard = {
|
||||
enable = true;
|
||||
allowedHosts = "jupiter.solar.internal:8082";
|
||||
bookmarks = builtins.readFile ./bookmarks.yaml;
|
||||
listenPort = dashboardPort;
|
||||
allowedHosts = "${dashboardHost}:${toString dashboardPort},localhost:${toString dashboardPort},127.0.0.1:${toString dashboardPort}";
|
||||
bookmarks = import ./bookmarks.nix;
|
||||
services = homepageServices;
|
||||
};
|
||||
|
||||
users.users.finn.packages = with pkgs; [
|
||||
homepage-dashboard
|
||||
];
|
||||
programs.chromium.homepageLocation = "http://jupiter.solar.internal:8082";
|
||||
|
||||
programs.chromium.homepageLocation = dashboardUrl;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user