zoxide: add module

PR #1274
This commit is contained in:
Mario Rodas 2020-05-25 04:20:00 -05:00 committed by Robert Helgesson
parent 99a97c917a
commit a957e2dc6b
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
4 changed files with 89 additions and 0 deletions

2
.github/CODEOWNERS vendored
View file

@ -97,6 +97,8 @@
/modules/programs/zathura.nix @rprospero /modules/programs/zathura.nix @rprospero
/modules/programs/zoxide.nix @marsam
/modules/services/cbatticon.nix @pmiddend /modules/services/cbatticon.nix @pmiddend
/modules/services/dunst.nix @rycee /modules/services/dunst.nix @rycee

View file

@ -1520,6 +1520,13 @@ in
A new module is available: 'programs.dircolors' A new module is available: 'programs.dircolors'
''; '';
} }
{
time = "2020-05-26T17:13:58+00:00";
message = ''
A new module is available: 'programs.zoxide'
'';
}
]; ];
}; };
} }

View file

@ -116,6 +116,7 @@ let
(loadModule ./programs/vscode/haskell.nix { }) (loadModule ./programs/vscode/haskell.nix { })
(loadModule ./programs/z-lua.nix { }) (loadModule ./programs/z-lua.nix { })
(loadModule ./programs/zathura.nix { }) (loadModule ./programs/zathura.nix { })
(loadModule ./programs/zoxide.nix { })
(loadModule ./programs/zsh.nix { }) (loadModule ./programs/zsh.nix { })
(loadModule ./services/blueman-applet.nix { }) (loadModule ./services/blueman-applet.nix { })
(loadModule ./services/cbatticon.nix { condition = hostPlatform.isLinux; }) (loadModule ./services/cbatticon.nix { condition = hostPlatform.isLinux; })

View file

@ -0,0 +1,79 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.zoxide;
in {
meta.maintainers = [ maintainers.marsam ];
options.programs.zoxide = {
enable = mkEnableOption "zoxide";
package = mkOption {
type = types.package;
default = pkgs.zoxide;
defaultText = literalExample "pkgs.zoxide";
description = ''
Zoxide package to install.
'';
};
options = mkOption {
type = types.listOf types.str;
default = [ ];
example = [ "--no-aliases" ];
description = ''
List of options to pass to zoxide.
'';
};
enableBashIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Bash integration.
'';
};
enableZshIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Zsh integration.
'';
};
enableFishIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Fish integration.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
eval "$(${cfg.package}/bin/zoxide init bash ${
concatStringsSep " " cfg.options
})"
'';
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
eval "$(${cfg.package}/bin/zoxide init zsh ${
concatStringsSep " " cfg.options
})"
'';
programs.fish.shellInit = mkIf cfg.enableFishIntegration ''
${cfg.package}/bin/zoxide init fish ${
concatStringsSep " " cfg.options
} | source
'';
};
}