mirror of
https://github.com/anotherhadi/nixy.git
synced 2026-04-02 11:12:09 +02:00
glance rewrite
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
@@ -1,345 +0,0 @@
|
||||
# Glance is a self-hosted homepage/dashboard service.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
domain = "start.hadi.diy";
|
||||
|
||||
rgb-to-hsl = color: let
|
||||
r = ((lib.toInt config.lib.stylix.colors."${color}-rgb-r") * 100.0) / 255;
|
||||
g = ((lib.toInt config.lib.stylix.colors."${color}-rgb-g") * 100.0) / 255;
|
||||
b = ((lib.toInt config.lib.stylix.colors."${color}-rgb-b") * 100.0) / 255;
|
||||
max = lib.max r (lib.max g b);
|
||||
min = lib.min r (lib.min g b);
|
||||
delta = max - min;
|
||||
fmod = base: int: base - (int * builtins.floor (base / int));
|
||||
h =
|
||||
if delta == 0
|
||||
then 0
|
||||
else if max == r
|
||||
then 60 * (fmod ((g - b) / delta) 6)
|
||||
else if max == g
|
||||
then 60 * (((b - r) / delta) + 2)
|
||||
else if max == b
|
||||
then 60 * (((r - g) / delta) + 4)
|
||||
else 0;
|
||||
l = (max + min) / 2;
|
||||
s =
|
||||
if delta == 0
|
||||
then 0
|
||||
else 100 * delta / (100 - lib.max (2 * l - 100) (100 - (2 * l)));
|
||||
roundToString = value: toString (builtins.floor (value + 0.5));
|
||||
in
|
||||
lib.concatMapStringsSep " " roundToString [h s l];
|
||||
in {
|
||||
services = {
|
||||
glance = {
|
||||
enable = true;
|
||||
settings = {
|
||||
theme = {
|
||||
contrast-multiplier = lib.mkForce 1.4;
|
||||
};
|
||||
pages = [
|
||||
{
|
||||
hide-desktop-navigation = true;
|
||||
columns = [
|
||||
{
|
||||
size = "small";
|
||||
widgets = [
|
||||
{
|
||||
type = "clock";
|
||||
hour-format = "24h";
|
||||
}
|
||||
{
|
||||
type = "weather";
|
||||
location = "Paris, France";
|
||||
}
|
||||
{
|
||||
type = "markets";
|
||||
markets = [
|
||||
{
|
||||
symbol = "BTC-USD";
|
||||
name = "Bitcoin";
|
||||
chart-link = "https://www.tradingview.com/chart/?symbol=INDEX:BTCUSD";
|
||||
}
|
||||
{
|
||||
symbol = "SOL-USD";
|
||||
name = "Solana";
|
||||
chart-link = "https://www.tradingview.com/chart/?symbol=INDEX:SOLUSD";
|
||||
}
|
||||
{
|
||||
symbol = "ETH-USD";
|
||||
name = "Ethereum";
|
||||
chart-link = "https://www.tradingview.com/chart/?symbol=INDEX:ETHUSD";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
type = "dns-stats";
|
||||
service = "adguard";
|
||||
url = "https://adguard.hadi.diy";
|
||||
username = "hadi";
|
||||
password = "\${secret:adguard-pwd}";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
size = "full";
|
||||
widgets = [
|
||||
{
|
||||
type = "search";
|
||||
search-engine = "duckduckgo";
|
||||
}
|
||||
{
|
||||
type = "bookmarks";
|
||||
groups = [
|
||||
{
|
||||
title = "";
|
||||
same-tab = true;
|
||||
color = "200 50 50";
|
||||
links = [
|
||||
{
|
||||
title = "ProtonMail";
|
||||
url = "https://proton.me/mail";
|
||||
}
|
||||
{
|
||||
title = "Github";
|
||||
url = "https://github.com";
|
||||
}
|
||||
{
|
||||
title = "Youtube";
|
||||
url = "https://youtube.com";
|
||||
}
|
||||
{
|
||||
title = "Figma";
|
||||
url = "https://figma.com";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
title = "Docs";
|
||||
same-tab = true;
|
||||
color = "200 50 50";
|
||||
links = [
|
||||
{
|
||||
title = "Nixpkgs repo";
|
||||
url = "https://github.com/NixOS/nixpkgs";
|
||||
}
|
||||
{
|
||||
title = "Nixvim";
|
||||
url = "https://nix-community.github.io/nixvim/";
|
||||
}
|
||||
{
|
||||
title = "Hyprland wiki";
|
||||
url = "https://wiki.hyprland.org/";
|
||||
}
|
||||
{
|
||||
title = "Search NixOS";
|
||||
url = "https://search-nixos.hadi.diy";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
title = "Homelab";
|
||||
same-tab = true;
|
||||
color = "100 50 50";
|
||||
links = [
|
||||
{
|
||||
title = "Router";
|
||||
url = "http://192.168.1.254/";
|
||||
}
|
||||
{
|
||||
title = "Cloudflare";
|
||||
url = "https://dash.cloudflare.com/";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
title = "Work";
|
||||
same-tab = true;
|
||||
color = "50 50 50";
|
||||
links = [
|
||||
{
|
||||
title = "Outlook";
|
||||
url = "https://outlook.office.com/";
|
||||
}
|
||||
{
|
||||
title = "Teams";
|
||||
url = "https://teams.microsoft.com/";
|
||||
}
|
||||
{
|
||||
title = "Office";
|
||||
url = "https://www.office.com/";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
title = "Cyber";
|
||||
same-tab = true;
|
||||
color = rgb-to-hsl "base09";
|
||||
links = [
|
||||
{
|
||||
title = "CyberChef";
|
||||
url = "https://cyberchef.org/";
|
||||
}
|
||||
{
|
||||
title = "TryHackMe";
|
||||
url = "https://tryhackme.com/";
|
||||
}
|
||||
{
|
||||
title = "RootMe";
|
||||
url = "https://www.root-me.org/";
|
||||
}
|
||||
{
|
||||
title = "Exploit-DB";
|
||||
url = "https://www.exploit-db.com/";
|
||||
}
|
||||
{
|
||||
title = "CrackStation";
|
||||
url = "https://crackstation.net/";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
title = "Misc";
|
||||
same-tab = true;
|
||||
color = rgb-to-hsl "base01";
|
||||
links = [
|
||||
{
|
||||
title = "Svgl";
|
||||
url = "https://svgl.app/";
|
||||
}
|
||||
{
|
||||
title = "Excalidraw";
|
||||
url = "https://excalidraw.com/";
|
||||
}
|
||||
{
|
||||
title = "Cobalt (Downloader)";
|
||||
url = "https://cobalt.tools/";
|
||||
}
|
||||
{
|
||||
title = "Mazanoke (Image optimizer)";
|
||||
url = "https://mazanoke.com/";
|
||||
}
|
||||
{
|
||||
title = "Vert (File converter)";
|
||||
url = "https://vert.sh/";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
type = "server-stats";
|
||||
servers = [
|
||||
{
|
||||
type = "local";
|
||||
name = "Jack";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
type = "group";
|
||||
widgets = [
|
||||
{
|
||||
type = "monitor";
|
||||
title = "Services";
|
||||
cache = "1m";
|
||||
sites = [
|
||||
{
|
||||
title = "Vaultwarden";
|
||||
url = "https://vault.hadi.diy";
|
||||
icon = "si:bitwarden";
|
||||
}
|
||||
{
|
||||
title = "Nextcloud";
|
||||
url = "https://cloud.hadi.diy";
|
||||
icon = "si:nextcloud";
|
||||
}
|
||||
{
|
||||
title = "Adguard";
|
||||
url = "https://adguard.hadi.diy";
|
||||
icon = "si:adguard";
|
||||
}
|
||||
{
|
||||
title = "Mealie";
|
||||
url = "https://mealie.hadi.diy";
|
||||
icon = "si:mealie";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
type = "monitor";
|
||||
title = "*arr";
|
||||
cache = "1m";
|
||||
sites = [
|
||||
{
|
||||
title = "Jellyfin";
|
||||
url = "https://jellyfin.hadi.diy";
|
||||
icon = "si:jellyfin";
|
||||
}
|
||||
{
|
||||
title = "Jellyseerr";
|
||||
url = "https://jellyseerr.hadi.diy";
|
||||
icon = "si:odysee";
|
||||
}
|
||||
{
|
||||
title = "Radarr";
|
||||
url = "https://radarr.hadi.diy";
|
||||
icon = "si:radarr";
|
||||
}
|
||||
{
|
||||
title = "Sonarr";
|
||||
url = "https://sonarr.hadi.diy";
|
||||
icon = "si:sonarr";
|
||||
}
|
||||
{
|
||||
title = "Prowlarr";
|
||||
url = "https://prowlarr.hadi.diy";
|
||||
icon = "si:podcastindex";
|
||||
}
|
||||
{
|
||||
title = "Transmission";
|
||||
url = "https://transmission.hadi.diy";
|
||||
icon = "si:transmission";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
name = "Home";
|
||||
}
|
||||
];
|
||||
server = {port = 5678;};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.glance = {
|
||||
serviceConfig = {
|
||||
DynamicUser = lib.mkForce false;
|
||||
User = "glance";
|
||||
Group = "glance";
|
||||
};
|
||||
};
|
||||
|
||||
users = {
|
||||
groups.glance = {};
|
||||
users.glance = {
|
||||
isSystemUser = true;
|
||||
description = "Glance user";
|
||||
group = "glance";
|
||||
};
|
||||
};
|
||||
|
||||
sops.secrets.adguard-pwd = {
|
||||
owner = "glance";
|
||||
mode = "0600";
|
||||
};
|
||||
|
||||
services.cloudflared.tunnels."f7c8f777-a36c-4b9a-b6e3-6a112bd43e73".ingress."start.hadi.diy" = "http://localhost:${toString config.services.glance.settings.server.port}";
|
||||
}
|
||||
43
server-modules/glance/default.nix
Normal file
43
server-modules/glance/default.nix
Normal file
@@ -0,0 +1,43 @@
|
||||
# Glance is a self-hosted homepage/dashboard service.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
imports = [./home.nix ./server.nix];
|
||||
|
||||
services = {
|
||||
glance = {
|
||||
enable = true;
|
||||
settings = {
|
||||
# theme.contrast-multiplier = lib.mkForce 1.4;
|
||||
server.port = 5678;
|
||||
};
|
||||
};
|
||||
cloudflared.tunnels."f7c8f777-a36c-4b9a-b6e3-6a112bd43e73".ingress = {
|
||||
"start.hadi.diy" = "http://localhost:${toString config.services.glance.settings.server.port}";
|
||||
"home.hadi.diy" = "http://localhost:${toString config.services.glance.settings.server.port}";
|
||||
"glance.hadi.diy" = "http://localhost:${toString config.services.glance.settings.server.port}";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.glance.serviceConfig = {
|
||||
DynamicUser = lib.mkForce false;
|
||||
User = "glance";
|
||||
Group = "glance";
|
||||
};
|
||||
|
||||
users = {
|
||||
groups.glance = {};
|
||||
users.glance = {
|
||||
isSystemUser = true;
|
||||
description = "Glance user";
|
||||
group = "glance";
|
||||
};
|
||||
};
|
||||
|
||||
sops.secrets.adguard-pwd = {
|
||||
owner = "glance";
|
||||
mode = "0600";
|
||||
};
|
||||
}
|
||||
225
server-modules/glance/home.nix
Normal file
225
server-modules/glance/home.nix
Normal file
@@ -0,0 +1,225 @@
|
||||
{config, ...}: {
|
||||
services.glance.settings.pages = [
|
||||
{
|
||||
name = "Home";
|
||||
hide-desktop-navigation = false;
|
||||
columns = [
|
||||
{
|
||||
size = "small";
|
||||
widgets = [
|
||||
{
|
||||
type = "clock";
|
||||
hour-format = "24h";
|
||||
}
|
||||
{
|
||||
type = "weather";
|
||||
location = "Paris, France";
|
||||
}
|
||||
{
|
||||
type = "markets";
|
||||
markets = [
|
||||
{
|
||||
symbol = "BTC-USD";
|
||||
name = "Bitcoin";
|
||||
chart-link = "https://www.tradingview.com/chart/?symbol=INDEX:BTCUSD";
|
||||
}
|
||||
{
|
||||
symbol = "SOL-USD";
|
||||
name = "Solana";
|
||||
chart-link = "https://www.tradingview.com/chart/?symbol=INDEX:SOLUSD";
|
||||
}
|
||||
{
|
||||
symbol = "ETH-USD";
|
||||
name = "Ethereum";
|
||||
chart-link = "https://www.tradingview.com/chart/?symbol=INDEX:ETHUSD";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
size = "full";
|
||||
widgets = [
|
||||
{
|
||||
type = "search";
|
||||
search-engine = "startpage";
|
||||
}
|
||||
{
|
||||
type = "group";
|
||||
widgets = [
|
||||
{
|
||||
type = "bookmarks";
|
||||
title = "Bookmarks";
|
||||
groups = [
|
||||
{
|
||||
title = "";
|
||||
same-tab = true;
|
||||
color = "245 50 64";
|
||||
links = [
|
||||
{
|
||||
title = "Linkding";
|
||||
url = "https://linkding.hadi.diy";
|
||||
}
|
||||
{
|
||||
title = "Mail";
|
||||
url = "https://mail.proton.me";
|
||||
}
|
||||
{
|
||||
title = "Drive";
|
||||
url = "https://drive.proton.me";
|
||||
}
|
||||
{
|
||||
title = "Lumo";
|
||||
url = "https://lumo.proton.me";
|
||||
}
|
||||
{
|
||||
title = "Gemini";
|
||||
url = "https://gemini.google.com";
|
||||
}
|
||||
{
|
||||
title = "Calendar";
|
||||
url = "https://calendar.proton.me";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
title = "Tools";
|
||||
same-tab = true;
|
||||
color = "245 50 64";
|
||||
links = [
|
||||
{
|
||||
title = "Excalidraw";
|
||||
url = "https://excalidraw.com";
|
||||
}
|
||||
{
|
||||
title = "Cobalt (downloader)";
|
||||
url = "https://cobalt.meowing.de";
|
||||
}
|
||||
{
|
||||
title = "Mazanoke (image downgrading)";
|
||||
url = "https://mazanoke.hadi.diy";
|
||||
}
|
||||
{
|
||||
title = "Stirling PDF";
|
||||
url = "https://pdf.hadi.diy";
|
||||
}
|
||||
{
|
||||
title = "Vert (file converter)";
|
||||
url = "https://vert.sh";
|
||||
}
|
||||
{
|
||||
title = "Markdown to pdf";
|
||||
url = "https://md2file.com";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
title = "Social";
|
||||
same-tab = true;
|
||||
color = "245 50 64";
|
||||
links = [
|
||||
{
|
||||
title = "X";
|
||||
url = "https://x.com";
|
||||
}
|
||||
{
|
||||
title = "Bsky";
|
||||
url = "https://bsky.app";
|
||||
}
|
||||
{
|
||||
title = "Reddit";
|
||||
url = "https://reddit.com";
|
||||
}
|
||||
{
|
||||
title = "Maps";
|
||||
url = "https://maps.apple.com";
|
||||
}
|
||||
{
|
||||
title = "Youtube";
|
||||
url = "https://youtube.com";
|
||||
}
|
||||
{
|
||||
title = "Github";
|
||||
url = "https://github.com";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
title = "Other";
|
||||
same-tab = true;
|
||||
color = "245 50 64";
|
||||
links = [
|
||||
{
|
||||
title = "Startpage config";
|
||||
url = "https://www.startpage.com/do/mypage.pl?prfe=45d331deb05471d659dba933e7400df51d952bb103da6f6125c0e769a6be1d65610456a479f495ceeee7e97311cf227d7c1bb198de0ceeb193d8cddf9c455c19a409cc35c3e3f542ee27bd7cecd3";
|
||||
}
|
||||
{
|
||||
title = "Hyprland Wiki";
|
||||
url = "https://wiki.hypr.land";
|
||||
}
|
||||
{
|
||||
title = "Search NixOS";
|
||||
url = "https://mynixos.com";
|
||||
}
|
||||
{
|
||||
title = "Nixpkgs";
|
||||
url = "https://github.com/NixOS/nixpkgs";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
type = "bookmarks";
|
||||
title = "Infosec";
|
||||
groups = [
|
||||
{
|
||||
title = "";
|
||||
same-tab = true;
|
||||
color = "245 50 64";
|
||||
links = [
|
||||
{
|
||||
title = "Nix 4 Cyber";
|
||||
url = "https://n4c.hadi.diy";
|
||||
}
|
||||
{
|
||||
title = "Cyberchef";
|
||||
url = "https://cyberchef.hadi.diy";
|
||||
}
|
||||
{
|
||||
title = "TryHackMe";
|
||||
url = "https://tryhackme.com";
|
||||
}
|
||||
{
|
||||
title = "Root-Me";
|
||||
url = "https://root-me.org";
|
||||
}
|
||||
{
|
||||
title = "Exploit-DB";
|
||||
url = "https://exploit-db.com";
|
||||
}
|
||||
{
|
||||
title = "Crack Station";
|
||||
url = "https://crackstation.net";
|
||||
}
|
||||
{
|
||||
title = "Osint Tracker";
|
||||
url = "https://app.osintracker.com";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
type = "hacker-news";
|
||||
limit = 15;
|
||||
collapse-after = 5;
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
155
server-modules/glance/server.nix
Normal file
155
server-modules/glance/server.nix
Normal file
@@ -0,0 +1,155 @@
|
||||
{config, ...}: {
|
||||
services.glance.settings.pages = [
|
||||
{
|
||||
name = "Server";
|
||||
hide-desktop-navigation = false;
|
||||
columns = [
|
||||
{
|
||||
size = "full";
|
||||
widgets = [
|
||||
{
|
||||
type = "server-stats";
|
||||
servers = [
|
||||
{
|
||||
type = "local";
|
||||
name = "Jack";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
type = "group";
|
||||
widgets = [
|
||||
{
|
||||
type = "monitor";
|
||||
title = "Services";
|
||||
cache = "1m";
|
||||
sites = [
|
||||
{
|
||||
title = "Adguard";
|
||||
url = "https://adguard.hadi.diy";
|
||||
icon = "si:adguard";
|
||||
}
|
||||
{
|
||||
title = "Mealie";
|
||||
url = "https://mealie.hadi.diy";
|
||||
icon = "si:mealie";
|
||||
}
|
||||
{
|
||||
title = "Linkding";
|
||||
url = "https://linkding.hadi.diy";
|
||||
icon = "sh:linkding";
|
||||
}
|
||||
{
|
||||
title = "Mazanoke";
|
||||
url = "https://mazanoke.hadi.diy";
|
||||
icon = "sh:mazanoke";
|
||||
}
|
||||
{
|
||||
title = "Stirling PDF";
|
||||
url = "https://pdf.hadi.diy";
|
||||
icon = "sh:stirling-pdf";
|
||||
}
|
||||
{
|
||||
title = "Eleakxir";
|
||||
url = "https://eleakxir.hadi.diy";
|
||||
icon = "si:elixir";
|
||||
}
|
||||
{
|
||||
title = "Cyberchef";
|
||||
url = "https://cyberchef.hadi.diy";
|
||||
icon = "si:codechef";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
type = "monitor";
|
||||
title = "*arr";
|
||||
cache = "1m";
|
||||
sites = [
|
||||
{
|
||||
title = "Jellyfin";
|
||||
url = "https://media.hadi.diy";
|
||||
icon = "si:jellyfin";
|
||||
}
|
||||
{
|
||||
title = "Jellyseerr";
|
||||
url = "https://demandemedia.hadi.diy";
|
||||
icon = "si:odysee";
|
||||
}
|
||||
{
|
||||
title = "Radarr";
|
||||
url = "https://radarr.hadi.diy";
|
||||
icon = "si:radarr";
|
||||
}
|
||||
{
|
||||
title = "Sonarr";
|
||||
url = "https://sonarr.hadi.diy";
|
||||
icon = "si:sonarr";
|
||||
}
|
||||
{
|
||||
title = "Readarr";
|
||||
url = "https://readarr.hadi.diy";
|
||||
icon = "si:bookstack";
|
||||
}
|
||||
{
|
||||
title = "Bazarr";
|
||||
url = "https://bazarr.hadi.diy";
|
||||
icon = "si:subtitleedit";
|
||||
}
|
||||
{
|
||||
title = "Prowlarr";
|
||||
url = "https://prowlarr.hadi.diy";
|
||||
icon = "si:podcastindex";
|
||||
}
|
||||
{
|
||||
title = "Transmission";
|
||||
url = "https://transmission.hadi.diy";
|
||||
icon = "si:transmission";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
{
|
||||
type = "dns-stats";
|
||||
service = "adguard";
|
||||
url = "http://localhost:${toString config.services.adguardhome.port}";
|
||||
username = "hadi";
|
||||
password = "\${secret:adguard-pwd}";
|
||||
}
|
||||
|
||||
{
|
||||
type = "bookmarks";
|
||||
groups = [
|
||||
{
|
||||
title = "";
|
||||
same-tab = true;
|
||||
color = "245 50 64";
|
||||
links = [
|
||||
{
|
||||
title = "Router";
|
||||
url = "http://192.168.1.254/";
|
||||
}
|
||||
{
|
||||
title = "Cloudflare";
|
||||
url = "https://dash.cloudflare.com/";
|
||||
}
|
||||
{
|
||||
title = "Cloudflare Zero Trust";
|
||||
url = "https://one.dash.cloudflare.com/";
|
||||
}
|
||||
{
|
||||
title = "Cloudflare Access";
|
||||
url = "anotherhadi.cloudflareaccess.com";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user