* Nix flake for Xmobar
This flake exposes a module to use with home-manager.
Here is how to set it up:
1. Add the nixmobar flake as an input to your NiOS flake:
#+BEGIN_SRC nix
inputs = {
nixmobar.url = "git+https://codeberg.org/xmobar/xmobar.git/?dir=nix";
};
#+END_SRC
2. And then, where you import your `home.nix`, add `extraSpecialArgs` like this:
#+BEGIN_SRC nix
home-manager = {
extraSpecialArgs = {
inherit inputs nixmobar;
};
users.refaelsh = import ./home.nix;
};
#+END_SRC
3. Final step, use the module in `home.nix`:
#+BEGIN_SRC nix
{
inputs,
...
}:
{
home.stateversion = "24.05";
imports = [
inputs.nixmobar.homemodules.mainmodule
# Other imports go here.
];
}
#+END_SRC
* Example usage
#+BEGIN_SRC haskell
{
programs.nixmobar = {
enable = true;
font = "Fira Code 13";
additionalFonts = [ "Fira Code 22" ];
bgColor = "#282A36";
fgColor = "#F8F8F2";
textOffset = 2;
verbose = true;
allDesktops = true;
lowerOnStart = true;
overrideRedirect = true;
position = "BottomH 26";
alpha = 200;
alignSep = "}{";
template = "%XMonadLog% }{ %load%|%disku%|%diskio%|%wifi_signal%|%dynnetwork%|%cat0%|%multicoretemp%|%cpufreq%|%multicpu%|%kbd%|%memory% %swap%|%battery%|%alsa:default:Master%|%kernel_version%|%date%|%_XMONAD_TRAYPAD%";
commands = # haskell
''
Run XMonadLog,
Run DiskU [("/", "\xf0a0 ")] [] 50,
Run DiskIO [("/", " R W ")] ["-t", "", "-w", "4"] 10,
Run DynNetwork ["-t", "KB/s\x1F89B\x1F899KB/s", "-w", "5"] 10,
Run Memory ["-t", "\xE266%"] 10,
Run Swap ["-t", "S%"] 10,
Run Kbd [],
Run CpuFreq ["-t", "GHz"] 50,
Run MultiCoreTemp ["-t", "\xf2c9°", "-L", "60", "-H", "95", "-l", "white", "-n", "white", "-h", "red"] 50,
Run CatInt 0 "/sys/class/hwmon/hwmon4/fan1_input" [] 50,
Run MultiCpu ["-t", "\xf4bc ", "-w", "99", "-L", "3", "-H", "50", "--normal", "green", "--high", "red"] 10,
Run BatteryP ["BAT0"] ["-t", "%", "-L", "10", "-H", "80", "-p", "3", "--", "-O", "On - ", "-i", "", "-L", "-15", "-H", "-5", "-l", "red", "-m", "blue", "-h", "green", "-a", "notify-send -u critical 'Battery running out!!'", "-A", "3"] 600,
Run Alsa "default" "Master" ["-t", "\xf028 %"],
Run Date "%a %_d %b %H:%M:%S" "date" 10,
Run Load ["-t", "L", "-L", "1", "-H", "3", "-d", "2"] 300,
Run ComX "nmcli" ["-t", "-f", "SIGNAL", "dev", "wifi"] "N/A" "wifi_signal" 50,
Run Com "uname" ["-r"] "kernel_version" 3600,
Run XPropertyLog "_XMONAD_TRAYPAD"
'';
};
}
#+END_SRC