1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-27 12:19:48 +01:00
home-manager/modules/programs/pay-respects.nix

62 lines
1.5 KiB
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
let
inherit (lib) mkEnableOption mkPackageOption getExe optionalString mkIf;
cfg = config.programs.pay-respects;
payRespectsCmd = getExe cfg.package;
in {
meta.maintainers = [ lib.hm.maintainers.ALameLlama ];
options.programs.pay-respects = {
enable = mkEnableOption "pay-respects";
package = mkPackageOption pkgs "pay-respects" { };
enableBashIntegration = mkEnableOption "Bash integration" // {
default = true;
};
enableZshIntegration = mkEnableOption "Zsh integration" // {
default = true;
};
enableFishIntegration = mkEnableOption "Fish integration" // {
default = true;
};
enableNushellIntegration = mkEnableOption "Nushell integration" // {
default = true;
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
programs = {
bash.initExtra = ''
${optionalString cfg.enableBashIntegration ''
eval "$(${payRespectsCmd} bash --alias)"
''}
'';
zsh.initExtra = ''
${optionalString cfg.enableZshIntegration ''
eval "$(${payRespectsCmd} zsh --alias)"
''}
'';
fish.interactiveShellInit = ''
${optionalString cfg.enableFishIntegration ''
${payRespectsCmd} fish --alias | source
''}
'';
nushell.extraConfig = ''
${optionalString cfg.enableNushellIntegration ''
${payRespectsCmd} nushell --alias [<alias>]
''}
'';
};
};
}