From a0c5bd962b7ba009ddbd6d0be8c68b3db54a8beb Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Thu, 20 Jun 2024 02:45:24 +0200 Subject: [PATCH] Update --- docs/TODO.md | 6 +++- home/laptop.nix | 2 ++ home/scripts/serverfetch/default.nix | 19 ++++++++++++ home/system/hyprland/default.nix | 1 - hosts/laptop/variables.nix | 2 +- hosts/modules/server/bitcoin-git.nix | 31 +++++++++++++++++++ hosts/modules/server/cloudflare-dyndns.nix | 2 ++ hosts/modules/server/www/default.nix | 9 ++++-- .../www/home.anotherhadi.com/default.nix | 12 +++---- hosts/modules/server/www/homepage.nix | 25 +++++++++++++++ 10 files changed, 97 insertions(+), 12 deletions(-) create mode 100644 home/scripts/serverfetch/default.nix create mode 100644 hosts/modules/server/bitcoin-git.nix create mode 100644 hosts/modules/server/www/homepage.nix diff --git a/docs/TODO.md b/docs/TODO.md index 0c93e89..494f94b 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -7,7 +7,7 @@ feel free to contribute <3 ([CONTRIBUTING.md](CONTRIBUTING.md)) - [ ] Themes - [ ] MacOS theme - [ ] Make hyprcursor work -- [ ] Homepage (web/qutebrowser) v2 +- [ ] Homepage (web) v2 - [ ] Compile the sveltejs project - [ ] Different link on web/mobile (so it can open ios/android apps) - [ ] Test services ? (ping) @@ -21,3 +21,7 @@ feel free to contribute <3 ([CONTRIBUTING.md](CONTRIBUTING.md)) - [ ] Nextcloud exclude file pattern (nodes modules, ...) - [ ] Automount USB Key (And notify-send when it's done) - [ ] Usb security for laptop & server, variable in variables.nix, disable for guest +- [ ] Bitcoin-git +- [ ] server fetch +- [ ] Remote push +- [ ] Ntfy auth file diff --git a/home/laptop.nix b/home/laptop.nix index bba3d65..0bf67f3 100644 --- a/home/laptop.nix +++ b/home/laptop.nix @@ -39,6 +39,7 @@ xfce.thunar bitwarden vlc + nextcloud-client # Dev go @@ -47,6 +48,7 @@ python3 jq git-ignore + node2nix # Utils fd diff --git a/home/scripts/serverfetch/default.nix b/home/scripts/serverfetch/default.nix new file mode 100644 index 0000000..6a41bd8 --- /dev/null +++ b/home/scripts/serverfetch/default.nix @@ -0,0 +1,19 @@ + + + +# _ +#| |_ ___ __ ___ _____ _ _ +#| ' \/ -_) _` \ V / -_) ' \ +#|_||_\___\__,_|\_/\___|_||_| + + +# Disk state +# Raid state + +# Apps +# Apps state + +# Is local network reachable (wireguard started) + +# uptime +# Network speed diff --git a/home/system/hyprland/default.nix b/home/system/hyprland/default.nix index e182c07..3bb3045 100644 --- a/home/system/hyprland/default.nix +++ b/home/system/hyprland/default.nix @@ -101,7 +101,6 @@ env = [ "LIBVA_DRIVER_NAME,nvidia" - "__GLX_VENDOR_LIBRARY_NAME,nvidia" "XDG_SESSION_TYPE,wayland" "XDG_CURRENT_DESKTOP,Hyprland" "XDG_SESSION_TYPE,wayland" diff --git a/hosts/laptop/variables.nix b/hosts/laptop/variables.nix index a8e34f3..30bd44e 100644 --- a/hosts/laptop/variables.nix +++ b/hosts/laptop/variables.nix @@ -27,6 +27,6 @@ # change the nvim's obsidian configuration if you want to enable that: obsidian = true; - theme = import ../themes/catppuccin.nix; # select your theme here + theme = import ../themes/nixy.nix; # select your theme here }; } diff --git a/hosts/modules/server/bitcoin-git.nix b/hosts/modules/server/bitcoin-git.nix new file mode 100644 index 0000000..8f74f8c --- /dev/null +++ b/hosts/modules/server/bitcoin-git.nix @@ -0,0 +1,31 @@ +{ + systemd.timers."bitcoin-git" = { + wantedBy = [ "timers.target" ]; + timerConfig = { + Unit = "bitcoin-git.service"; + OnCalendar = "daily"; + Persistent = true; + }; + }; + + systemd.services."bitcoin-git" = { + script = '' + [ ! -d "/home/heaven/btcprice" ] && git clone git@github.com:anotherhadi/btcprice /home/heaven/btcprice + cd "/home/heaven/btcprice" + price=$(curl eur.rate.sx/1BTC) + echo "# Bitcoin Price in EURO" >README.md + echo "" >>README.md + echo "1 Bitcoin = $price€" >>README.md + echo "" >>README.md + echo "Date: $(date)" >>README.md + git add . + git commit -m "Update price (heaven)" + git push -u origin main + exit 0 + ''; + serviceConfig = { + Type = "oneshot"; + User = "heaven"; + }; + }; +} diff --git a/hosts/modules/server/cloudflare-dyndns.nix b/hosts/modules/server/cloudflare-dyndns.nix index 40cc75b..4013ec2 100644 --- a/hosts/modules/server/cloudflare-dyndns.nix +++ b/hosts/modules/server/cloudflare-dyndns.nix @@ -8,6 +8,8 @@ "vault.anotherhadi.com" "anotherhadi.com" "www.anotherhadi.com" + "test.anotherhadi.com" + "jack.anotherhadi.com" "ntfy.anotherhadi.com" "home.anotherhadi.com" ]; diff --git a/hosts/modules/server/www/default.nix b/hosts/modules/server/www/default.nix index 735d006..b3523f7 100644 --- a/hosts/modules/server/www/default.nix +++ b/hosts/modules/server/www/default.nix @@ -4,11 +4,14 @@ services.nginx.virtualHosts = { "anotherhadi.com" = { - # serverAliases = [ "www.anotherhadi.com" ]; + serverAliases = [ "www.anotherhadi.com" ]; root = "/etc/www/anotherhadi.com"; }; - "home.anotherhadi.com" = { root = "/etc/www/home.anotherhadi.com"; }; - "www.anotherhadi.com" = { root = "/var/www/test"; }; + "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 index a652501..951a3a4 100644 --- a/hosts/modules/server/www/home.anotherhadi.com/default.nix +++ b/hosts/modules/server/www/home.anotherhadi.com/default.nix @@ -2,14 +2,14 @@ let bookmarks = '' Home: [ - {text: "Nextcloud", url: "https://cloud.anotherhadi.com", icon: ""}, - {text: "Vaultwarden", url: "https://vault.anotherhadi.com", icon: ""}, + {text: "Nextcloud", url: "https://cloud.anotherhadi.com", icon: "󰅟"}, + {text: "Vaultwarden", url: "https://vault.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: ""}, + {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 { diff --git a/hosts/modules/server/www/homepage.nix b/hosts/modules/server/www/homepage.nix new file mode 100644 index 0000000..1f0ac74 --- /dev/null +++ b/hosts/modules/server/www/homepage.nix @@ -0,0 +1,25 @@ +{ lib, buildNpmPackage, fetchFromGitHub }: + +buildNpmPackage rec { + pname = "homepage"; + version = "0.0.0"; + + src = fetchFromGitHub { + owner = "anotherhadi"; + repo = pname; + rev = "v${version}"; + hash = "sha256-BR+ZGkBBfd0dSQqAvujsbgsEPFYw/ThrylxUbOksYxM="; + }; + + npmDepsHash = "sha256-tuEfyePwlOy2/mOPdXbqJskO6IowvAP4DWg8xSZwbJw="; + + # The prepack script runs the build script, which we'd rather do in the build phase. + npmPackFlags = [ "--ignore-scripts" ]; + + meta = { + description = "A simple homepage for your server."; + homepage = "https://github.com/anotherhadi/homepage"; + # license = lib.licenses.gpl3Only; + # maintainers = with lib.maintainers; [ winter ]; + }; +}