New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/home-assistant: allow arbitrary yaml functions #89337
Conversation
# Hack to support secrets, that are encoded as custom yaml objects, | ||
# https://www.home-assistant.io/docs/configuration/secrets/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Hack to support secrets, that are encoded as custom yaml objects, | |
# https://www.home-assistant.io/docs/configuration/secrets/ | |
# Hack to support custom yaml objects, | |
# i.e. secrets: https://www.home-assistant.io/docs/configuration/secrets/ |
@@ -13,7 +13,7 @@ let | |||
${pkgs.remarshal}/bin/json2yaml -i ${configJSON} -o $out | |||
# Hack to support secrets, that are encoded as custom yaml objects, | |||
# https://www.home-assistant.io/docs/configuration/secrets/ | |||
sed -i -e "s/'\!secret \(.*\)'/\!secret \1/" $out | |||
sed -i -e "s/'\!\([^[:space:]]\+\) \(.*\)'/\!\1 \2/" $out |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should allow to escape \!
at the beginning of a string:
sed -i -e "s/'\!\([^[:space:]]\+\) \(.*\)'/\!\1 \2/" $out | |
sed -i -e "s/'\!\(([a-z_]\+\) \(.*\)'/\!\1 \2/;s/^\!\!/\!/;" $out |
untested, but hopefully comprehensible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that as if you want a literal exclamation mark at the beginning of your string use "!!something" => "!something". Is that correct?
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My mistake, probably didn't properly update the nixpkgs checkout when testing.
5a39308
to
1e135e4
Compare
Motivation for this change
I'm trying to load additional themes without specifying them by hand:
Without this patch the resulting config would quote the function call:
This prevents the function calls execution. The same workaround has been in place for the
!secret
function, let's now extend it to arbitrary functions.Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)@Mic92 @dotlambda