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 = [
|
imports = [
|
||||||
./assist.nix
|
./assist.nix
|
||||||
./bluetooth.nix
|
./bluetooth.nix
|
||||||
|
@ -6,6 +6,25 @@
|
||||||
./frontend.nix
|
./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
|
# TODO: some components / integrations / addons require manual interaction in the GUI, find way to make it all declarative
|
||||||
services.home-assistant = {
|
services.home-assistant = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
Loading…
Reference in a new issue