mirror of
https://github.com/nix-community/home-manager
synced 2024-12-23 18:29:47 +01:00
autojump: add module
This also deprecates the `programs.bash.enableAutojump` option in favor of this module.
This commit is contained in:
parent
7e5fee4268
commit
8537920706
8 changed files with 93 additions and 12 deletions
3
.github/CODEOWNERS
vendored
3
.github/CODEOWNERS
vendored
|
@ -33,6 +33,9 @@
|
|||
|
||||
/modules/programs/aria2.nix @JustinLovinger
|
||||
|
||||
/modules/programs/autojump.nix @evanjs
|
||||
/tests/modules/programs/autojump @evanjs
|
||||
|
||||
/modules/programs/autorandr.nix @uvNikita
|
||||
|
||||
/modules/programs/bash.nix @rycee
|
||||
|
|
|
@ -1687,6 +1687,16 @@ in
|
|||
A new module is available: 'programs.mu'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-10-08T21:28:16+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.autojump'
|
||||
|
||||
The option `programs.bash.enableAutojump` is deprecated and this new
|
||||
module should be used instead.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ let
|
|||
(loadModule ./programs/alot.nix { })
|
||||
(loadModule ./programs/aria2.nix { })
|
||||
(loadModule ./programs/astroid.nix { })
|
||||
(loadModule ./programs/autojump.nix { })
|
||||
(loadModule ./programs/autorandr.nix { })
|
||||
(loadModule ./programs/bash.nix { })
|
||||
(loadModule ./programs/bat.nix { })
|
||||
|
|
56
modules/programs/autojump.nix
Normal file
56
modules/programs/autojump.nix
Normal file
|
@ -0,0 +1,56 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.autojump;
|
||||
package = pkgs.autojump;
|
||||
|
||||
in {
|
||||
meta.maintainers = [ maintainers.evanjs ];
|
||||
|
||||
options.programs.autojump = {
|
||||
enable = mkEnableOption "autojump";
|
||||
|
||||
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 = [ package ];
|
||||
|
||||
programs.bash.initExtra = mkIf cfg.enableBashIntegration (mkBefore ''
|
||||
. ${package}/share/autojump/autojump.bash
|
||||
'');
|
||||
|
||||
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
|
||||
. ${package}/share/autojump/autojump.zsh
|
||||
'';
|
||||
|
||||
programs.fish.promptInit = mkIf cfg.enableFishIntegration ''
|
||||
. ${package}/share/autojump/autojump.fish
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -11,6 +11,14 @@ in
|
|||
{
|
||||
meta.maintainers = [ maintainers.rycee ];
|
||||
|
||||
imports = [
|
||||
(mkRenamedOptionModule [ "programs" "bash" "enableAutojump" ] [
|
||||
"programs"
|
||||
"autojump"
|
||||
"enable"
|
||||
])
|
||||
];
|
||||
|
||||
options = {
|
||||
programs.bash = {
|
||||
enable = mkEnableOption "GNU Bourne-Again SHell";
|
||||
|
@ -94,12 +102,6 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
enableAutojump = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = "Enable the autojump navigation tool.";
|
||||
};
|
||||
|
||||
profileExtra = mkOption {
|
||||
default = "";
|
||||
type = types.lines;
|
||||
|
@ -176,9 +178,6 @@ in
|
|||
|
||||
${aliasesStr}
|
||||
|
||||
${optionalString cfg.enableAutojump
|
||||
". ${pkgs.autojump}/share/autojump/autojump.bash"}
|
||||
|
||||
${cfg.initExtra}
|
||||
fi
|
||||
'';
|
||||
|
@ -216,9 +215,6 @@ in
|
|||
${cfg.logoutExtra}
|
||||
'';
|
||||
};
|
||||
|
||||
home.packages =
|
||||
optional (cfg.enableAutojump) pkgs.autojump;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ import nmt {
|
|||
./modules/programs/alacritty
|
||||
./modules/programs/alot
|
||||
./modules/programs/aria2
|
||||
./modules/programs/autojump
|
||||
./modules/programs/bash
|
||||
./modules/programs/browserpass
|
||||
./modules/programs/dircolors
|
||||
|
|
13
tests/modules/programs/autojump/default-settings.nix
Normal file
13
tests/modules/programs/autojump/default-settings.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.autojump.enable = true;
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-path/bin/autojump
|
||||
'';
|
||||
};
|
||||
}
|
1
tests/modules/programs/autojump/default.nix
Normal file
1
tests/modules/programs/autojump/default.nix
Normal file
|
@ -0,0 +1 @@
|
|||
{ autojump = ./default-settings.nix; }
|
Loading…
Reference in a new issue