mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-27 08:04:14 +00:00
c346fd5125
Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
58 lines
1.3 KiB
Nix
58 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 ];
|
|
}
|