diff --git a/hosts/fw/configuration.nix b/hosts/fw/configuration.nix index f1fa1f7..193a412 100644 --- a/hosts/fw/configuration.nix +++ b/hosts/fw/configuration.nix @@ -24,6 +24,7 @@ ./modules/podman.nix ./modules/omada.nix ./modules/ddclient.nix + ./modules/cloonar-assistant-config-server.nix # ./modules/wol.nix diff --git a/hosts/fw/modules/cloonar-assistant-config-server.nix b/hosts/fw/modules/cloonar-assistant-config-server.nix new file mode 100644 index 0000000..99745ea --- /dev/null +++ b/hosts/fw/modules/cloonar-assistant-config-server.nix @@ -0,0 +1,54 @@ +{ + lib, + pkgs, + ... +}: let + users = [ + { + username = "ca-test"; + key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDglSLU9AUtbU0fCN0eByi/EHyo1QiPPLiscN5RAR+wq"; + } + ]; + + userList = lib.concatStringsSep "," (map (u: u.username) users); +in { + environment.etc = { + # our single user+key file + "cloonar_assistant_ssh/sftp_users_keys" = { + text = lib.concatStringsSep "\n" + (map (u: "${u.username} ${u.key}") users); + mode = "0600"; + user = "root"; + group = "root"; + }; + + # the little awk script to extract the key for $1 + "ssh/sftp-fetch-key.sh" = { + text = '' + #!/usr/bin/env bash + awk -v u="$1" '$1==u { $1=""; sub(/^ +/, ""); print }' /etc/cloonar_assistant_ssh/sftp_users_keys + ''; + mode = "0700"; + user = "root"; + group = "root"; + }; + }; + + systemd.tmpfiles.rules = map (u: + # Type 'd' = create directory if missing + # Mode 0755, owner root:root + "d /home/cloonar-assistant-configs/${u.username} 0755 root root -" + ) users; + + services.openssh.extraConfig = '' + Match User ${userList} + X11Forwarding no + AllowTcpForwarding no + ChrootDirectory /home/cloonar-assistant-configs/%u + ForceCommand internal-sftp + + # ← only for those matched users: + AuthorizedKeysCommand /etc/cloonar_assistant_ssh/sftp-fetch-key.sh %u + AuthorizedKeysCommandUser root + ''; +} diff --git a/hosts/fw/modules/home-assistant/electricity.nix b/hosts/fw/modules/home-assistant/electricity.nix index 482de06..3698843 100644 --- a/hosts/fw/modules/home-assistant/electricity.nix +++ b/hosts/fw/modules/home-assistant/electricity.nix @@ -18,8 +18,12 @@ in { friendly_name = "Current Price of electricity"; unit_of_measurement = "EUR/kWh"; value_template = '' - {{ (((states('sensor.epex_spot_data_price') | int ) / 1000) + (0.0149 + 0.053 + 0.00866)) | float }} + {{ ((states('sensor.epex_spot_data_price') | float ) + (0.0149 + 0.074 + 0.007 + 0.0074 + 0.0006)) | float }} ''; + entity_id = [ + "sensor.epex_spot_data_price" + "sensor.time" + ]; }; }; } diff --git a/hosts/fw/modules/home-assistant/multimedia.nix b/hosts/fw/modules/home-assistant/multimedia.nix index d864b83..5bac9b6 100644 --- a/hosts/fw/modules/home-assistant/multimedia.nix +++ b/hosts/fw/modules/home-assistant/multimedia.nix @@ -246,6 +246,7 @@ platform = "state"; entity_id = "binary_sensor.multimedia_device_on"; to = "off"; + for = "00:00:30"; }; action = [ { @@ -290,7 +291,7 @@ }; } { - delay = 20; + delay = 30; } # turn off tv switch { diff --git a/hosts/nb/users/configs/project_history b/hosts/nb/users/configs/project_history index baf8d52..d2fbdd8 100644 --- a/hosts/nb/users/configs/project_history +++ b/hosts/nb/users/configs/project_history @@ -6,6 +6,7 @@ /home/dominik/projects/cloonar/phishguard-frontend /home/dominik/projects/cloonar/gitapi /home/dominik/projects/cloonar/cloonar-assistant +/home/dominik/projects/cloonar/cloonar-assistant-customers /home/dominik/projects/cloonar/updns /home/dominik/projects/cloonar/flow/flow-docs diff --git a/hosts/nb/users/dominik.nix b/hosts/nb/users/dominik.nix index ad4c827..83f2275 100644 --- a/hosts/nb/users/dominik.nix +++ b/hosts/nb/users/dominik.nix @@ -186,11 +186,10 @@ in url = "https://update.code.visualstudio.com/1.99.0-insider/linux-x64/insider"; sha256 = "0z3x9m9pndzka9gzm2phnks453d2mwbdid9yd7qw3bvv965h71j5"; }; - version = "1.99.0"; + version = "1.99.3"; }); }; - /* Here goes the rest of your home-manager config, e.g. home.packages = [ pkgs.foo ]; */ # home.persistence."/nix/persist/user/dominik" = { # allowOther = true; @@ -609,6 +608,7 @@ in git clone gitea@git.cloonar.com:Cloonar/gitapi.git ${persistHome}/projects/cloonar/gitapi 2>/dev/null git clone gitea@git.cloonar.com:Cloonar/ai.nvim.git ${persistHome}/cloonar/ai.nvim 2>/dev/null git clone gitea@git.cloonar.com:Cloonar/cloonar-assistant.git ${persistHome}/projects/cloonar/cloonar-assistant 2>/dev/null + git clone gitea@git.cloonar.com:Cloonar/cloonar-assistant-customers.git ${persistHome}/projects/cloonar/cloonar-assistant-customers 2>/dev/null git clone gitea@git.cloonar.com:Cloonar/updns.git ${persistHome}/projects/cloonar/updns 2>/dev/null git clone gitea@git.cloonar.com:Cloonar/flow-docs.git ${persistHome}/projects/cloonar/flow/flow-docs 2>/dev/null