From d7682620185f213df384c363288093b486b2883f Mon Sep 17 00:00:00 2001 From: Milo Moisson Date: Sun, 31 Mar 2024 19:57:00 +0200 Subject: [PATCH] jujutsu: switch to XDG config home --- modules/programs/jujutsu.nix | 18 ++++++++---------- .../modules/programs/jujutsu/empty-config.nix | 2 +- .../programs/jujutsu/example-config.nix | 4 ++-- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/modules/programs/jujutsu.nix b/modules/programs/jujutsu.nix index b1fcc7038..a21c71087 100644 --- a/modules/programs/jujutsu.nix +++ b/modules/programs/jujutsu.nix @@ -34,16 +34,14 @@ in { settings = mkOption { type = tomlFormat.type; default = { }; - example = literalExpression '' - { - user = { - name = "John Doe"; - email = "jdoe@example.org"; - }; - } - ''; + example = { + user = { + name = "John Doe"; + email = "jdoe@example.org"; + }; + }; description = '' - Options to add to the {file}`.jjconfig.toml` file. See + Options to add to the {file}`config.toml` file. See for options. ''; @@ -53,7 +51,7 @@ in { config = mkIf cfg.enable { home.packages = [ cfg.package ]; - home.file.".jjconfig.toml" = mkIf (cfg.settings != { }) { + xdg.configFile."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 12c4a2f54..10dd12589 100644 --- a/tests/modules/programs/jujutsu/empty-config.nix +++ b/tests/modules/programs/jujutsu/empty-config.nix @@ -6,6 +6,6 @@ test.stubs.jujutsu = { }; nmt.script = '' - assertPathNotExists home-files/.jjconfig.toml + assertPathNotExists home-files/.config/jj/config.toml ''; } diff --git a/tests/modules/programs/jujutsu/example-config.nix b/tests/modules/programs/jujutsu/example-config.nix index 06b68f18c..d83b552b2 100644 --- a/tests/modules/programs/jujutsu/example-config.nix +++ b/tests/modules/programs/jujutsu/example-config.nix @@ -13,9 +13,9 @@ }; nmt.script = '' - assertFileExists home-files/.jjconfig.toml + assertFileExists home-files/.config/jj/config.toml assertFileContent \ - home-files/.jjconfig.toml \ + home-files/.config/jj/config.toml \ ${ builtins.toFile "expected.toml" '' [user]