jujutsu: support darwin guidelines for config placement
Follow up to #5207, fixing jujutsu module on darwin targets.
This commit is contained in:
parent
9fdadb1cb6
commit
ea72cf548f
|
@ -7,6 +7,11 @@ let
|
||||||
cfg = config.programs.jujutsu;
|
cfg = config.programs.jujutsu;
|
||||||
tomlFormat = pkgs.formats.toml { };
|
tomlFormat = pkgs.formats.toml { };
|
||||||
|
|
||||||
|
configDir = if pkgs.stdenv.isDarwin then
|
||||||
|
"Library/Application Support"
|
||||||
|
else
|
||||||
|
config.xdg.configHome;
|
||||||
|
|
||||||
in {
|
in {
|
||||||
meta.maintainers = [ maintainers.shikanime ];
|
meta.maintainers = [ maintainers.shikanime ];
|
||||||
|
|
||||||
|
@ -51,7 +56,7 @@ in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
home.packages = [ cfg.package ];
|
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
|
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" ''
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
{ ... }:
|
{ pkgs, ... }:
|
||||||
|
|
||||||
{
|
let
|
||||||
|
configDir =
|
||||||
|
if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config";
|
||||||
|
in {
|
||||||
programs.jujutsu.enable = true;
|
programs.jujutsu.enable = true;
|
||||||
|
|
||||||
test.stubs.jujutsu = { };
|
test.stubs.jujutsu = { };
|
||||||
|
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
assertPathNotExists home-files/.config/jj/config.toml
|
assertPathNotExists 'home-files/${configDir}/jj/config.toml'
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
{ config, ... }:
|
{ pkgs, config, ... }:
|
||||||
|
|
||||||
{
|
let
|
||||||
|
configDir =
|
||||||
|
if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config";
|
||||||
|
in {
|
||||||
programs.jujutsu = {
|
programs.jujutsu = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = config.lib.test.mkStubPackage { };
|
package = config.lib.test.mkStubPackage { };
|
||||||
|
@ -13,9 +16,8 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
assertFileExists home-files/.config/jj/config.toml
|
assertFileExists 'home-files/${configDir}/jj/config.toml'
|
||||||
assertFileContent \
|
assertFileContent 'home-files/${configDir}/jj/config.toml' \
|
||||||
home-files/.config/jj/config.toml \
|
|
||||||
${
|
${
|
||||||
builtins.toFile "expected.toml" ''
|
builtins.toFile "expected.toml" ''
|
||||||
[user]
|
[user]
|
||||||
|
|
Loading…
Reference in a new issue