nixos-config/home-manager/modules/nushell/default.nix

35 lines
1 KiB
Nix

{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.eboskma.programs.nushell;
# TODO: Remove when starship is updated
starshipCmd = "${config.home.profileDirectory}/bin/starship";
in
{
options.eboskma.programs.nushell = { enable = mkEnableOption "nu shell"; };
config = mkIf cfg.enable {
programs.nushell = {
enable = true;
configFile.source = ./config.nu;
envFile.source = ./env.nu;
# TODO: Remove when starship is updated to the new nu 0.78 syntax
extraEnv = ''
let starship_cache = "${config.xdg.cacheHome}/starship"
if not ($starship_cache | path exists) {
mkdir $starship_cache
}
${starshipCmd} init nu | str replace --string 'PROMPT_COMMAND = {' 'PROMPT_COMMAND = { ||' | str replace --string 'PROMPT_COMMAND_RIGHT = {' 'PROMPT_COMMAND_RIGHT = { ||' | save --force ${config.xdg.cacheHome}/starship/init.nu
'';
extraConfig = ''
source ${config.xdg.cacheHome}/starship/init.nu
'';
};
home.packages = [ pkgs.carapace ];
};
}