From f7c44b098141959014432ed17c8303855941df36 Mon Sep 17 00:00:00 2001 From: Erwin Boskma Date: Fri, 7 Apr 2023 11:20:18 +0200 Subject: [PATCH] nushell: Temporary workaround for starship generating invalid config --- home-manager/modules/nushell/default.nix | 17 +++++++++++++++++ home-manager/modules/nushell/env.nu | 1 + 2 files changed, 18 insertions(+) diff --git a/home-manager/modules/nushell/default.nix b/home-manager/modules/nushell/default.nix index 08bb270..0f8c60a 100644 --- a/home-manager/modules/nushell/default.nix +++ b/home-manager/modules/nushell/default.nix @@ -2,6 +2,9 @@ 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"; }; @@ -11,6 +14,20 @@ in 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 ]; diff --git a/home-manager/modules/nushell/env.nu b/home-manager/modules/nushell/env.nu index 78c71fc..195f698 100644 --- a/home-manager/modules/nushell/env.nu +++ b/home-manager/modules/nushell/env.nu @@ -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: # let-env PATH = ($env.PATH | split row (char esep) | prepend '/some/path') +