1
0
Fork 0
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:
Benedikt Rips 2025-08-06 09:22:07 +02:00 committed by Austin Horstman
parent ad5d2b4aa7
commit 88913c98fe
3 changed files with 47 additions and 0 deletions

32
modules/programs/goto.nix Normal file
View 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;
};
};
}

View file

@ -0,0 +1,3 @@
{
goto-shell-initialization = ./shell-initialization.nix;
}

View 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$'
'';
}