From 30f9cdd69d1486a3d5cddaaabef7288d8ed389ee Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Thu, 28 Dec 2023 23:07:47 +0100 Subject: [PATCH] oh-my-posh: fix test under Darwin --- tests/modules/programs/oh-my-posh/nushell.nix | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/tests/modules/programs/oh-my-posh/nushell.nix b/tests/modules/programs/oh-my-posh/nushell.nix index 2dd6a63c..ad77f821 100644 --- a/tests/modules/programs/oh-my-posh/nushell.nix +++ b/tests/modules/programs/oh-my-posh/nushell.nix @@ -1,4 +1,4 @@ -{ ... }: +{ pkgs, ... }: { programs = { @@ -15,15 +15,25 @@ nushell = { }; }; - nmt.script = '' - assertFileExists home-files/.config/nushell/env.nu + nmt.script = let + configFile = if pkgs.stdenv.isDarwin then + "home-files/Library/Application Support/nushell/config.nu" + else + "home-files/.config/nushell/config.nu"; + + envFile = if pkgs.stdenv.isDarwin then + "home-files/Library/Application Support/nushell/env.nu" + else + "home-files/.config/nushell/env.nu"; + in '' + assertFileExists "${envFile}" assertFileRegex \ - home-files/.config/nushell/env.nu \ + "${envFile}" \ '/bin/oh-my-posh init nu --config .*--print \| save --force /.*/home-files/\.cache/oh-my-posh/init\.nu' - assertFileExists home-files/.config/nushell/config.nu + assertFileExists "${configFile}" assertFileRegex \ - home-files/.config/nushell/config.nu \ + "${configFile}" \ 'source /.*/\.cache/oh-my-posh/init\.nu' ''; }