aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-06-15 15:43:45 +0530
committerAkshay Nair <phenax5@gmail.com>2025-06-15 15:59:27 +0530
commit926f411a4c703cab001d64b7f8b9701b79a7dc5c (patch)
treea95b94fe0061309b6b422c1c889f9595de439c53
parent03d52d1317af446c513c0257f8c497fed2bfbad8 (diff)
downloadhomeserver-nixos-config-926f411a4c703cab001d64b7f8b9701b79a7dc5c.tar.gz
homeserver-nixos-config-926f411a4c703cab001d64b7f8b9701b79a7dc5c.zip
Refactor settings management + dashboard links
-rwxr-xr-xbuild.sh3
-rw-r--r--configuration.nix6
-rw-r--r--flake.nix3
-rw-r--r--modules/dashboard/default.nix73
-rw-r--r--modules/dashboard/links.nix69
-rw-r--r--modules/media/default.nix5
-rw-r--r--modules/media/torrent.nix5
-rw-r--r--modules/monitoring/grafana.nix3
-rw-r--r--modules/monitoring/prometheus.nix3
-rw-r--r--modules/network/default.nix3
-rw-r--r--modules/network/ssh.nix5
-rw-r--r--modules/network/wireless.nix10
-rw-r--r--modules/notifications/default.nix3
-rw-r--r--modules/storage/git.nix5
-rw-r--r--modules/storage/send.nix5
-rw-r--r--modules/storage/syncthing.nix5
-rw-r--r--modules/users/default.nix5
-rw-r--r--scripts/generate-test-dashboard.nix10
-rw-r--r--settings.nix1
19 files changed, 109 insertions, 113 deletions
diff --git a/build.sh b/build.sh
index 20fe342..fbc6993 100755
--- a/build.sh
+++ b/build.sh
@@ -48,8 +48,7 @@ chaincmds() {
}
gen_test_dash() {
- nix eval --impure \
- --expr 'import ./modules/dashboard/dashboard-template.nix { title = "Dashboard"; links = [{ title = "Google"; url = "https://google.com"; altUrl = "http://foobar.com"; key = "g"; } { title = "DuckDuckGo"; url = "https://duckduckgo.com"; key = "d"; color = "#4c82cf"; } { title = "Google"; url = "https://google.com"; altUrl = "http://foobar.com"; key = "g"; } { title = "Google"; url = "https://google.com"; altUrl = "http://foobar.com"; key = "g"; }]; }' \
+ nix eval --impure --expr 'import ./scripts/generate-test-dashboard.nix' \
| jq -r > index.ignore.html
}
open_test_dash() { brave "file://$PWD/index.ignore.html"; }
diff --git a/configuration.nix b/configuration.nix
index 6622ec1..cb191a2 100644
--- a/configuration.nix
+++ b/configuration.nix
@@ -11,6 +11,12 @@
./modules/monitoring
];
+ # services.shiori = {
+ # enable = true;
+ # port = 3144;
+ # };
+ # networking.firewall.allowedTCPPorts = [ 3144 ];
+
environment.systemPackages = with pkgs; [
bottom
mtm
diff --git a/flake.nix b/flake.nix
index d7154c2..8875022 100644
--- a/flake.nix
+++ b/flake.nix
@@ -7,6 +7,9 @@
outputs = { self, nixpkgs, nixos-hardware, ... }: {
nixosConfigurations.bacchus = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
+ specialArgs = {
+ settings = import ./settings.nix { inherit (nixpkgs) lib; };
+ };
modules = [
"${nixos-hardware}/lenovo/ideapad"
./configuration.nix
diff --git a/modules/dashboard/default.nix b/modules/dashboard/default.nix
index c7ad4eb..9bde252 100644
--- a/modules/dashboard/default.nix
+++ b/modules/dashboard/default.nix
@@ -1,7 +1,6 @@
-{ lib, ... }:
+{ settings, ... }:
let
- settings = import ../../settings.nix { inherit lib; };
- ports = settings.network.ports;
+ links = import ./links.nix { inherit settings; };
in
{
imports = [ ../../services/bacchus-dashboard/bacchus-dashboard.service.nix ];
@@ -9,73 +8,9 @@ in
services.bacchus-dashboard = {
enable = true;
openFirewall = true;
- port = ports.dashboard;
+ port = settings.network.ports.dashboard;
title = "Bacchus Dashboard";
embedLink = settings.grafana.dashboardEmbedLink;
- links = [
- {
- title = "Jellyfin";
- key = "j";
- url = "http://jellyfin.local";
- altUrl = "http://${settings.network.host}:${toString ports.jellyfin}";
- color = "#AA5CC3";
- }
- {
- title = "Jellyseer";
- key = "l";
- url = "http://jellyseerr.local";
- altUrl = "http://${settings.network.host}:${toString ports.jellyseerr}";
- color = "#5345e6";
- }
- {
- title = "Radarr";
- key = "r";
- url = "http://radarr.local";
- altUrl = "http://${settings.network.host}:${toString ports.radarr}";
- color = "#fcbd00";
- }
- {
- title = "Sonarr";
- key = "s";
- url = "http://sonarr.local";
- altUrl = "http://${settings.network.host}:${toString ports.sonarr}";
- color = "#4c82cf";
- }
- {
- title = "Prowlarr";
- key = "p";
- url = "http://prowlarr.local";
- altUrl = "http://${settings.network.host}:${toString ports.prowlarr}";
- color = "#ff9a7e";
- }
- {
- title = "Syncthing";
- key = "y";
- url = "http://syncthing.local";
- altUrl = "http://${settings.network.host}:${toString ports.syncthing}";
- color = "#0891d1";
- }
- {
- title = "Ntfy-sh";
- key = "n";
- url = "http://ntfy.local";
- altUrl = "http://${settings.network.host}:${toString ports.ntfy}";
- color = "#2dc9b5";
- }
- {
- title = "Grafana";
- key = "g";
- url = "http://grafana.local";
- altUrl = "http://${settings.network.host}:${toString ports.grafana}";
- color = "#f05a28";
- }
- {
- title = "Send";
- key = "f";
- url = "http://send.local";
- altUrl = "http://${settings.network.host}:${toString ports.send}";
- color = "#AA5CC3";
- }
- ];
+ links = links;
};
}
diff --git a/modules/dashboard/links.nix b/modules/dashboard/links.nix
new file mode 100644
index 0000000..9a89c2b
--- /dev/null
+++ b/modules/dashboard/links.nix
@@ -0,0 +1,69 @@
+{ settings }:
+let
+ ports = settings.network.ports;
+ host = settings.network.host;
+in [
+ {
+ title = "Jellyfin";
+ key = "j";
+ url = "http://jellyfin.local";
+ altUrl = "http://${host}:${toString ports.jellyfin}";
+ color = "#AA5CC3";
+ }
+ {
+ title = "Jellyseer";
+ key = "l";
+ url = "http://jellyseerr.local";
+ altUrl = "http://${host}:${toString ports.jellyseerr}";
+ color = "#5345e6";
+ }
+ {
+ title = "Radarr";
+ key = "r";
+ url = "http://radarr.local";
+ altUrl = "http://${host}:${toString ports.radarr}";
+ color = "#fcbd00";
+ }
+ {
+ title = "Sonarr";
+ key = "s";
+ url = "http://sonarr.local";
+ altUrl = "http://${host}:${toString ports.sonarr}";
+ color = "#4c82cf";
+ }
+ {
+ title = "Prowlarr";
+ key = "p";
+ url = "http://prowlarr.local";
+ altUrl = "http://${host}:${toString ports.prowlarr}";
+ color = "#ff9a7e";
+ }
+ {
+ title = "Syncthing";
+ key = "y";
+ url = "http://syncthing.local";
+ altUrl = "http://${host}:${toString ports.syncthing}";
+ color = "#0891d1";
+ }
+ {
+ title = "Ntfy-sh";
+ key = "n";
+ url = "http://ntfy.local";
+ altUrl = "http://${host}:${toString ports.ntfy}";
+ color = "#2dc9b5";
+ }
+ {
+ title = "Grafana";
+ key = "g";
+ url = "http://grafana.local";
+ altUrl = "http://${host}:${toString ports.grafana}";
+ color = "#f05a28";
+ }
+ {
+ title = "Send";
+ key = "f";
+ url = "http://send.local";
+ altUrl = "http://${host}:${toString ports.send}";
+ color = "#AA5CC3";
+ }
+]
diff --git a/modules/media/default.nix b/modules/media/default.nix
index e7399f0..a472992 100644
--- a/modules/media/default.nix
+++ b/modules/media/default.nix
@@ -1,7 +1,4 @@
-{ lib, ... }:
-let
- settings = import ../../settings.nix { inherit lib; };
-in
+{ settings, ... }:
{
imports = [ ./torrent.nix ];
diff --git a/modules/media/torrent.nix b/modules/media/torrent.nix
index cceb94d..1d2ee73 100644
--- a/modules/media/torrent.nix
+++ b/modules/media/torrent.nix
@@ -1,7 +1,4 @@
-{ pkgs, lib, ... }:
-let
- settings = import ../../settings.nix { inherit lib; };
-in
+{ pkgs, settings, ... }:
{
environment.systemPackages = with pkgs; [
tremc
diff --git a/modules/monitoring/grafana.nix b/modules/monitoring/grafana.nix
index 8e98ffc..ae262d6 100644
--- a/modules/monitoring/grafana.nix
+++ b/modules/monitoring/grafana.nix
@@ -1,6 +1,5 @@
-{ lib, ... }:
+{ settings, ... }:
let
- settings = import ../../settings.nix { inherit lib; };
ports = settings.network.ports;
in
{
diff --git a/modules/monitoring/prometheus.nix b/modules/monitoring/prometheus.nix
index 5f71c58..adb5baa 100644
--- a/modules/monitoring/prometheus.nix
+++ b/modules/monitoring/prometheus.nix
@@ -1,6 +1,5 @@
-{ lib, ... }:
+{ settings, ... }:
let
- settings = import ../../settings.nix { inherit lib; };
ports = settings.network.ports;
in
{
diff --git a/modules/network/default.nix b/modules/network/default.nix
index ee0e25a..8f706c0 100644
--- a/modules/network/default.nix
+++ b/modules/network/default.nix
@@ -1,6 +1,5 @@
-{ lib, ... }:
+{ settings, ... }:
let
- settings = import ../../settings.nix { inherit lib; };
ports = settings.network.ports;
host = settings.network.host;
in
diff --git a/modules/network/ssh.nix b/modules/network/ssh.nix
index f5564bd..25f6f8f 100644
--- a/modules/network/ssh.nix
+++ b/modules/network/ssh.nix
@@ -1,7 +1,4 @@
-{ lib, ... }:
-let
- settings = import ../../settings.nix { inherit lib; };
-in
+{ settings, ... }:
{
services.sshd.enable = true;
diff --git a/modules/network/wireless.nix b/modules/network/wireless.nix
index 7488d9a..aa80c5b 100644
--- a/modules/network/wireless.nix
+++ b/modules/network/wireless.nix
@@ -1,8 +1,4 @@
-{ lib, ... }:
-let
- settings = import ../../settings.nix { inherit lib; };
- wireless = settings.network.wireless;
-in
+{ settings, ... }:
{
networking.networkmanager = {
enable = true;
@@ -17,12 +13,12 @@ in
};
wifi = {
mode = "infrastructure";
- ssid = wireless.ssid;
+ ssid = settings.network.wireless.ssid;
};
wifi-security = {
auth-alg = "open";
key-mgmt = "wpa-psk";
- psk = wireless.password;
+ psk = settings.network.wireless.password;
};
};
};
diff --git a/modules/notifications/default.nix b/modules/notifications/default.nix
index 87df67d..453ea43 100644
--- a/modules/notifications/default.nix
+++ b/modules/notifications/default.nix
@@ -1,6 +1,5 @@
-{ lib, pkgs, ... }:
+{ settings, pkgs, ... }:
let
- settings = import ../../settings.nix { inherit lib; };
host = settings.network.host;
ports = settings.network.ports;
url = "http://${host}:${toString ports.ntfy}";
diff --git a/modules/storage/git.nix b/modules/storage/git.nix
index fd2e5b8..9c35efb 100644
--- a/modules/storage/git.nix
+++ b/modules/storage/git.nix
@@ -1,7 +1,4 @@
-{ lib, ... }:
-let
- settings = import ../../settings.nix { inherit lib; };
-in
+{ settings, ... }:
{
systemd.tmpfiles.rules = [
"d ${settings.git.baseDir} 0770 - ${settings.git.group} - -"
diff --git a/modules/storage/send.nix b/modules/storage/send.nix
index 48450fd..b6b8b5c 100644
--- a/modules/storage/send.nix
+++ b/modules/storage/send.nix
@@ -1,7 +1,4 @@
-{ lib, ... }:
-let
- settings = import ../../settings.nix { inherit lib; };
-in
+{ settings, ... }:
{
services.send = {
enable = true;
diff --git a/modules/storage/syncthing.nix b/modules/storage/syncthing.nix
index 5291182..b98711c 100644
--- a/modules/storage/syncthing.nix
+++ b/modules/storage/syncthing.nix
@@ -1,7 +1,6 @@
-{ lib, ... }:
+{ settings, ... }:
let
- settings = import ../../settings.nix { inherit lib; };
- group = "syncthing";
+ group = settings.syncthing.group;
in
{
systemd.tmpfiles.rules = [
diff --git a/modules/users/default.nix b/modules/users/default.nix
index 7969496..792493f 100644
--- a/modules/users/default.nix
+++ b/modules/users/default.nix
@@ -1,7 +1,4 @@
-{ pkgs, lib, ... }:
-let
- settings = import ../../settings.nix { inherit lib; };
-in
+{ pkgs, settings, ... }:
{
users.users.root.password = settings.passwords.root;
diff --git a/scripts/generate-test-dashboard.nix b/scripts/generate-test-dashboard.nix
new file mode 100644
index 0000000..10407f7
--- /dev/null
+++ b/scripts/generate-test-dashboard.nix
@@ -0,0 +1,10 @@
+let
+ nixpkgs = import <nixpkgs> {};
+ settings = import ../settings.nix { inherit (nixpkgs) lib; };
+ links = import ../modules/dashboard/links.nix { inherit settings; };
+in
+import ../services/bacchus-dashboard/dashboard-template.nix {
+ title = "Dashboard";
+ embedLink = settings.grafana.dashboardEmbedLink;
+ inherit links;
+}
diff --git a/settings.nix b/settings.nix
index affaa40..968bfff 100644
--- a/settings.nix
+++ b/settings.nix
@@ -31,6 +31,7 @@ in lib.recursiveUpdate privateSettings rec {
syncthing = {
baseDir = "/media/syncthing";
photosDir = "${syncthing.baseDir}/photos";
+ group = "syncthing";
};
media = rec {