From 45c0175d72ac876c96d89aaefadb6426dbe6c3ca Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Fri, 21 Jun 2024 15:25:14 +0200 Subject: [PATCH] Update --- hosts/server/configuration.nix | 2 +- hosts/server/modules/cloudflare-dyndns.nix | 1 + hosts/server/modules/www/default.nix | 3 +- ...{homepage.nix => home.anotherhadi.com.nix} | 2 + .../modules/www/start.anotherhadi.com.nix | 101 ++++++++++++++++++ 5 files changed, 106 insertions(+), 3 deletions(-) rename hosts/server/modules/www/{homepage.nix => home.anotherhadi.com.nix} (96%) create mode 100644 hosts/server/modules/www/start.anotherhadi.com.nix diff --git a/hosts/server/configuration.nix b/hosts/server/configuration.nix index 9545fee..041d834 100644 --- a/hosts/server/configuration.nix +++ b/hosts/server/configuration.nix @@ -14,7 +14,7 @@ ./modules/ntfy-sh.nix ./modules/tailscale.nix ./modules/kuma.nix - ./modules/bitcoin-git.nix + # ./modules/bitcoin-git.nix # FIXME: bitcoin-git is deprecated # ./modules/unifi.nix # FIXME: unifi5 is deprecated ]; diff --git a/hosts/server/modules/cloudflare-dyndns.nix b/hosts/server/modules/cloudflare-dyndns.nix index 9489640..f913873 100644 --- a/hosts/server/modules/cloudflare-dyndns.nix +++ b/hosts/server/modules/cloudflare-dyndns.nix @@ -13,6 +13,7 @@ "ntfy.anotherhadi.com" "home.anotherhadi.com" "kuma.anotherhadi.com" + "start.anotherhadi.com" ]; proxied = true; apiTokenFile = "/etc/cloudflare/apiToken"; diff --git a/hosts/server/modules/www/default.nix b/hosts/server/modules/www/default.nix index d261c03..3e4db9c 100644 --- a/hosts/server/modules/www/default.nix +++ b/hosts/server/modules/www/default.nix @@ -1,6 +1,5 @@ { - - imports = [ ./homepage.nix ]; + imports = [ ./home.anotherhadi.com.nix ./start.anotherhadi.com.nix ]; services.nginx.virtualHosts = { "anotherhadi.com" = { diff --git a/hosts/server/modules/www/homepage.nix b/hosts/server/modules/www/home.anotherhadi.com.nix similarity index 96% rename from hosts/server/modules/www/homepage.nix rename to hosts/server/modules/www/home.anotherhadi.com.nix index a6c45b4..73e0a3f 100644 --- a/hosts/server/modules/www/homepage.nix +++ b/hosts/server/modules/www/home.anotherhadi.com.nix @@ -74,6 +74,7 @@ let hash = "sha256-8IzXcQ/hm2ZDzFKUL4B3501PoWoEOiKIN7rP2UrvG84="; }; + # npmDepsHash = lib.fakeHash; npmDepsHash = "sha256-bG+CHTq2Rst3JMxsjAC81KhK+G7WwsTVD1eyP87g0z4="; buildPhase = '' @@ -94,6 +95,7 @@ let in { services.nginx.virtualHosts."home.anotherhadi.com" = { + serverAliases = [ "jack.anotherhadi.com" ]; enableACME = true; root = package + "/build"; }; diff --git a/hosts/server/modules/www/start.anotherhadi.com.nix b/hosts/server/modules/www/start.anotherhadi.com.nix new file mode 100644 index 0000000..6c8a260 --- /dev/null +++ b/hosts/server/modules/www/start.anotherhadi.com.nix @@ -0,0 +1,101 @@ +{ pkgs, lib, ... }: +let + settings = '' + { + "config": { + "title" : "Jack's Home", + "openLinksInNewTab": false, + "locale": "fr-FR", + "colors": { + "primary": "#89b4fa", + "background": "#01010b", + "foreground": "#cdd6f4", + "muted": "#313244" + }, + "folders": [ + { + "name": "Home", + "links": [ + { + "title": "Nextcloud", + "url": "https://cloud.anotherhadi.com", + "icon": "󰅟" + }, + { + "title": "Vaultwarden", + "url": "https://vault.anotherhadi.com", + "icon": "" + }, + { + "title": "Uptime Kuma", + "url": "https://kuma.anotherhadi.com", + "icon": "󱎫" + } + ] + }, + { + "name": "Admin", + "links": [ + { + "title": "Adguard Home", + "url": "http://192.168.2.24:3001", + "icon": "󰷱" + }, + { + "title": "Proxmox", + "url": "https://192.168.2.17:8006", + "icon": "" + }, + { + "title": "Cloudflare", + "url": "https://dash.cloudflare.com/", + "icon": "" + }, + { + "title": "Tailscale", + "url": "https://login.tailscale.com/admin/machines", + "icon": "󰖂" + } + ] + } + ] + } + } + ''; + + package = pkgs.buildNpmPackage { + pname = "homepage"; + version = "0.0.0"; + + src = pkgs.fetchFromGitHub { + owner = "anotherhadi"; + repo = "homepage"; + rev = "19f56771ae7ac04e2710cbde763f70bb097eb250"; + hash = "sha256-8IzXcQ/hm2ZDzFKUL4B3501PoWoEOiKIN7rP2UrvG84="; + }; + + # npmDepsHash = lib.fakeHash; + npmDepsHash = "sha256-bG+CHTq2Rst3JMxsjAC81KhK+G7WwsTVD1eyP87g0z4="; + + buildPhase = '' + npm install + cp ${ + pkgs.writeText "src/routes/config.json" settings + } src/routes/config.json + npm run build + mkdir $out + mv build $out + ''; + + meta = { + description = "homepage"; + homepage = "https://github.com/anotherhadi/homepage"; + }; + }; + +in { + services.nginx.virtualHosts."start.anotherhadi.com" = { + enableACME = true; + root = package + "/build"; + }; +}