1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-06 00:51:04 +01:00

oh-my-posh: build-time nushell config generation

This commit is contained in:
jaredmontoya 2025-03-21 20:11:07 +01:00 committed by Austin Horstman
parent 287cbbbf80
commit 812a12d014
2 changed files with 14 additions and 23 deletions

View file

@ -68,27 +68,26 @@ in {
};
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
eval "$(${cfg.package}/bin/oh-my-posh init bash ${configArgument})"
eval "$(${lib.getExe cfg.package} init bash ${configArgument})"
'';
programs.zsh.initContent = mkIf cfg.enableZshIntegration ''
eval "$(${cfg.package}/bin/oh-my-posh init zsh ${configArgument})"
eval "$(${lib.getExe cfg.package} init zsh ${configArgument})"
'';
programs.fish.shellInit = mkIf cfg.enableFishIntegration ''
${cfg.package}/bin/oh-my-posh init fish ${configArgument} | source
${lib.getExe cfg.package} init fish ${configArgument} | source
'';
programs.nushell = mkIf cfg.enableNushellIntegration {
extraEnv = ''
let oh_my_posh_cache = "${config.xdg.cacheHome}/oh-my-posh"
if not ($oh_my_posh_cache | path exists) {
mkdir $oh_my_posh_cache
}
${cfg.package}/bin/oh-my-posh init nu ${configArgument} --print | save --force ${config.xdg.cacheHome}/oh-my-posh/init.nu
'';
extraConfig = ''
source ${config.xdg.cacheHome}/oh-my-posh/init.nu
source ${
pkgs.runCommand "oh-my-posh-nushell-config" { } ''
${
lib.getExe cfg.package
} init nu ${configArgument} --print >> "$out"
''
}
'';
};
};