lib: add trimNewlines

Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
Christoph Heiss 2024-08-25 23:05:35 +02:00
parent 5280397071
commit 850c8a0cc1
Signed by: c8h4
GPG key ID: 6817E9C75C0785D7
3 changed files with 5 additions and 4 deletions

View file

@ -1,3 +1,5 @@
_: _: _: _:
{ } {
trimNewlines = builtins.replaceStrings [ "\n" ] [ "" ];
}

Binary file not shown.

View file

@ -1,7 +1,6 @@
{ config, my, pkgs, secrets, ... }: { config, lib, my, pkgs, secrets, ... }:
let let
trimNewlines = builtins.replaceStrings [ "\n" ] [ "" ];
hassCfg = config.services.home-assistant.config; hassCfg = config.services.home-assistant.config;
mosquittoSecret = { mosquittoSecret = {
sopsFile = ../secrets/sops/home-assistant.yaml; sopsFile = ../secrets/sops/home-assistant.yaml;
@ -55,7 +54,7 @@ in {
recorder.db_url = "postgresql://@/hass"; recorder.db_url = "postgresql://@/hass";
scene = { }; scene = { };
schedule = { }; schedule = { };
shell_command.poweroff_zero = trimNewlines '' shell_command.poweroff_zero = lib.trimNewlines ''
${pkgs.openssh}/bin/ssh ${pkgs.openssh}/bin/ssh
-i ${secrets."home-assistant/automation-sshkey".path} -i ${secrets."home-assistant/automation-sshkey".path}
-o BatchMode=yes -o BatchMode=yes