nixos/zoxide: init module (#393493)
This commit is contained in:
commit
82f0c74912
@ -132,6 +132,8 @@
|
||||
|
||||
- [duckdns](https://www.duckdns.org), free dynamic DNS. Available with [services.duckdns](options.html#opt-services.duckdns.enable)
|
||||
|
||||
- [Zoxide](https://github.com/ajeetdsouza/zoxide), a smarter cd command, inspired by z and autojump. Available as [programs.zoxide](options.html#opt-programs.zoxide.enable)
|
||||
|
||||
- [victorialogs][https://docs.victoriametrics.com/victorialogs/], log database from VictoriaMetrics. Available as [services.victorialogs](#opt-services.victorialogs.enable)
|
||||
|
||||
- [gokapi](https://github.com/Forceu/Gokapi), Lightweight selfhosted Firefox Send alternative without public upload. AWS S3 supported. Available with [services.gokapi](options.html#opt-services.gokapi.enable)
|
||||
|
@ -353,6 +353,7 @@
|
||||
./programs/ydotool.nix
|
||||
./programs/yubikey-touch-detector.nix
|
||||
./programs/zmap.nix
|
||||
./programs/zoxide.nix
|
||||
./programs/zsh/oh-my-zsh.nix
|
||||
./programs/zsh/zsh-autoenv.nix
|
||||
./programs/zsh/zsh-autosuggestions.nix
|
||||
|
72
nixos/modules/programs/zoxide.nix
Normal file
72
nixos/modules/programs/zoxide.nix
Normal file
@ -0,0 +1,72 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib.options) mkEnableOption mkPackageOption mkOption;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.types) listOf str;
|
||||
inherit (lib.strings) concatStringsSep;
|
||||
|
||||
cfg = config.programs.zoxide;
|
||||
|
||||
cfgFlags = concatStringsSep " " cfg.flags;
|
||||
|
||||
in
|
||||
{
|
||||
options.programs.zoxide = {
|
||||
enable = mkEnableOption "zoxide, a smarter cd command that learns your habits";
|
||||
package = mkPackageOption pkgs "zoxide" { };
|
||||
|
||||
enableBashIntegration = mkEnableOption "Bash integration" // {
|
||||
default = true;
|
||||
};
|
||||
enableZshIntegration = mkEnableOption "Zsh integration" // {
|
||||
default = true;
|
||||
};
|
||||
enableFishIntegration = mkEnableOption "Fish integration" // {
|
||||
default = true;
|
||||
};
|
||||
enableXonshIntegration = mkEnableOption "Xonsh integration" // {
|
||||
default = true;
|
||||
};
|
||||
|
||||
flags = mkOption {
|
||||
type = listOf str;
|
||||
default = [ ];
|
||||
example = [
|
||||
"--no-cmd"
|
||||
"--cmd j"
|
||||
];
|
||||
description = ''
|
||||
List of flags for zoxide init
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
|
||||
programs = {
|
||||
zsh.interactiveShellInit = mkIf cfg.enableZshIntegration ''
|
||||
eval "$(${getExe cfg.package} init zsh ${cfgFlags} )"
|
||||
'';
|
||||
bash.interactiveShellInit = mkIf cfg.enableBashIntegration ''
|
||||
eval "$(${getExe cfg.package} init bash ${cfgFlags} )"
|
||||
'';
|
||||
fish.interactiveShellInit = mkIf cfg.enableFishIntegration ''
|
||||
${getExe cfg.package} init fish ${cfgFlags} | source
|
||||
'';
|
||||
xonsh.config = ''
|
||||
execx($(${getExe cfg.package} init xonsh ${cfgFlags}), 'exec', __xonsh__.ctx, filename='zoxide')
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
meta.maintainers = with lib.maintainers; [ heisfer ];
|
||||
}
|
Loading…
Reference in New Issue
Block a user