summaryrefslogtreecommitdiffstats
path: root/nixos/modules/programs/television.nix
blob: 51685f04d7333f0019824b6506476a9a5e4c2cd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{
  config,
  lib,
  pkgs,
  ...
}:
let
  inherit (lib.options) mkEnableOption mkPackageOption;
  inherit (lib.modules) mkIf;

  cfg = config.programs.television;
in
{
  options.programs.television = {
    enable = mkEnableOption "Blazingly fast general purpose fuzzy finder TUI";
    package = mkPackageOption pkgs "television" { };

    enableBashIntegration = mkEnableOption "Bash integration";
    enableZshIntegration = mkEnableOption "Zsh integration";
    enableFishIntegration = mkEnableOption "Fish integration";
  };

  config = mkIf cfg.enable {
    environment.systemPackages = [ cfg.package ];

    programs = {
      zsh.interactiveShellInit = mkIf cfg.enableZshIntegration ''
        source ${cfg.package}/share/television/completion.zsh
      '';
      bash.interactiveShellInit = mkIf cfg.enableBashIntegration ''
        source ${cfg.package}/share/television/completion.bash
      '';
      fish.interactiveShellInit = mkIf cfg.enableFishIntegration ''
        source ${cfg.package}/share/television/completion.fish
      '';
    };

  };

  meta.maintainers = with lib.maintainers; [ pbek ];
}