fork/home-manager
git clone https://git.julia.blue/fork/home-manager
a4817894
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let 6 7cfg = config . programs . zoxide ; 8 9cfgOptions = concatStringsSep " " cfg . options ; 10 11in { 12meta . maintainers = [ ]; 13 14options . programs . zoxide = { 15enable = mkEnableOption "zoxide" ; 16 17package = mkOption { 18type = types . package ; 19default = pkgs . zoxide ; 20defaultText = literalExpression "pkgs.zoxide" ; 21description = '' 22Zoxide package to install. 23'' ; 24}; 25 26options = mkOption { 27type = types . listOf types . str ; 28default = [ ]; 29example = [ "--no-aliases" ]; 30description = '' 31List of options to pass to zoxide. 32'' ; 33}; 34 35enableBashIntegration = mkOption { 36default = true ; 37type = types . bool ; 38description = '' 39Whether to enable Bash integration. 40'' ; 41}; 42 43enableZshIntegration = mkOption { 44default = true ; 45type = types . bool ; 46description = '' 47Whether to enable Zsh integration. 48'' ; 49}; 50 51enableFishIntegration = mkOption { 52default = true ; 53type = types . bool ; 54description = '' 55Whether to enable Fish integration. 56'' ; 57}; 58 59enableNushellIntegration = mkOption { 60default = true ; 61type = types . bool ; 62description = '' 63Whether to enable Nushell integration. 64'' ; 65}; 66}; 67 68config = mkIf cfg . enable { 69home . packages = [ cfg . package ]; 70 71programs . bash . initExtra = mkIf cfg . enableBashIntegration '' 72eval "$( ${ cfg . package } /bin/zoxide init bash ${ cfgOptions } )" 73'' ; 74 75programs . zsh . initExtra = mkIf cfg . enableZshIntegration '' 76eval "$( ${ cfg . package } /bin/zoxide init zsh ${ cfgOptions } )" 77'' ; 78 79programs . fish . shellInit = mkIf cfg . enableFishIntegration '' 80${ cfg . package } /bin/zoxide init fish ${ cfgOptions } | source 81'' ; 82 83programs . nushell = mkIf cfg . enableNushellIntegration { 84extraEnv = '' 85let zoxide_cache = " ${ config . xdg . cacheHome } /zoxide" 86if not ($zoxide_cache | path exists) { 87mkdir $zoxide_cache 88} 89${ cfg . package } /bin/zoxide init nushell ${ cfgOptions } | save --force ${ config . xdg . cacheHome } /zoxide/init.nu 90'' ; 91extraConfig = '' 92source ${ config . xdg . cacheHome } /zoxide/init.nu 93'' ; 94}; 95}; 96}