From feea4f5ad996a52dd486bf915eafd7df25e33e36 Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Fri, 21 Jun 2024 13:14:54 +0200 Subject: [PATCH] Update --- hosts/modules/server/www/default.nix | 6 +- .../www/home.anotherhadi.com/default.nix | 287 ------------------ hosts/modules/server/www/homepage.nix | 126 ++++++-- 3 files changed, 97 insertions(+), 322 deletions(-) delete mode 100644 hosts/modules/server/www/home.anotherhadi.com/default.nix diff --git a/hosts/modules/server/www/default.nix b/hosts/modules/server/www/default.nix index d64bae7..d261c03 100644 --- a/hosts/modules/server/www/default.nix +++ b/hosts/modules/server/www/default.nix @@ -1,16 +1,12 @@ { - imports = [ ./home.anotherhadi.com ./homepage.nix ]; + imports = [ ./homepage.nix ]; services.nginx.virtualHosts = { "anotherhadi.com" = { serverAliases = [ "www.anotherhadi.com" ]; root = "/etc/www/anotherhadi.com"; }; - # "home.anotherhadi.com" = { - # serverAliases = [ "jack.anotherhadi.com" ]; - # root = "/etc/www/home.anotherhadi.com"; - # }; "test.anotherhadi.com" = { root = "/var/www/test"; }; }; environment.etc."www/anotherhadi.com" = { source = ./anotherhadi.com; }; diff --git a/hosts/modules/server/www/home.anotherhadi.com/default.nix b/hosts/modules/server/www/home.anotherhadi.com/default.nix deleted file mode 100644 index 491f362..0000000 --- a/hosts/modules/server/www/home.anotherhadi.com/default.nix +++ /dev/null @@ -1,287 +0,0 @@ -{ config, ... }: -let - bookmarks = '' - Home: [ - {text: "Nextcloud", url: "https://cloud.anotherhadi.com", icon: "󰅟"}, - {text: "Vaultwarden", url: "https://vault.anotherhadi.com", icon: ""}, - {text: "Uptime Kuma", url: "https://kuma.anotherhadi.com", icon: "󱎫"}, - ], - Admin: [ - {text: "Adguard Home", url: "http://192.168.2.24:3001", icon: "󰷱"}, - {text: "Proxmox", url: "https://192.168.2.17:8006", icon: ""}, - {text: "Cloudflare", url: "https://dash.cloudflare.com/", icon: ""}, - {text: "Tailscale", url: "https://login.tailscale.com/admin/machines", icon: "󰖂"}, - ], - ''; -in { - - environment.etc."www/home.anotherhadi.com/index.html".text = '' - - - - - - - Homepage - - - - -
-
-

-

-
-
-

-
- -
- - - - - ''; -} diff --git a/hosts/modules/server/www/homepage.nix b/hosts/modules/server/www/homepage.nix index fdaa752..151576d 100644 --- a/hosts/modules/server/www/homepage.nix +++ b/hosts/modules/server/www/homepage.nix @@ -1,34 +1,100 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +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 = "6588787368cbc403cdec08fd25ef27b42077b8d3"; + hash = "sha256-Z2TZ56I6lRmYkLRnnMscvmSCzGt5q9yX90lGPebJpe8="; + }; + + npmDepsHash = "sha256-YxdrNTBbbgMHJ0WoSHePxdM7UJLbKsSbObW8M1uArUg="; + + 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."home.anotherhadi.com" = { enableACME = true; - - root = pkgs.buildNpmPackage { - pname = "homepage"; - version = "0.0.0"; - - src = pkgs.fetchFromGitHub { - owner = "anotherhadi"; - repo = "homepage"; - rev = "6588787368cbc403cdec08fd25ef27b42077b8d3"; - hash = "sha256-Z2TZ56I6lRmYkLRnnMscvmSCzGt5q9yX90lGPebJpe8="; - }; - - npmDepsHash = "sha256-YxdrNTBbbgMHJ0WoSHePxdM7UJLbKsSbObW8M1uArUg="; - - installPhase = '' - npm install - ''; - - buildPhase = '' - npm run build - mkdir $out - mv build $out - ''; - - meta = { - description = "test"; - homepage = "https://text.com"; - }; - } + "/build"; + root = package + "/build"; }; }