mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 17:49:07 +01:00
glance: Add github action badges widget
This commit is contained in:
parent
52580f096d
commit
1bb4b6db32
1 changed files with 169 additions and 126 deletions
|
|
@ -16,7 +16,7 @@ let
|
||||||
|
|
||||||
hosts = allHosts |> lib.attrValues;
|
hosts = allHosts |> lib.attrValues;
|
||||||
|
|
||||||
applicationSites =
|
applicationSitesWidget =
|
||||||
hosts
|
hosts
|
||||||
|> lib.concatMap (host: host.config.custom.meta.sites |> lib.attrValues)
|
|> lib.concatMap (host: host.config.custom.meta.sites |> lib.attrValues)
|
||||||
|> lib.filter (service: !lib.elem service.title observabilityTitles)
|
|> lib.filter (service: !lib.elem service.title observabilityTitles)
|
||||||
|
|
@ -36,10 +36,9 @@ let
|
||||||
type = "split-column";
|
type = "split-column";
|
||||||
max-columns = 2;
|
max-columns = 2;
|
||||||
inherit widgets;
|
inherit widgets;
|
||||||
})
|
});
|
||||||
|> lib.singleton;
|
|
||||||
|
|
||||||
observabilitySites =
|
observabilitySitesWidget =
|
||||||
hosts
|
hosts
|
||||||
|> lib.map (host: {
|
|> lib.map (host: {
|
||||||
type = "monitor";
|
type = "monitor";
|
||||||
|
|
@ -55,48 +54,48 @@ let
|
||||||
type = "split-column";
|
type = "split-column";
|
||||||
max-columns = widgets |> lib.length;
|
max-columns = widgets |> lib.length;
|
||||||
inherit widgets;
|
inherit widgets;
|
||||||
})
|
});
|
||||||
|> lib.singleton;
|
|
||||||
|
githubWorkflowFiles =
|
||||||
|
"${self}/.github/workflows"
|
||||||
|
|> builtins.readDir
|
||||||
|
|> lib.attrNames
|
||||||
|
|> lib.filter (file: file |> lib.hasSuffix ".yml")
|
||||||
|
|> lib.filter (file: file |> lib.hasPrefix "_" |> (hasPrefix: !hasPrefix));
|
||||||
|
|
||||||
|
mkGithubWorkflowBadge =
|
||||||
|
workflowFile:
|
||||||
|
let
|
||||||
|
workflowName = workflowFile |> lib.removeSuffix ".yml";
|
||||||
|
workflowUrl = "https://github.com/SebastianStork/nixos-config/actions/workflows/${workflowFile}";
|
||||||
in
|
in
|
||||||
{
|
''
|
||||||
options.custom.web-services.glance = {
|
<a class="block" href="${workflowUrl}" target="_blank" rel="noopener noreferrer">
|
||||||
enable = lib.mkEnableOption "";
|
<img
|
||||||
domain = lib.mkOption {
|
class="block"
|
||||||
type = lib.types.nonEmptyStr;
|
src="${workflowUrl}/badge.svg"
|
||||||
default = "";
|
alt="${workflowName} workflow status"
|
||||||
};
|
/>
|
||||||
port = lib.mkOption {
|
</a>
|
||||||
type = lib.types.port;
|
'';
|
||||||
default = 63958;
|
|
||||||
};
|
githubWorkflowBadges =
|
||||||
|
githubWorkflowFiles |> lib.map mkGithubWorkflowBadge |> lib.concatStringsSep "\n";
|
||||||
|
|
||||||
|
githubBadgeWidget = {
|
||||||
|
type = "custom-api";
|
||||||
|
title = "nixos-config";
|
||||||
|
title-url = "https://github.com/SebastianStork/nixos-config";
|
||||||
|
template = ''
|
||||||
|
<div class="flex flex-col items-start gap-10">
|
||||||
|
<div class="flex flex-wrap gap-10">
|
||||||
|
${githubWorkflowBadges}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
bookmarksWidget = {
|
||||||
services.glance = {
|
|
||||||
enable = true;
|
|
||||||
|
|
||||||
settings = {
|
|
||||||
server.port = cfg.port;
|
|
||||||
|
|
||||||
pages = lib.singleton {
|
|
||||||
name = "Home";
|
|
||||||
center-vertically = true;
|
|
||||||
|
|
||||||
columns = [
|
|
||||||
{
|
|
||||||
size = "full";
|
|
||||||
widgets =
|
|
||||||
lib.singleton {
|
|
||||||
type = "search";
|
|
||||||
search-engine = "https://search.splitleaf.de/search?q={QUERY}";
|
|
||||||
autofocus = true;
|
|
||||||
}
|
|
||||||
++ applicationSites
|
|
||||||
++ observabilitySites;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
size = "small";
|
|
||||||
widgets = lib.singleton {
|
|
||||||
type = "bookmarks";
|
type = "bookmarks";
|
||||||
groups = [
|
groups = [
|
||||||
{
|
{
|
||||||
|
|
@ -162,7 +161,7 @@ in
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
title = "Function Search";
|
title = "Function Search";
|
||||||
url = "https://home-manager-options.extranix.com/";
|
url = "https://noogle.dev/";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
title = "GitHub Code Search";
|
title = "GitHub Code Search";
|
||||||
|
|
@ -212,6 +211,50 @@ in
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.custom.web-services.glance = {
|
||||||
|
enable = lib.mkEnableOption "";
|
||||||
|
domain = lib.mkOption {
|
||||||
|
type = lib.types.nonEmptyStr;
|
||||||
|
default = "";
|
||||||
|
};
|
||||||
|
port = lib.mkOption {
|
||||||
|
type = lib.types.port;
|
||||||
|
default = 63958;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
services.glance = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
server.port = cfg.port;
|
||||||
|
|
||||||
|
pages = lib.singleton {
|
||||||
|
name = "Home";
|
||||||
|
center-vertically = true;
|
||||||
|
|
||||||
|
columns = [
|
||||||
|
{
|
||||||
|
size = "full";
|
||||||
|
widgets = [
|
||||||
|
{
|
||||||
|
type = "search";
|
||||||
|
search-engine = "https://search.splitleaf.de/search?q={QUERY}";
|
||||||
|
autofocus = true;
|
||||||
|
}
|
||||||
|
applicationSitesWidget
|
||||||
|
observabilitySitesWidget
|
||||||
|
];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
size = "small";
|
||||||
|
widgets = [
|
||||||
|
githubBadgeWidget
|
||||||
|
bookmarksWidget
|
||||||
|
];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue