mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
goto: init module
This commit is contained in:
parent
ad5d2b4aa7
commit
88913c98fe
3 changed files with 47 additions and 0 deletions
32
modules/programs/goto.nix
Normal file
32
modules/programs/goto.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.programs.goto;
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ lib.maintainers.bmrips ];
|
||||
|
||||
options.programs.goto = {
|
||||
enable = lib.mkEnableOption "{command}`goto`.";
|
||||
package = lib.mkPackageOption pkgs "goto" { };
|
||||
enableBashIntegration = lib.hm.shell.mkBashIntegrationOption { inherit config; };
|
||||
enableZshIntegration = lib.hm.shell.mkZshIntegrationOption { inherit config; };
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
programs =
|
||||
let
|
||||
init = "source ${cfg.package}/share/goto.sh";
|
||||
in
|
||||
{
|
||||
bash.initExtra = lib.mkIf cfg.enableBashIntegration init;
|
||||
zsh.initContent = lib.mkIf cfg.enableZshIntegration init;
|
||||
};
|
||||
};
|
||||
}
|
||||
3
tests/modules/programs/goto/default.nix
Normal file
3
tests/modules/programs/goto/default.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
goto-shell-initialization = ./shell-initialization.nix;
|
||||
}
|
||||
12
tests/modules/programs/goto/shell-initialization.nix
Normal file
12
tests/modules/programs/goto/shell-initialization.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
programs.bash.enable = true;
|
||||
programs.goto.enable = true;
|
||||
programs.zsh.enable = true;
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.bashrc
|
||||
assertFileRegex home-files/.bashrc '^source \S*/share/goto.sh$'
|
||||
assertFileExists home-files/.zshrc
|
||||
assertFileRegex home-files/.zshrc '^source \S*/share/goto.sh$'
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue