From 2b3bb17e871b22250e7ee5dbf422b8c40c5d5c79 Mon Sep 17 00:00:00 2001 From: jaredmontoya <49511278+jaredmontoya@users.noreply.github.com> Date: Mon, 30 Jun 2025 00:34:38 +0200 Subject: [PATCH] oh-my-posh: fix nushell with v26.0.0 (#7342) --- modules/programs/oh-my-posh.nix | 13 +++++++++---- tests/modules/programs/oh-my-posh/nushell.nix | 16 +++++++++++++--- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/modules/programs/oh-my-posh.nix b/modules/programs/oh-my-posh.nix index 358a0693..21b02625 100644 --- a/modules/programs/oh-my-posh.nix +++ b/modules/programs/oh-my-posh.nix @@ -82,10 +82,15 @@ in programs.nushell = mkIf cfg.enableNushellIntegration { extraConfig = '' - source ${ - pkgs.runCommand "oh-my-posh-nushell-config.nu" { } '' - ${lib.getExe cfg.package} init nu ${configArgument} --print >> "$out" - '' + ${ + if lib.versionAtLeast (lib.versions.major cfg.package.version) "26" then + "${lib.getExe cfg.package} init nu ${configArgument}" + else + ''source ${ + pkgs.runCommand "oh-my-posh-nushell-config.nu" { } '' + ${lib.getExe cfg.package} init nu ${configArgument} --print >> "$out" + '' + }'' } ''; }; diff --git a/tests/modules/programs/oh-my-posh/nushell.nix b/tests/modules/programs/oh-my-posh/nushell.nix index c23d8ea7..4f838ac8 100644 --- a/tests/modules/programs/oh-my-posh/nushell.nix +++ b/tests/modules/programs/oh-my-posh/nushell.nix @@ -28,8 +28,18 @@ in '' assertFileExists "${configFile}" - assertFileRegex \ - "${configFile}" \ - 'source /nix/store/[^/]*-oh-my-posh-nushell-config.nu' + ${ + if (lib.versionAtLeast (lib.versions.major config.programs.oh-my-posh.package.version) "26") then + '' + assertFileContains \ + "${configFile}" \ + "/bin/oh-my-posh init nu --config"'' + else + + '' + assertFileRegex \ + "${configFile}" \ + "source /nix/store/[^/]*-oh-my-posh-nushell-config.nu"'' + } ''; }