From 630a0992b3627c64e34f179fab68e3d48c6991c0 Mon Sep 17 00:00:00 2001
From: Philipp Mildenberger <philipp@mildenberger.me>
Date: Sun, 14 Apr 2024 08:58:16 +0200
Subject: [PATCH] nushell: fix nushell config path on darwin

---
 modules/programs/nushell.nix                                | 2 +-
 tests/modules/programs/carapace/nushell.nix                 | 4 ++--
 tests/modules/programs/direnv/nushell.nix                   | 4 ++--
 tests/modules/programs/nushell/example-settings.nix         | 4 ++--
 tests/modules/programs/oh-my-posh/nushell.nix               | 6 +++---
 tests/modules/programs/yazi/nushell-integration-enabled.nix | 4 ++--
 6 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/modules/programs/nushell.nix b/modules/programs/nushell.nix
index 51419971..2ebd9554 100644
--- a/modules/programs/nushell.nix
+++ b/modules/programs/nushell.nix
@@ -6,7 +6,7 @@ let
 
   cfg = config.programs.nushell;
 
-  configDir = if pkgs.stdenv.isDarwin then
+  configDir = if pkgs.stdenv.isDarwin && !config.xdg.enable then
     "Library/Application Support/nushell"
   else
     "${config.xdg.configHome}/nushell";
diff --git a/tests/modules/programs/carapace/nushell.nix b/tests/modules/programs/carapace/nushell.nix
index a025da18..d97fa898 100644
--- a/tests/modules/programs/carapace/nushell.nix
+++ b/tests/modules/programs/carapace/nushell.nix
@@ -1,4 +1,4 @@
-{ pkgs, ... }:
+{ pkgs, config, ... }:
 
 {
   programs = {
@@ -7,7 +7,7 @@
   };
 
   nmt.script = let
-    configDir = if pkgs.stdenv.isDarwin then
+    configDir = if pkgs.stdenv.isDarwin && !config.xdg.enable then
       "home-files/Library/Application Support/nushell"
     else
       "home-files/.config/nushell";
diff --git a/tests/modules/programs/direnv/nushell.nix b/tests/modules/programs/direnv/nushell.nix
index 46f34ebd..6655f01a 100644
--- a/tests/modules/programs/direnv/nushell.nix
+++ b/tests/modules/programs/direnv/nushell.nix
@@ -1,4 +1,4 @@
-{ pkgs, ... }:
+{ pkgs, config, ... }:
 
 {
   programs.nushell.enable = true;
@@ -7,7 +7,7 @@
   test.stubs.nushell = { };
 
   nmt.script = let
-    configFile = if pkgs.stdenv.isDarwin then
+    configFile = if pkgs.stdenv.isDarwin && !config.xdg.enable then
       "home-files/Library/Application Support/nushell/config.nu"
     else
       "home-files/.config/nushell/config.nu";
diff --git a/tests/modules/programs/nushell/example-settings.nix b/tests/modules/programs/nushell/example-settings.nix
index 73038584..d870eb9d 100644
--- a/tests/modules/programs/nushell/example-settings.nix
+++ b/tests/modules/programs/nushell/example-settings.nix
@@ -1,4 +1,4 @@
-{ pkgs, ... }:
+{ pkgs, config, ... }:
 
 {
   programs.nushell = {
@@ -34,7 +34,7 @@
   test.stubs.nushell = { };
 
   nmt.script = let
-    configDir = if pkgs.stdenv.isDarwin then
+    configDir = if pkgs.stdenv.isDarwin && !config.xdg.enable then
       "home-files/Library/Application Support/nushell"
     else
       "home-files/.config/nushell";
diff --git a/tests/modules/programs/oh-my-posh/nushell.nix b/tests/modules/programs/oh-my-posh/nushell.nix
index ad77f821..da4ffafd 100644
--- a/tests/modules/programs/oh-my-posh/nushell.nix
+++ b/tests/modules/programs/oh-my-posh/nushell.nix
@@ -1,4 +1,4 @@
-{ pkgs, ... }:
+{ pkgs, config, ... }:
 
 {
   programs = {
@@ -16,12 +16,12 @@
   };
 
   nmt.script = let
-    configFile = if pkgs.stdenv.isDarwin then
+    configFile = if pkgs.stdenv.isDarwin && !config.xdg.enable then
       "home-files/Library/Application Support/nushell/config.nu"
     else
       "home-files/.config/nushell/config.nu";
 
-    envFile = if pkgs.stdenv.isDarwin then
+    envFile = if pkgs.stdenv.isDarwin && !config.xdg.enable then
       "home-files/Library/Application Support/nushell/env.nu"
     else
       "home-files/.config/nushell/env.nu";
diff --git a/tests/modules/programs/yazi/nushell-integration-enabled.nix b/tests/modules/programs/yazi/nushell-integration-enabled.nix
index ddd041dc..9adbaa98 100644
--- a/tests/modules/programs/yazi/nushell-integration-enabled.nix
+++ b/tests/modules/programs/yazi/nushell-integration-enabled.nix
@@ -1,4 +1,4 @@
-{ pkgs, ... }:
+{ pkgs, config, ... }:
 
 let
   shellIntegration = ''
@@ -23,7 +23,7 @@ in {
   test.stubs.yazi = { };
 
   nmt.script = let
-    configPath = if pkgs.stdenv.isDarwin then
+    configPath = if pkgs.stdenv.isDarwin && !config.xdg.enable then
       "home-files/Library/Application Support/nushell/config.nu"
     else
       "home-files/.config/nushell/config.nu";