mirror of
https://github.com/Stunkymonkey/nixos.git
synced 2025-05-25 18:24:41 +02:00
treewide: fmt
This commit is contained in:
parent
330abe53d2
commit
ea37c7b836
95 changed files with 1162 additions and 779 deletions
|
@ -3,24 +3,26 @@
|
|||
{
|
||||
options.webapps = {
|
||||
dashboardCategories = lib.mkOption {
|
||||
type = lib.types.listOf (lib.types.submodule {
|
||||
options = {
|
||||
name = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
Category name.
|
||||
'';
|
||||
example = "Applications";
|
||||
type = lib.types.listOf (
|
||||
lib.types.submodule {
|
||||
options = {
|
||||
name = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
Category name.
|
||||
'';
|
||||
example = "Applications";
|
||||
};
|
||||
tag = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
Category tag.
|
||||
'';
|
||||
example = "app";
|
||||
};
|
||||
};
|
||||
tag = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
Category tag.
|
||||
'';
|
||||
example = "app";
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
);
|
||||
description = ''
|
||||
App categories to display on the dashboard.
|
||||
'';
|
||||
|
@ -34,8 +36,8 @@
|
|||
};
|
||||
|
||||
apps = lib.mkOption {
|
||||
type = lib.types.attrsOf
|
||||
(lib.types.submodule {
|
||||
type = lib.types.attrsOf (
|
||||
lib.types.submodule {
|
||||
options = {
|
||||
dashboard = {
|
||||
url = lib.mkOption {
|
||||
|
@ -79,7 +81,10 @@
|
|||
default = "Ping";
|
||||
};
|
||||
method = lib.mkOption {
|
||||
type = lib.types.enum [ "get" "head" ];
|
||||
type = lib.types.enum [
|
||||
"get"
|
||||
"head"
|
||||
];
|
||||
description = ''
|
||||
method of request used
|
||||
'';
|
||||
|
@ -88,7 +93,8 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
);
|
||||
description = ''
|
||||
Defines a web application.
|
||||
'';
|
||||
|
@ -105,24 +111,33 @@
|
|||
let
|
||||
apps = builtins.filter (a: a.dashboard.name != null) (lib.attrValues cfg.apps);
|
||||
in
|
||||
lib.forEach cfg.dashboardCategories (cat:
|
||||
lib.forEach cfg.dashboardCategories (
|
||||
cat:
|
||||
let
|
||||
catApps = lib.sort (a: b: a.dashboard.name < b.dashboard.name) (
|
||||
builtins.filter
|
||||
(a:
|
||||
a.dashboard.category != null && a.dashboard.category == cat.tag ||
|
||||
a.dashboard.category == null && cat.tag == "misc")
|
||||
apps);
|
||||
builtins.filter (
|
||||
a:
|
||||
a.dashboard.category != null && a.dashboard.category == cat.tag
|
||||
|| a.dashboard.category == null && cat.tag == "misc"
|
||||
) apps
|
||||
);
|
||||
in
|
||||
{
|
||||
inherit (cat) name;
|
||||
items = lib.forEach catApps (a: {
|
||||
inherit (a.dashboard) method name type url;
|
||||
inherit (a.dashboard)
|
||||
method
|
||||
name
|
||||
type
|
||||
url
|
||||
;
|
||||
icon = lib.optionalString (a.dashboard.icon != null) "fas fa-${a.dashboard.icon}";
|
||||
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 (_key: value: value.dashboard.url) config.webapps.apps
|
||||
++ [ "https://${config.networking.domain}/" ];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
# Dashboard site
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.services.homer;
|
||||
inherit (config.networking) domain;
|
||||
|
@ -14,9 +19,7 @@ let
|
|||
};
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
];
|
||||
imports = [ ./config.nix ];
|
||||
|
||||
options.my.services.homer = with lib; {
|
||||
enable = mkEnableOption "Homer Dashboard";
|
||||
|
@ -44,10 +47,22 @@ in
|
|||
|
||||
webapps = {
|
||||
dashboardCategories = [
|
||||
{ name = "Applications"; tag = "app"; }
|
||||
{ name = "Media"; tag = "media"; }
|
||||
{ name = "Infrastructure"; tag = "infra"; }
|
||||
{ name = "Others"; tag = "other"; }
|
||||
{
|
||||
name = "Applications";
|
||||
tag = "app";
|
||||
}
|
||||
{
|
||||
name = "Media";
|
||||
tag = "media";
|
||||
}
|
||||
{
|
||||
name = "Infrastructure";
|
||||
tag = "infra";
|
||||
}
|
||||
{
|
||||
name = "Others";
|
||||
tag = "other";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue