Skip to content

Commit

Permalink
nushell: fix nushell config path on darwin
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp-M authored Apr 14, 2024
1 parent 4cc3c91 commit 630a099
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion modules/programs/nushell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 2 additions & 2 deletions tests/modules/programs/carapace/nushell.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs, ... }:
{ pkgs, config, ... }:

{
programs = {
Expand All @@ -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";
Expand Down
4 changes: 2 additions & 2 deletions tests/modules/programs/direnv/nushell.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs, ... }:
{ pkgs, config, ... }:

{
programs.nushell.enable = true;
Expand All @@ -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";
Expand Down
4 changes: 2 additions & 2 deletions tests/modules/programs/nushell/example-settings.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs, ... }:
{ pkgs, config, ... }:

{
programs.nushell = {
Expand Down Expand Up @@ -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";
Expand Down
6 changes: 3 additions & 3 deletions tests/modules/programs/oh-my-posh/nushell.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs, ... }:
{ pkgs, config, ... }:

{
programs = {
Expand All @@ -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";
Expand Down
4 changes: 2 additions & 2 deletions tests/modules/programs/yazi/nushell-integration-enabled.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs, ... }:
{ pkgs, config, ... }:

let
shellIntegration = ''
Expand All @@ -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";
Expand Down

3 comments on commit 630a099

@evelant
Copy link

@evelant evelant commented on 630a099 Aug 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Philipp-M This appears to break nushell completely on my system (nix-darwin aarch64). AFAICT there is no longer any configuration written. It also mangled the existing config when I updated my flake. It removed all the quotes from environmentVariables so $env.nu crashed on load.

@evelant
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm nevermind, I rolled home-manager back to an earlier commit and it's still broken. Something else changed that's breaking nushell config.

@Philipp-M
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure about that, no config is written, as this is the only effective change of that PR:

configDir = if pkgs.stdenv.isDarwin && !config.xdg.enable then
    "Library/Application Support/nushell"
  else
    "${config.xdg.configHome}/nushell";

So depending on whether you have config.xdg.enable set it should write in one of these directories.

It also mangled the existing config when I updated my flake. It removed all the quotes from environmentVariables so $env.nu crashed on load.

I'm not sure I understand this, it doesn't really make sense to me, as the content of these files is just types.lines (so basically a raw string). It could be that another module extends this (by appending), and breaks it.

I'm pretty sure this change is unrelated to that though, you should probably open an issue with a short repro if possible.

Please sign in to comment.