2024-12-21 10:18:28 -05:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
2025-01-23 21:43:08 -05:00
|
|
|
|
2024-12-21 16:25:40 -05:00
|
|
|
let
|
2025-01-12 15:32:24 -05:00
|
|
|
waybar_sway_config = pkgs.writeTextFile {
|
|
|
|
name = "waybar.conf";
|
|
|
|
text = ''
|
|
|
|
#
|
|
|
|
# Status Bar:
|
|
|
|
#
|
|
|
|
# Read `man 5 sway-bar` for more information about this section.
|
|
|
|
bar {
|
|
|
|
position top
|
|
|
|
|
|
|
|
font pango:Cascadia Mono, FontAwesome 10
|
|
|
|
swaybar_command waybar
|
|
|
|
|
|
|
|
colors {
|
|
|
|
statusline #ffffff
|
|
|
|
background #323232
|
|
|
|
inactive_workspace #32323200 #32323200 #5c5c5c
|
|
|
|
}
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-12-21 16:25:40 -05:00
|
|
|
waybar_available_memory =
|
|
|
|
(pkgs.writeScriptBin "waybar_custom_available_memory" (
|
|
|
|
builtins.readFile ./files/waybar_scripts/waybar_available_memory_linux.bash
|
|
|
|
)).overrideAttrs
|
|
|
|
(old: {
|
|
|
|
buildCommand = "${old.buildCommand}\n patchShebangs $out";
|
2024-12-21 10:18:28 -05:00
|
|
|
|
2024-12-21 16:25:40 -05:00
|
|
|
});
|
|
|
|
waybar_battery =
|
|
|
|
(pkgs.writeScriptBin "waybar_custom_battery" (
|
|
|
|
builtins.readFile ./files/waybar_scripts/waybar_battery_linux.bash
|
|
|
|
)).overrideAttrs
|
|
|
|
(old: {
|
|
|
|
buildCommand = "${old.buildCommand}\n patchShebangs $out";
|
|
|
|
|
|
|
|
});
|
|
|
|
waybar_clock =
|
|
|
|
(pkgs.writeScriptBin "waybar_custom_clock" (
|
|
|
|
builtins.readFile ./files/waybar_scripts/waybar_custom_clock.py
|
|
|
|
)).overrideAttrs
|
|
|
|
(old: {
|
|
|
|
buildCommand = "${old.buildCommand}\n patchShebangs $out";
|
|
|
|
|
|
|
|
});
|
|
|
|
waybar_night_mode =
|
|
|
|
(pkgs.writeScriptBin "waybar_night_mode" (
|
|
|
|
builtins.readFile ./files/waybar_scripts/waybar_night_mode.bash
|
|
|
|
)).overrideAttrs
|
|
|
|
(old: {
|
|
|
|
buildCommand = "${old.buildCommand}\n patchShebangs $out";
|
|
|
|
|
|
|
|
});
|
|
|
|
waybar_sound =
|
|
|
|
(pkgs.writeScriptBin "waybar_custom_sound" (
|
|
|
|
builtins.readFile ./files/waybar_scripts/waybar_sound_linux.bash
|
|
|
|
)).overrideAttrs
|
|
|
|
(old: {
|
|
|
|
buildCommand = "${old.buildCommand}\n patchShebangs $out";
|
|
|
|
|
|
|
|
});
|
|
|
|
waybar_temperature =
|
|
|
|
(pkgs.writeScriptBin "waybar_custom_temperature" (
|
|
|
|
builtins.readFile ./files/waybar_scripts/waybar_temperature_linux.bash
|
|
|
|
)).overrideAttrs
|
|
|
|
(old: {
|
|
|
|
buildCommand = "${old.buildCommand}\n patchShebangs $out";
|
|
|
|
|
|
|
|
});
|
|
|
|
in
|
2024-12-21 10:18:28 -05:00
|
|
|
{
|
|
|
|
imports = [ ];
|
|
|
|
|
2025-01-23 21:43:08 -05:00
|
|
|
options.me = {
|
|
|
|
waybar.enable = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
|
|
|
default = false;
|
|
|
|
example = true;
|
|
|
|
description = "Whether we want to install waybar.";
|
|
|
|
};
|
|
|
|
};
|
2024-12-21 10:18:28 -05:00
|
|
|
|
2025-01-23 21:43:08 -05:00
|
|
|
config = lib.mkIf config.me.waybar.enable (
|
|
|
|
lib.mkMerge [
|
|
|
|
(lib.mkIf config.me.graphical {
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
waybar
|
|
|
|
waybar_available_memory
|
|
|
|
waybar_battery
|
|
|
|
waybar_clock
|
|
|
|
waybar_night_mode
|
|
|
|
waybar_sound
|
|
|
|
waybar_temperature
|
|
|
|
python3 # for clock TODO python should not be in the system packages, maybe switch to a venv? ref https://nixos.wiki/wiki/Python
|
|
|
|
bc # for temperature and sound
|
|
|
|
jq # for memory, battery, sound, night mode, and temperature
|
|
|
|
upower # for battery
|
|
|
|
wlsunset # for night mode
|
|
|
|
];
|
2025-01-12 15:32:24 -05:00
|
|
|
|
2025-01-23 21:43:08 -05:00
|
|
|
me.swayIncludes = [
|
|
|
|
waybar_sway_config
|
|
|
|
];
|
2024-12-21 16:25:40 -05:00
|
|
|
|
2025-01-23 21:43:08 -05:00
|
|
|
services.upower.enable = true; # for battery
|
2024-12-21 10:18:28 -05:00
|
|
|
|
2025-01-23 21:43:08 -05:00
|
|
|
home-manager.users.talexander =
|
|
|
|
{ pkgs, ... }:
|
|
|
|
{
|
|
|
|
home.file = {
|
|
|
|
".config/waybar/config" = {
|
|
|
|
source = ./files/waybar_config.json;
|
|
|
|
};
|
|
|
|
".config/waybar/style.css" = {
|
|
|
|
source = ./files/style.css;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
})
|
|
|
|
]
|
|
|
|
);
|
2024-12-21 10:18:28 -05:00
|
|
|
}
|