{ config, lib, pkgs, ... }:

let cfg = config.sydnix.users.crumb.waybar;
in {
  options.sydnix.users.crumb.waybar = {
    enable = lib.mkEnableOption "Waybar, à la crumb";
  };

  config = lib.mkIf cfg.enable {
    home.packages = [
      pkgs.martian-mono
      pkgs.nerd-fonts.symbols-only
    ];

    stylix.targets.waybar.enable = false;
    programs.waybar = {
      enable = true;
      style = ./waybar/src/waybar.css;
      systemd.enable = true;
      systemd.target = "niri.service";
      settings.sydbar = import ./waybar/src/waybar.nix {
        niri-gaps = config.programs.niri.settings.layout.gaps;
        inherit pkgs lib;
      };
    };
  };
}
