1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-17 19:21:04 +00:00

nixos/pay-respects: init module

Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
This commit is contained in:
Fernando Rodrigues 2024-11-13 15:58:18 +00:00
parent c09ee866a5
commit a1af0bc137
No known key found for this signature in database
GPG key ID: CC3AE2EA00000000
2 changed files with 58 additions and 0 deletions

View file

@ -115,6 +115,8 @@
- [Eintopf](https://eintopf.info), a community event and calendar web application. Available as [services.eintopf](options.html#opt-services.eintopf.enable).
- [`pay-respects`](https://codeberg.org/iff/pay-respects), a terminal command correction program, alternative to `thefuck`, written in Rust. Available as [programs.pay-respects](options.html#opt-programs.pay-respects).
- [Radicle](https://radicle.xyz), an open source, peer-to-peer code collaboration stack built on Git. Available as [services.radicle](#opt-services.radicle.enable).
- [ddns-updater](https://github.com/qdm12/ddns-updater), a service with a WebUI to update DNS records periodically for many providers. Available as [services.ddns-updater](#opt-services.ddns-updater.enable).

View file

@ -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 ];
}