aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario Rodas <marsam@users.noreply.github.com>2020-05-25 04:20:00 -0500
committerRobert Helgesson <robert@rycee.net>2020-05-26 19:14:39 +0200
commita957e2dc6bad9da6464d64cf110c772660035244 (patch)
treebfdb24a110272473701f24e9a57460e0bfe871a0
parent99a97c917a019ce4eaabe78f5aeb44f88e3ede94 (diff)
zoxide: add module
PR #1274
-rw-r--r--.github/CODEOWNERS2
-rw-r--r--modules/misc/news.nix7
-rw-r--r--modules/modules.nix1
-rw-r--r--modules/programs/zoxide.nix79
4 files changed, 89 insertions, 0 deletions
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index ab79da03e56..4a890f1f707 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -97,6 +97,8 @@
/modules/programs/zathura.nix @rprospero
+/modules/programs/zoxide.nix @marsam
+
/modules/services/cbatticon.nix @pmiddend
/modules/services/dunst.nix @rycee
diff --git a/modules/misc/news.nix b/modules/misc/news.nix
index 57840fcb609..933446aa19e 100644
--- a/modules/misc/news.nix
+++ b/modules/misc/news.nix
@@ -1520,6 +1520,13 @@ in
A new module is available: 'programs.dircolors'
'';
}
+
+ {
+ time = "2020-05-26T17:13:58+00:00";
+ message = ''
+ A new module is available: 'programs.zoxide'
+ '';
+ }
];
};
}
diff --git a/modules/modules.nix b/modules/modules.nix
index 1ca6fe4cffa..1f4deefee5d 100644
--- a/modules/modules.nix
+++ b/modules/modules.nix
@@ -116,6 +116,7 @@ let
(loadModule ./programs/vscode/haskell.nix { })
(loadModule ./programs/z-lua.nix { })
(loadModule ./programs/zathura.nix { })
+ (loadModule ./programs/zoxide.nix { })
(loadModule ./programs/zsh.nix { })
(loadModule ./services/blueman-applet.nix { })
(loadModule ./services/cbatticon.nix { condition = hostPlatform.isLinux; })
diff --git a/modules/programs/zoxide.nix b/modules/programs/zoxide.nix
new file mode 100644
index 00000000000..842ff109294
--- /dev/null
+++ b/modules/programs/zoxide.nix
@@ -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
+ '';
+ };
+}