mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-05 16:41:04 +01:00
pay-respects: add module
Add pay-respects module including shell integration support for bash, zsh, fish and nushell.
This commit is contained in:
parent
99f54cdfef
commit
db9a98e178
8 changed files with 138 additions and 0 deletions
61
modules/programs/pay-respects.nix
Normal file
61
modules/programs/pay-respects.nix
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
{ 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>]
|
||||
''}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue