nushell: Temporary workaround for starship generating invalid config

This commit is contained in:
Erwin Boskma 2023-04-07 11:20:18 +02:00
parent 957e5081c1
commit f7c44b0981
Signed by: erwin
SSH key fingerprint: SHA256:Vw4O4qA0i5x65Y7yyjDpWDCSMSXAhqT4X7cJ3frdnLY
2 changed files with 18 additions and 0 deletions

View file

@ -2,6 +2,9 @@
with lib; with lib;
let let
cfg = config.eboskma.programs.nushell; cfg = config.eboskma.programs.nushell;
# TODO: Remove when starship is updated
starshipCmd = "${config.home.profileDirectory}/bin/starship";
in in
{ {
options.eboskma.programs.nushell = { enable = mkEnableOption "nu shell"; }; options.eboskma.programs.nushell = { enable = mkEnableOption "nu shell"; };
@ -11,6 +14,20 @@ in
enable = true; enable = true;
configFile.source = ./config.nu; configFile.source = ./config.nu;
envFile.source = ./env.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 ]; home.packages = [ pkgs.carapace ];

View file

@ -38,3 +38,4 @@ let-env NU_PLUGIN_DIRS = [
# To add entries to PATH (on Windows you might use Path), you can use the following pattern: # To add entries to PATH (on Windows you might use Path), you can use the following pattern:
# let-env PATH = ($env.PATH | split row (char esep) | prepend '/some/path') # let-env PATH = ($env.PATH | split row (char esep) | prepend '/some/path')