diff --git a/hosts/HL-1-MRZ-HOST-01/guests.nix b/hosts/HL-1-MRZ-HOST-01/guests.nix index 4286013..995c98e 100755 --- a/hosts/HL-1-MRZ-HOST-01/guests.nix +++ b/hosts/HL-1-MRZ-HOST-01/guests.nix @@ -100,6 +100,7 @@ // mkMicrovm "ibkr-flex" "HL-3-RZ-IBKR-01" "enp4s0" "02:01:27:ff:ed:77" "vlan40" { } // mkMicrovm "power-meter" "HL-3-RZ-POWER-01" "enp4s0" "02:01:27:f1:ed:77" "vlan40" { + enableStorageDataset = true; } ); }; diff --git a/hosts/HL-1-MRZ-HOST-01/guests/power-meter.nix b/hosts/HL-1-MRZ-HOST-01/guests/power-meter.nix index 62c0ccc..0c6214d 100755 --- a/hosts/HL-1-MRZ-HOST-01/guests/power-meter.nix +++ b/hosts/HL-1-MRZ-HOST-01/guests/power-meter.nix @@ -1,37 +1,14 @@ { inputs, - config, pkgs, - secretsPath, hostName, ... -}: let - # |----------------------------------------------------------------------| # - query = "639991"; - slug = "https://health.czichy.com/ping/"; - download-ibkr-flex = - pkgs.writeShellScriptBin "ibkr-flex-download" - '' - #!/usr/bin/env bash - set -euo pipefail - - echo "Downloading Flex Report" - token="$(cat ${config.age.secrets.ibkrFlexToken.path})"; - /run/current-system/sw/bin/ibkr-rust-flex -q ${query} -t "$token" --dump-path /TWS_Flex_Reports - - for file in /TWS_Flex_Reports/*.xml ; do - fileDate=$(${pkgs.gawk}/bin/awk -F[_.] '{print $3 }' <<<"$(basename "$file")"); - destination="$(${pkgs.gawk}/bin/awk -F[-] '{print $1 }' <<<"$fileDate")/$(${pkgs.gawk}/bin/awk -F[-] '{print $1"-"$2 }' <<<"$fileDate")/" - echo "$destination" - mkdir -p "/TWS_Flex_Reports/$destination"; - mv "$file" "/TWS_Flex_Reports/$destination"; - done - pingKey="$(cat ${config.age.secrets.ibkr-flex-hc-ping.path})"; - ${pkgs.curl}/bin/curl -m 10 --retry 5 --retry-connrefused "${slug}$pingKey/ibkr-flex-download" - - ''; - # |----------------------------------------------------------------------| # -in { +}: +# let +# |----------------------------------------------------------------------| # +# |----------------------------------------------------------------------| # +# in +{ microvm.mem = 512; microvm.vcpu = 1; microvm.shares = [ @@ -49,52 +26,50 @@ in { # |----------------------------------------------------------------------| # users = { - users.ibkr = { + users.power = { isSystemUser = true; - group = "ibkr"; + group = "power"; }; - groups.ibkr = {}; + groups.power = {}; }; # |----------------------------------------------------------------------| # - age.secrets = { - ibkrFlexToken = { - symlink = true; - file = secretsPath + "/hosts/HL-1-MRZ-HOST-01/guests/ibkr-flex/token.age"; - mode = "0600"; - owner = "root"; - }; - }; - age.secrets.ibkr-flex-hc-ping = { - file = secretsPath + "/hosts/HL-4-PAZ-PROXY-01/healthchecks-ping.age"; - mode = "440"; - owner = "root"; - }; + # age.secrets = { + # ibkrFlexToken = { + # symlink = true; + # file = secretsPath + "/hosts/HL-1-MRZ-HOST-01/guests/ibkr-flex/token.age"; + # mode = "0600"; + # owner = "root"; + # }; + # }; + # age.secrets.ibkr-flex-hc-ping = { + # file = secretsPath + "/hosts/HL-4-PAZ-PROXY-01/healthchecks-ping.age"; + # mode = "440"; + # owner = "root"; + # }; # ------------------------------ # | SYSTEM PACKAGES | # ------------------------------ environment.systemPackages = with pkgs; [ - gawk pkg-config - openssh - inputs.ibkr-rust.packages.${pkgs.system}.flex + inputs.power-meter.packages.${pkgs.system}.power-meter ]; # |----------------------------------------------------------------------| # - systemd.timers."ibkr-flex-download" = { - wantedBy = ["timers.target"]; - timerConfig = { - Perisistent = true; - OnCalendar = "Mon..Fri 23:30"; - Unit = "ibkr-flex-download.service"; - }; - }; + # systemd.timers."ibkr-flex-download" = { + # wantedBy = ["timers.target"]; + # timerConfig = { + # Perisistent = true; + # OnCalendar = "Mon..Fri 23:30"; + # Unit = "ibkr-flex-download.service"; + # }; + # }; - systemd.services."ibkr-flex-download" = { - serviceConfig = { - Type = "simple"; - User = "root"; - ExecStart = "${download-ibkr-flex}/bin/ibkr-flex-download"; - }; - }; + # systemd.services."ibkr-flex-download" = { + # serviceConfig = { + # Type = "simple"; + # User = "root"; + # ExecStart = "${download-ibkr-flex}/bin/ibkr-flex-download"; + # }; + # }; # |----------------------------------------------------------------------| # environment.persistence."/persist".files = [