-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Fernando Rodrigues <[email protected]>
- Loading branch information
1 parent
c09ee86
commit a1af0bc
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
config, | ||
pkgs, | ||
lib, | ||
... | ||
}: | ||
let | ||
inherit (lib) | ||
getExe | ||
maintainers | ||
mkEnableOption | ||
mkIf | ||
mkOption | ||
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 = mkIf config.programs.fish.enable initScript "fish"; | ||
zsh.interactiveShellInit = mkIf config.programs.zsh.enable initScript "zsh"; | ||
}; | ||
}; | ||
meta.maintainers = with maintainers; [ sigmasquadron ]; | ||
} |