From da9ca5a563c7201c8973d6f3101fcf46786547a3 Mon Sep 17 00:00:00 2001 From: punkfairie Date: Mon, 26 May 2025 16:24:59 -0700 Subject: [PATCH] feat: waybar --- .../home/programs/waybar.nix | 39 ++++++++++--------- modules/home/shell/niri.nix | 12 +++--- modules/nixos/programs/default.nix | 1 + modules/nixos/programs/waybar.nix | 15 +++++++ modules/nixos/shell/niri.nix | 10 ++++- modules/options/profiles.nix | 1 + 6 files changed, 53 insertions(+), 25 deletions(-) rename snowflake/modules/home/programs/wayland/waybar/default.nix => modules/home/programs/waybar.nix (92%) create mode 100644 modules/nixos/programs/waybar.nix diff --git a/snowflake/modules/home/programs/wayland/waybar/default.nix b/modules/home/programs/waybar.nix similarity index 92% rename from snowflake/modules/home/programs/wayland/waybar/default.nix rename to modules/home/programs/waybar.nix index 4e3d957..b909453 100644 --- a/snowflake/modules/home/programs/wayland/waybar/default.nix +++ b/modules/home/programs/waybar.nix @@ -1,19 +1,23 @@ { - lib, + marleylib, config, + osConfig, + lib, pkgs, ... }: let - cfg = config.marleyos.programs.waybar; -in { - options.marleyos.programs.waybar = { - enable = lib.mkEnableOption "waybar"; - }; + inherit (marleylib.module) mkEnableOption'; - config = lib.mkIf cfg.enable { + cfg = config.marleyos.programs.waybar; + osCfg = osConfig.marleyos.programs.waybar; +in { + options.marleyos.programs.waybar.enable = + mkEnableOption' "waybar" osCfg.enable; + + config = lib.mkIf (cfg.enable && pkgs.stdenv.isLinux) { marleyos = { - services.swaync.enable = true; - programs.wlogout.enable = true; + # services.swaync.enable = true; + # programs.wlogout.enable = true; }; stylix.targets.waybar.addCss = false; @@ -26,9 +30,10 @@ in { settings = let niri = config.programs.niri - # HM module doesn't include an enable option... + # HM module doesn't include an enable option when imported by nixOS + # module... // { - enable = config.marleyos.wayland.niri.enable; + inherit (config.marleyos.shell.niri) enable; }; in [ { @@ -47,18 +52,16 @@ in { "cpu" "memory" ]; - modules-center = - [] - ++ (lib.optionals niri.enable [ - "niri/workspaces" - ]); + modules-center = lib.optionals niri.enable [ + "niri/workspaces" + ]; modules-right = [ "mpd" "custom/notifications" "tray" ] - ++ (lib.optionals (!config.marleyos.isDesktop) [ + ++ (lib.optionals config.marleycfg.profiles.laptop [ "battery" ]) ++ [ @@ -71,7 +74,7 @@ in { tooltip = false; format = ""; on-click = let - inherit (config.marleyos.apps) launcher; + inherit (config.marleycfg.apps) launcher; in "sleep 0.1 && ${lib.getExe launcher.package} ${launcher.command}"; }; diff --git a/modules/home/shell/niri.nix b/modules/home/shell/niri.nix index 5278f56..f733a51 100644 --- a/modules/home/shell/niri.nix +++ b/modules/home/shell/niri.nix @@ -24,12 +24,12 @@ in { config = lib.mkIf (cfg.enable && pkgs.stdenv.isLinux) { marleyos = { shell.wayland = enabled; - # programs = { - # waybar = enabled; - # wlogout = enabled; - # fuzzel = enabled; - # xwayland-satellite = enabled; - # }; + programs = { + waybar = enabled; + # wlogout = enabled; + # fuzzel = enabled; + # xwayland-satellite = enabled; + }; # services = { # swaybg = enabled; # swaync = enabled; diff --git a/modules/nixos/programs/default.nix b/modules/nixos/programs/default.nix index e4a4d1c..eb2502c 100644 --- a/modules/nixos/programs/default.nix +++ b/modules/nixos/programs/default.nix @@ -2,5 +2,6 @@ imports = [ ./fish.nix ./nh.nix + ./waybar.nix ]; } diff --git a/modules/nixos/programs/waybar.nix b/modules/nixos/programs/waybar.nix new file mode 100644 index 0000000..cdbd943 --- /dev/null +++ b/modules/nixos/programs/waybar.nix @@ -0,0 +1,15 @@ +{ + lib, + config, + ... +}: let + cfg = config.marleyos.programs.waybar; +in { + options.marleyos.programs.waybar.enable = lib.mkEnableOption "waybar"; + + config = lib.mkIf cfg.enable { + programs.waybar = { + enable = true; + }; + }; +} diff --git a/modules/nixos/shell/niri.nix b/modules/nixos/shell/niri.nix index 069d7aa..fcaa6ae 100644 --- a/modules/nixos/shell/niri.nix +++ b/modules/nixos/shell/niri.nix @@ -1,17 +1,25 @@ { config, + marleylib, lib, inputs, ... }: let cfg = config.marleyos.shell.niri; + + inherit (marleylib.module) enabled; in { options.marleyos.shell.niri.enable = lib.mkEnableOption "niri"; imports = [inputs.niri-flake.nixosModules.niri]; config = lib.mkIf cfg.enable { - marleyos.shell.hyprlock.enable = true; + marleyos = { + shell.hyprlock = enabled; + programs = { + waybar = enabled; + }; + }; programs.niri = { enable = true; diff --git a/modules/options/profiles.nix b/modules/options/profiles.nix index 6572858..ac4ed71 100644 --- a/modules/options/profiles.nix +++ b/modules/options/profiles.nix @@ -7,6 +7,7 @@ in { options.marleycfg.profiles = { desktop = lib.mkEnableOption "graphical desktop profile"; + laptop = lib.mkEnableOption "laptop profile"; server = lib.mkEnableOption "server profile"; };