0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 13:40:28 +03:00
nixpkgs/nixos/modules/programs/pay-respects.nix
Fernando Rodrigues b89e0bf06f nixos/pay-respects: fix interactiveShellInit for fish and zsh
Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
(cherry picked from commit c346fd5125)
2024-11-19 19:56:24 +00:00

57 lines
1.3 KiB
Nix

{
config,
pkgs,
lib,
...
}:
let
inherit (lib)
getExe
maintainers
mkEnableOption
mkIf
mkOption
optionalString
types
;
inherit (types) str;
cfg = config.programs.pay-respects;
initScript =
shell:
if (shell != "fish") then
''
eval $(${getExe pkgs.pay-respects} ${shell} --alias ${cfg.alias})
''
else
''
${getExe pkgs.pay-respects} ${shell} --alias ${cfg.alias} | source
'';
in
{
options = {
programs.pay-respects = {
enable = mkEnableOption "pay-respects, an app which corrects your previous console command";
alias = mkOption {
default = "f";
type = str;
description = ''
`pay-respects` needs an alias to be configured.
The default value is `f`, but you can use anything else as well.
'';
};
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.pay-respects ];
programs = {
bash.interactiveShellInit = initScript "bash";
fish.interactiveShellInit = optionalString config.programs.fish.enable (initScript "fish");
zsh.interactiveShellInit = optionalString config.programs.zsh.enable (initScript "zsh");
};
};
meta.maintainers = with maintainers; [ sigmasquadron ];
}