nushell: support darwin config file locations
Previously the nushell module did not differentiate between Linux and Darwin when deciding where to place config files, whereas nushell does. This commit fixes that.
This commit is contained in:
parent
e7eba9cc46
commit
b44f56dfcd
|
@ -6,6 +6,11 @@ let
|
|||
|
||||
cfg = config.programs.nushell;
|
||||
|
||||
configDir = if pkgs.stdenv.isDarwin then
|
||||
"Library/Application Support/nushell"
|
||||
else
|
||||
"${config.xdg.configHome}/nushell";
|
||||
|
||||
linesOrSource = name:
|
||||
types.submodule ({ config, ... }: {
|
||||
options = {
|
||||
|
@ -110,16 +115,15 @@ in {
|
|||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile = mkMerge [
|
||||
home.file = mkMerge [
|
||||
(mkIf (cfg.configFile != null || cfg.extraConfig != "") {
|
||||
"nushell/config.nu".text = mkMerge [
|
||||
"${configDir}/config.nu".text = mkMerge [
|
||||
(mkIf (cfg.configFile != null) cfg.configFile.text)
|
||||
cfg.extraConfig
|
||||
];
|
||||
})
|
||||
(mkIf (cfg.envFile != null || cfg.extraEnv != "") {
|
||||
"nushell/env.nu".text = mkMerge [
|
||||
"${configDir}/env.nu".text = mkMerge [
|
||||
(mkIf (cfg.envFile != null) cfg.envFile.text)
|
||||
cfg.extraEnv
|
||||
];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ ... }:
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.nushell = {
|
||||
|
@ -19,12 +19,17 @@
|
|||
|
||||
test.stubs.nushell = { };
|
||||
|
||||
nmt.script = ''
|
||||
nmt.script = let
|
||||
configDir = if pkgs.stdenv.isDarwin then
|
||||
"home-files/Library/Application Support/nushell"
|
||||
else
|
||||
"home-files/.config/nushell";
|
||||
in ''
|
||||
assertFileContent \
|
||||
home-files/.config/nushell/config.nu \
|
||||
"${configDir}/config.nu" \
|
||||
${./config-expected.nu}
|
||||
assertFileContent \
|
||||
home-files/.config/nushell/env.nu \
|
||||
"${configDir}/env.nu" \
|
||||
${./env-expected.nu}
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue