1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-03-31 04:04:32 +00:00

broot: avoid IFD

This commit is contained in:
Robin Stumm 2025-03-28 12:33:17 +01:00
parent b14a70c40f
commit 13fbbe382f
No known key found for this signature in database
GPG key ID: 3DA3D7B8285FBE55
2 changed files with 9 additions and 16 deletions

View file

@ -6,10 +6,10 @@ let
cfg = config.programs.broot;
tomlFormat = pkgs.formats.toml { };
jsonFormat = pkgs.formats.json { };
settingsModule = {
freeformType = tomlFormat.type;
freeformType = jsonFormat.type;
options = {
modal = mkEnableOption "modal (vim) mode";
@ -194,24 +194,17 @@ in {
# Dummy file to prevent broot from trying to reinstall itself
(pkgs.writeTextDir "launcher/installed-v1" "")
];
postBuild = ''
ln -s ${
tomlFormat.generate "broot-config" cfg.settings
} $out/conf.toml
# Remove conf.hjson, whose content has been merged into programs.broot.settings
rm $out/conf.hjson
${lib.getExe pkgs.jq} --slurp add > $out/conf.hjson \
<(${
lib.getExe pkgs.hjson-go
} -c ${cfg.package.src}/resources/default-conf/conf.hjson) \
${jsonFormat.generate "broot-config.json" cfg.settings}
'';
};
};
programs.broot.settings = builtins.fromJSON (builtins.readFile
(pkgs.runCommand "default-conf.json" {
nativeBuildInputs = [ pkgs.hjson-go ];
}
"hjson-cli -c ${cfg.package.src}/resources/default-conf/conf.hjson > $out"));
programs.bash.initExtra = mkIf cfg.enableBashIntegration (shellInit "bash");
programs.zsh.initContent = mkIf cfg.enableZshIntegration (shellInit "zsh");

View file

@ -9,7 +9,7 @@
nixpkgs.overlays = [ (self: super: { inherit (realPkgs) broot hjson-go; }) ];
nmt.script = ''
assertFileExists home-files/.config/broot/conf.toml
assertFileContains home-files/.config/broot/conf.toml 'modal = true'
assertFileExists home-files/.config/broot/conf.hjson
assertFileContains home-files/.config/broot/conf.hjson '"modal": true'
'';
}