46 lines
1.0 KiB
Nix
46 lines
1.0 KiB
Nix
{ lib, config, ... }:
|
|
|
|
let
|
|
# --- Module variables ---
|
|
moduleName = "waybar";
|
|
username = config.defaultUser or "henrov";
|
|
|
|
# Assets directory (self-contained)
|
|
assetPath = ../../../assets/system/conf/${moduleName};
|
|
|
|
# Read required config files
|
|
waybarConfig = "${assetPath}/waybar.conf";
|
|
waybarStyle = "${assetPath}/style.css";
|
|
|
|
# Top-level toggle
|
|
enableProgram = config.enableWaybar or false;
|
|
in
|
|
{
|
|
# --- Option ---
|
|
options.enableWaybar =
|
|
lib.mkEnableOption "Enable Waybar status bar";
|
|
|
|
# --- Config ---
|
|
config = lib.mkIf enableProgram {
|
|
|
|
# Install Waybar (symbolic reference expected to be resolved elsewhere)
|
|
environment.systemPackages = [
|
|
"waybar"
|
|
];
|
|
|
|
# Deploy only required files to ~/.config/waybar
|
|
home-manager.users.${username}.xdg.configFile = {
|
|
|
|
"waybar/config".source =
|
|
if builtins.pathExists waybarConfig
|
|
then waybarConfig
|
|
else null;
|
|
|
|
"waybar/style.css".source =
|
|
if builtins.pathExists waybarStyle
|
|
then waybarStyle
|
|
else null;
|
|
};
|
|
};
|
|
}
|