alacritty.yaml should now work

yaml
pegasust 2022-12-06 04:29:26 +00:00
parent a67f121381
commit d4834a446c
1 changed files with 8 additions and 8 deletions

View File

@ -31,16 +31,16 @@ let
# TODO: put this in a seperate library # TODO: put this in a seperate library
# callPackage supports both PATH and function as first param! # callPackage supports both PATH and function as first param!
# TODO: support yaml string with writeTextFile (provided by callPackge) # TODO: support yaml string with writeTextFile (provided by callPackge)
yamlToJsonDrv = yamlPath: outputPath: yamlToJsonDrv = yamlContent: outputPath: pkgs.callPackage ({ runCommand }:
pkgs.callPackage ({ runCommand }:
# runCommand source: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/trivial-builders.nix#L33 # runCommand source: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/trivial-builders.nix#L33
runCommand runCommand outputPath { inherit yamlContent; nativeBuildInputs = [ pkgs.yq ]; }
outputPath
{ nativeBuildInputs = [ pkgs.yq ]; }
# run yq which outputs '.' (no filter) on file at yamlPath # run yq which outputs '.' (no filter) on file at yamlPath
# note that $out is passed onto the bash/sh script for execution # note that $out is passed onto the bash/sh script for execution
''cat \"${yamlPath}\" | yq >\"$out\"'') { }; ''
fromYaml = yamlPath: builtins.fromJSON (builtins.readFile (yamlToJsonDrv yamlPath "any-output.json")); echo "$yamlContent" | yq >$out
'') { };
# fromYamlPath = yamlPath: builtins.fromJSON (builtins.readFile (yamlToJsonDrv yamlPath "any-output.json"));
fromYaml = yamlContent: builtins.fromJSON (builtins.readFile (yamlToJsonDrv yamlContent "any_output.json"));
in in
{ {
home = { home = {
@ -86,7 +86,7 @@ in
programs.alacritty = myHome.programs.alacritty or { programs.alacritty = myHome.programs.alacritty or {
enable = true; enable = true;
# settings = myLib.fromYaml (builtins.readFile "${proj_root}/alacritty/alacritty.yml"); # settings = myLib.fromYaml (builtins.readFile "${proj_root}/alacritty/alacritty.yml");
settings = fromYaml "${proj_root}//alacritty/alacritty.yml"; settings = fromYaml (builtins.readFile "${proj_root}//alacritty/alacritty.yml");
}; };
# nix: Propagates the environment with packages and vars when enter (children of) # nix: Propagates the environment with packages and vars when enter (children of)
# a directory with shell.nix-compatible and .envrc # a directory with shell.nix-compatible and .envrc