feat: add yaml2nix script
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
defc94db8a
commit
e9d02bdf36
1 changed files with 20 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
{...}: {
|
||||
{pkgs, ...}: {
|
||||
imports = [
|
||||
./assist.nix
|
||||
./bluetooth.nix
|
||||
|
@ -6,6 +6,25 @@
|
|||
./frontend.nix
|
||||
];
|
||||
|
||||
environment.systemPackages = [
|
||||
(pkgs.writeShellApplication {
|
||||
name = "yaml2nix";
|
||||
runtimeInputs = with pkgs; [yj];
|
||||
text = ''
|
||||
input="$(yj < "$1")"
|
||||
output="''${2:-""}"
|
||||
|
||||
nixCode="$(nix eval --expr "builtins.fromJSON '''$input'''" --impure | alejandra -q | sed 's/ = null;/ = {};/g')"
|
||||
|
||||
if [[ "$output" != "" ]]; then
|
||||
echo "$nixCode" > "$output"
|
||||
else
|
||||
echo "$nixCode"
|
||||
fi
|
||||
'';
|
||||
})
|
||||
];
|
||||
|
||||
# TODO: some components / integrations / addons require manual interaction in the GUI, find way to make it all declarative
|
||||
services.home-assistant = {
|
||||
enable = true;
|
||||
|
|
Loading…
Reference in a new issue