diff options
author | Anderson Torres <torres.anderson.85@protonmail.com> | 2022-12-04 07:51:43 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-04 07:51:43 -0300 |
commit | b793d485158ca76ab0e788ca4c48cb97b8a8c42e (patch) | |
tree | 3097c9fb1985defdfe2d2eb98c9665629a762387 /nixos/modules/programs | |
parent | 4f1cf454578471c4473b1479a97716de5c167dc4 (diff) | |
parent | a78621f9b02cb5a1a0d671b9f721349a9ad0e558 (diff) |
Merge pull request #204352 from laalsaas/skim
skim: refactor and init module
Diffstat (limited to 'nixos/modules/programs')
-rw-r--r-- | nixos/modules/programs/skim.nix | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/nixos/modules/programs/skim.nix b/nixos/modules/programs/skim.nix new file mode 100644 index 0000000000000..1333cdd30ab23 --- /dev/null +++ b/nixos/modules/programs/skim.nix @@ -0,0 +1,30 @@ +{ pkgs, config, lib, ... }: +let + inherit (lib) mdDoc mkEnableOption mkPackageOption optional optionalString; + cfg = config.programs.skim; +in +{ + options = { + programs.skim = { + fuzzyCompletion = mkEnableOption (mdDoc "fuzzy Completion with skim"); + keybindings = mkEnableOption (mdDoc "skim keybindings"); + package = mkPackageOption pkgs "skim" {}; + }; + }; + + config = { + environment.systemPackages = optional (cfg.keybindings || cfg.fuzzyCompletion) cfg.package; + + programs.bash.interactiveShellInit = optionalString cfg.fuzzyCompletion '' + source ${cfg.package}/share/skim/completion.bash + '' + optionalString cfg.keybindings '' + source ${cfg.package}/share/skim/key-bindings.bash + ''; + + programs.zsh.interactiveShellInit = optionalString cfg.fuzzyCompletion '' + source ${cfg.package}/share/skim/completion.zsh + '' + optionalString cfg.keybindings '' + source ${cfg.package}/share/skim/key-bindings.zsh + ''; + }; +} |