aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArpit Chakladar <54011232+arpitchakladar@users.noreply.github.com>2025-11-29 00:27:09 +0530
committerArpit Chakladar <54011232+arpitchakladar@users.noreply.github.com>2025-11-29 00:27:09 +0530
commit012f5fc45afc81e18b4ae564ab8207b8c4e02d2a (patch)
treec0319a82c986d117ecccf58e9e6a54fad1236cd8
parent170461002890d55718618bec64feaa8856c3a6d4 (diff)
downloadhome-manager-config-012f5fc45afc81e18b4ae564ab8207b8c4e02d2a.tar.gz
home-manager-config-012f5fc45afc81e18b4ae564ab8207b8c4e02d2a.zip
Added a convenience script system-monitor that runs both bottom (for cpu + cpu temps + network monitoring) and nvtop for graphics card mintoring with tmux.
-rw-r--r--modules/desktop/bspwm/default.nix6
-rw-r--r--modules/desktop/default.nix17
-rw-r--r--modules/scripts/default.nix10
-rw-r--r--modules/scripts/system-monitor.sh34
-rw-r--r--modules/tools/bottom/default.nix13
-rw-r--r--modules/tools/brave/default.nix2
-rw-r--r--modules/tools/default.nix3
-rw-r--r--modules/tools/nvtop/default.nix13
-rw-r--r--modules/tools/tmux/default.nix13
-rw-r--r--users/arpit.nix5
10 files changed, 107 insertions, 9 deletions
diff --git a/modules/desktop/bspwm/default.nix b/modules/desktop/bspwm/default.nix
index d402035..2dc3f91 100644
--- a/modules/desktop/bspwm/default.nix
+++ b/modules/desktop/bspwm/default.nix
@@ -36,7 +36,11 @@
for monitor in $(xrandr -q | grep -w 'connected' | cut -d' ' -f1); do
bspc monitor "$monitor" -d '1' '2' '3' '4' '5' '6'
done
-polybar-msg cmd restart
+
+${config.services.polybar.script}
+${if config.tools.feh.enable then
+ "${pkgs.feh}/bin/feh --bg-scale ${../../../assets/skeleton-mage.png}"
+else "xsetroot -solid \"${config.scheme.withHashtag.base00}\""}
'';
};
}
diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix
index dbb8087..bdf29ae 100644
--- a/modules/desktop/default.nix
+++ b/modules/desktop/default.nix
@@ -15,14 +15,17 @@
xdg.enable = true;
xsession.enable = true;
- xsession.windowManager.command = lib.mkForce "
+ home.file.".xinitrc" = {
+ text = ''
#!/bin/sh
-${if config.tools.feh.enable then
- "${pkgs.feh}/bin/feh --bg-scale ${../../assets/skeleton-mage.png}"
-else "xsetroot -solid \"${config.scheme.withHashtag.base00}\""}
-pkill sxhkd
-sxhkd &
+
+[ -f ~/.Xresources ] && xrdb -merge ~/.Xresources
+[ -f ~/.profile ] && . ~/.profile
+[ -f ~/.xsession ] && . ~/.xsession
+
exec ${pkgs.bspwm}/bin/bspwm
-";
+'';
+ executable = true;
+ };
};
}
diff --git a/modules/scripts/default.nix b/modules/scripts/default.nix
index f421543..62769c2 100644
--- a/modules/scripts/default.nix
+++ b/modules/scripts/default.nix
@@ -14,5 +14,15 @@
source = ./restart-network.sh;
executable = true;
};
+ home.file."scripts/system-monitor" =
+ lib.mkIf
+ (config.tools.bottom.enable &&
+ config.tools.nvtop.enable &&
+ config.tools.tmux.enable &&
+ config.tools.kitty.enable)
+ {
+ source = ./system-monitor.sh;
+ executable = true;
+ };
};
}
diff --git a/modules/scripts/system-monitor.sh b/modules/scripts/system-monitor.sh
new file mode 100644
index 0000000..0364a14
--- /dev/null
+++ b/modules/scripts/system-monitor.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+SESSION="system-monitor"
+
+kitty @ set-font-size -- -4
+
+cleanup() {
+ kitty @ set-font-size -- +4
+}
+trap cleanup EXIT INT TERM
+
+# Kill any existing session
+tmux kill-session -t "$SESSION" 2>/dev/null
+
+# Start new tmux session with btm wrapped to kill session on exit
+tmux new-session -d -s "$SESSION" -c "$HOME" "bash -c 'btm; tmux kill-session -t $SESSION'"
+
+# Split horizontally: right pane runs nvtop wrapped similarly
+tmux split-window -h -t "$SESSION:0" -c "$HOME" "bash -c 'nvtop; tmux kill-session -t $SESSION'"
+
+tmux set -g status off
+tmux set -g mouse on
+tmux set -g focus-events on
+
+# Hover over pane = instant focus
+tmux bind -n MouseDown1Pane select-pane -t= \; send-keys -M
+tmux bind -n MouseDrag1Pane select-pane -t= \; send-keys -M
+
+# Wheel always works in focused pane
+tmux bind -n WheelUpPane select-pane -t= \; send-keys -M
+tmux bind -n WheelDownPane select-pane -t= \; send-keys -M
+
+# Select main pane and attach
+tmux select-pane -t "$SESSION:0.0"
+tmux attach-session -t "$SESSION"
diff --git a/modules/tools/bottom/default.nix b/modules/tools/bottom/default.nix
new file mode 100644
index 0000000..2a7cb01
--- /dev/null
+++ b/modules/tools/bottom/default.nix
@@ -0,0 +1,13 @@
+{ config, pkgs, lib, ... }:
+
+{
+ options.tools.bottom = {
+ enable = lib.mkEnableOption "Enables bottom.";
+ };
+
+ config = lib.mkIf config.tools.bottom.enable {
+ home.packages = with pkgs; [
+ bottom
+ ];
+ };
+}
diff --git a/modules/tools/brave/default.nix b/modules/tools/brave/default.nix
index 3fd5f22..d1b0d3e 100644
--- a/modules/tools/brave/default.nix
+++ b/modules/tools/brave/default.nix
@@ -22,7 +22,7 @@
home.file.".local/bin/brave" = {
text = ''
-#!${pkgs.bash}/bin/bash
+#!/bin/sh
exec ${pkgs.brave}/bin/brave --force-device-scale-factor=1.2 "$@"
'';
executable = true;
diff --git a/modules/tools/default.nix b/modules/tools/default.nix
index d733a12..f40f3f3 100644
--- a/modules/tools/default.nix
+++ b/modules/tools/default.nix
@@ -4,6 +4,7 @@
imports = [
./acpi
./bat
+ ./bottom
./brave
./brightnessctl
./feh
@@ -15,9 +16,11 @@
./neofetch
./neovim
./nnn
+ ./nvtop
./pamixer
./playerctl
./rofi
+ ./tmux
./zsh
];
}
diff --git a/modules/tools/nvtop/default.nix b/modules/tools/nvtop/default.nix
new file mode 100644
index 0000000..7fcbac0
--- /dev/null
+++ b/modules/tools/nvtop/default.nix
@@ -0,0 +1,13 @@
+{ config, pkgs, lib, ... }:
+
+{
+ options.tools.nvtop = {
+ enable = lib.mkEnableOption "Enables nvtop.";
+ };
+
+ config = lib.mkIf config.tools.nvtop.enable {
+ home.packages = with pkgs; [
+ nvtopPackages.full
+ ];
+ };
+}
diff --git a/modules/tools/tmux/default.nix b/modules/tools/tmux/default.nix
new file mode 100644
index 0000000..7559f1a
--- /dev/null
+++ b/modules/tools/tmux/default.nix
@@ -0,0 +1,13 @@
+{ config, pkgs, lib, ... }:
+
+{
+ options.tools.tmux = {
+ enable = lib.mkEnableOption "Enables tmux.";
+ };
+
+ config = lib.mkIf config.tools.tmux.enable {
+ home.packages = with pkgs; [
+ tmux
+ ];
+ };
+}
diff --git a/users/arpit.nix b/users/arpit.nix
index de6136e..f646615 100644
--- a/users/arpit.nix
+++ b/users/arpit.nix
@@ -1,6 +1,8 @@
{ config, ... }:
{
+ nixpkgs.config.allowUnfree = true;
+
home.username = "arpit";
home.homeDirectory = "/home/${config.home.username}";
home.stateVersion = "25.05";
@@ -14,6 +16,7 @@
# Tools
tools.acpi.enable = true;
tools.bat.enable = true;
+ tools.bottom.enable = true;
tools.brave.enable = true;
tools.brightnessctl.enable = true;
tools.feh.enable = true;
@@ -28,9 +31,11 @@
tools.neovim.enable = true;
tools.neovim.profile = "full";
tools.nnn.enable = true;
+ tools.nvtop.enable = true;
tools.pamixer.enable = true;
tools.playerctl.enable = true;
tools.rofi.enable = true;
+ tools.tmux.enable = true;
tools.zsh.enable = true;
programs.home-manager.enable = true;