jujutsu: switch to XDG config home

This commit is contained in:
Milo Moisson 2024-03-31 19:57:00 +02:00 committed by Robert Helgesson
parent d939ce585c
commit d768262018
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED
3 changed files with 11 additions and 13 deletions

View file

@ -34,16 +34,14 @@ in {
settings = mkOption { settings = mkOption {
type = tomlFormat.type; type = tomlFormat.type;
default = { }; default = { };
example = literalExpression '' example = {
{ user = {
user = { name = "John Doe";
name = "John Doe"; email = "jdoe@example.org";
email = "jdoe@example.org"; };
}; };
}
'';
description = '' description = ''
Options to add to the {file}`.jjconfig.toml` file. See Options to add to the {file}`config.toml` file. See
<https://github.com/martinvonz/jj/blob/main/docs/config.md> <https://github.com/martinvonz/jj/blob/main/docs/config.md>
for options. for options.
''; '';
@ -53,7 +51,7 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ cfg.package ]; 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 source = tomlFormat.generate "jujutsu-config" (cfg.settings
// optionalAttrs (cfg.ediff) (let // optionalAttrs (cfg.ediff) (let
emacsDiffScript = pkgs.writeShellScriptBin "emacs-ediff" '' emacsDiffScript = pkgs.writeShellScriptBin "emacs-ediff" ''

View file

@ -6,6 +6,6 @@
test.stubs.jujutsu = { }; test.stubs.jujutsu = { };
nmt.script = '' nmt.script = ''
assertPathNotExists home-files/.jjconfig.toml assertPathNotExists home-files/.config/jj/config.toml
''; '';
} }

View file

@ -13,9 +13,9 @@
}; };
nmt.script = '' nmt.script = ''
assertFileExists home-files/.jjconfig.toml assertFileExists home-files/.config/jj/config.toml
assertFileContent \ assertFileContent \
home-files/.jjconfig.toml \ home-files/.config/jj/config.toml \
${ ${
builtins.toFile "expected.toml" '' builtins.toFile "expected.toml" ''
[user] [user]