diff --git a/modules/programs/jujutsu.nix b/modules/programs/jujutsu.nix index a21c71087273..b72e66fcc1ce 100644 --- a/modules/programs/jujutsu.nix +++ b/modules/programs/jujutsu.nix @@ -6,6 +6,10 @@ let cfg = config.programs.jujutsu; tomlFormat = pkgs.formats.toml { }; + configDir = if pkgs.stdenv.isDarwin then + "Library/Application Support" + else + config.xdg.configHome; in { meta.maintainers = [ maintainers.shikanime ]; @@ -51,7 +55,7 @@ in { config = mkIf cfg.enable { home.packages = [ cfg.package ]; - xdg.configFile."jj/config.toml" = mkIf (cfg.settings != { }) { + home.file."${configDir}/jj/config.toml" = mkIf (cfg.settings != { }) { source = tomlFormat.generate "jujutsu-config" (cfg.settings // optionalAttrs (cfg.ediff) (let emacsDiffScript = pkgs.writeShellScriptBin "emacs-ediff" '' diff --git a/tests/modules/programs/jujutsu/empty-config.nix b/tests/modules/programs/jujutsu/empty-config.nix index 10dd12589d30..16aa93d3330b 100644 --- a/tests/modules/programs/jujutsu/empty-config.nix +++ b/tests/modules/programs/jujutsu/empty-config.nix @@ -7,5 +7,6 @@ nmt.script = '' assertPathNotExists home-files/.config/jj/config.toml + assertPathNotExists "home-files/Library/Application Support/jj/config.toml" ''; } diff --git a/tests/modules/programs/jujutsu/example-config.nix b/tests/modules/programs/jujutsu/example-config.nix index d83b552b22a0..807942e2f7e7 100644 --- a/tests/modules/programs/jujutsu/example-config.nix +++ b/tests/modules/programs/jujutsu/example-config.nix @@ -1,6 +1,12 @@ -{ config, ... }: +{ config, pkgs, ... }: -{ +let + configFile = if pkgs.stdenv.isDarwin then + "home-files/Library/Application Support/jj/config.toml" + else + "home-files/.config/jj/config.toml"; + +in { programs.jujutsu = { enable = true; package = config.lib.test.mkStubPackage { }; @@ -13,9 +19,9 @@ }; nmt.script = '' - assertFileExists home-files/.config/jj/config.toml + assertFileExists "${configFile}" assertFileContent \ - home-files/.config/jj/config.toml \ + "${configFile}" \ ${ builtins.toFile "expected.toml" '' [user]