Skip to content

Commit

Permalink
refactor(nix): changes exposed config.yaml to be validated version
Browse files Browse the repository at this point in the history
  • Loading branch information
higherorderfunctor committed Jul 1, 2024
1 parent a3655ec commit f10d48f
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions nix/home-manager.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,26 @@ in {
};

config = let
configYaml = lib.generators.toYAML {} cfg.settings;
configYaml =
pkgs.runCommandNoCC "config.yaml" {
nativeBuildInputs = cfg.package.propagatedBuildInputs;
} ''
echo '# yaml-language-server: $schema=config.schema.yaml' > $out
echo '${lib.generators.toYAML {} cfg.settings}' >> $out
# check-jsonschema -v \
# --schemafile "${cfg.package}/share/tmux-plugins/tmux-which-key/config.schema.yaml" \
# $out
'';
configTmux =
pkgs.runCommandNoCC "init.tmux" {
nativeBuildInputs = cfg.package.propagatedBuildInputs;
} ''
echo '# yaml-language-server: $schema=config.schema.yaml' > config.yaml
echo '${configYaml}' >> config.yaml
check-jsonschema -v --schemafile "${cfg.package}/share/tmux-plugins/tmux-which-key/config.schema.yaml" config.yaml
python3 "${cfg.package}/share/tmux-plugins/tmux-which-key/plugin/build.py" \
config.yaml $out
rm config.yaml
python3 "${cfg.package}/share/tmux-plugins/tmux-which-key/plugin/build.py" ${configYaml} $out
'';
in
lib.mkIf cfg.enable {
xdg = {
configFile."${pluginPath}/config.yaml".text = configYaml;
configFile."${pluginPath}/config.yaml".source = configYaml;
dataFile."${pluginPath}/init.tmux".source = configTmux;
};
programs.tmux.plugins = [
Expand Down

0 comments on commit f10d48f

Please sign in to comment.