2022-02-02 15:46:23 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.programs.eww;
|
2024-07-28 21:37:02 +00:00
|
|
|
ewwCmd = "${cfg.package}/bin/eww";
|
2022-02-02 15:46:23 +00:00
|
|
|
|
|
|
|
in {
|
2022-02-17 21:34:21 +00:00
|
|
|
meta.maintainers = [ hm.maintainers.mainrs ];
|
2022-02-02 15:46:23 +00:00
|
|
|
|
|
|
|
options.programs.eww = {
|
2023-07-01 23:45:18 +00:00
|
|
|
enable = mkEnableOption "eww";
|
2022-02-02 15:46:23 +00:00
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.eww;
|
|
|
|
defaultText = literalExpression "pkgs.eww";
|
|
|
|
example = literalExpression "pkgs.eww";
|
2023-07-01 23:45:18 +00:00
|
|
|
description = ''
|
2022-02-02 15:46:23 +00:00
|
|
|
The eww package to install.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
configDir = mkOption {
|
|
|
|
type = types.path;
|
|
|
|
example = literalExpression "./eww-config-dir";
|
2023-07-01 23:45:18 +00:00
|
|
|
description = ''
|
2022-02-02 15:46:23 +00:00
|
|
|
The directory that gets symlinked to
|
2023-06-30 23:30:13 +00:00
|
|
|
{file}`$XDG_CONFIG_HOME/eww`.
|
2022-02-02 15:46:23 +00:00
|
|
|
'';
|
|
|
|
};
|
2024-07-28 21:37:02 +00:00
|
|
|
|
|
|
|
enableBashIntegration = mkEnableOption "Bash integration" // {
|
|
|
|
default = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
enableZshIntegration = mkEnableOption "Zsh integration" // {
|
|
|
|
default = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
enableFishIntegration = mkEnableOption "Fish integration" // {
|
|
|
|
default = true;
|
|
|
|
};
|
2022-02-02 15:46:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
home.packages = [ cfg.package ];
|
|
|
|
xdg.configFile."eww".source = cfg.configDir;
|
2024-07-28 21:37:02 +00:00
|
|
|
|
|
|
|
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
|
|
|
|
if [[ $TERM != "dumb" ]]; then
|
|
|
|
eval "$(${ewwCmd} shell-completions --shell bash)"
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
|
|
|
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
|
|
|
|
if [[ $TERM != "dumb" ]]; then
|
|
|
|
eval "$(${ewwCmd} shell-completions --shell zsh)"
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
|
|
|
programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration ''
|
|
|
|
if test "$TERM" != "dumb"
|
|
|
|
eval "$(${ewwCmd} shell-completions --shell fish)"
|
|
|
|
end
|
|
|
|
'';
|
2022-02-02 15:46:23 +00:00
|
|
|
};
|
|
|
|
}
|