From e06732d72d32e8893824adc06683b5f2e8ab9fb1 Mon Sep 17 00:00:00 2001 From: czichy Date: Thu, 5 Dec 2024 17:56:13 +0100 Subject: [PATCH] power-meter --- globals.nix | 2 +- hosts/HL-1-MRZ-HOST-01/guests.nix | 6 +- hosts/HL-1-MRZ-HOST-03/guests.nix | 3 + hosts/HL-1-MRZ-HOST-03/guests/powermeter.nix | 82 ++++++++++++++++++++ 4 files changed, 89 insertions(+), 4 deletions(-) create mode 100755 hosts/HL-1-MRZ-HOST-03/guests/powermeter.nix diff --git a/globals.nix b/globals.nix index f7916db..372628f 100755 --- a/globals.nix +++ b/globals.nix @@ -61,7 +61,7 @@ in { # IBKR Flex Downloader hosts.HL-3-RZ-IBKR-01.id = 15; # Power Meter - hosts.HL-3-RZ-POWER-01.id = 19; + hosts.HL-3-RZ-POWER-01.id = 32; # |------------------------------------| # hosts.HL-1-MRZ-HOST-02.id = 20; # AdguardHome diff --git a/hosts/HL-1-MRZ-HOST-01/guests.nix b/hosts/HL-1-MRZ-HOST-01/guests.nix index 9dc9785..2d62999 100755 --- a/hosts/HL-1-MRZ-HOST-01/guests.nix +++ b/hosts/HL-1-MRZ-HOST-01/guests.nix @@ -99,9 +99,9 @@ } // mkMicrovm "ibkr-flex" "HL-3-RZ-IBKR-01" "enp4s0" "02:01:27:ff:ed:77" "vlan40" { } - // mkMicrovm "powermeter" "HL-3-RZ-POWER-01" "enp4s0" "02:02:27:f1:ed:77" "vlan40" { - enableStorageDataset = true; - } + # // mkMicrovm "powermeter" "HL-3-RZ-POWER-01" "enp4s0" "02:02:27:f1:ed:77" "vlan40" { + # enableStorageDataset = true; + # } ); }; } diff --git a/hosts/HL-1-MRZ-HOST-03/guests.nix b/hosts/HL-1-MRZ-HOST-03/guests.nix index d76008c..bab1056 100755 --- a/hosts/HL-1-MRZ-HOST-03/guests.nix +++ b/hosts/HL-1-MRZ-HOST-03/guests.nix @@ -71,6 +71,9 @@ // mkMicrovm "unifi" "HL-3-RZ-UNIFI-01" "servers" "02:01:27:11:7f:17" "vlan40" { enableStorageDataset = true; } + // mkMicrovm "powermeter" "HL-3-RZ-POWER-01" "enp4s0" "02:02:27:f1:ed:77" "vlan40" { + enableStorageDataset = true; + } ); }; } diff --git a/hosts/HL-1-MRZ-HOST-03/guests/powermeter.nix b/hosts/HL-1-MRZ-HOST-03/guests/powermeter.nix new file mode 100755 index 0000000..aff25c3 --- /dev/null +++ b/hosts/HL-1-MRZ-HOST-03/guests/powermeter.nix @@ -0,0 +1,82 @@ +{ + inputs, + pkgs, + hostName, + ... +}: +# let +# |----------------------------------------------------------------------| # +# |----------------------------------------------------------------------| # +# in +{ + # microvm.mem = 512; + # microvm.vcpu = 1; + # microvm.shares = [ + # { + # # On the host + # source = "/shared/shares/users/christian/Trading/TWS_Flex_Reports"; + # # In the MicroVM + # mountPoint = "/TWS_Flex_Reports"; + # tag = "flex"; + # proto = "virtiofs"; + # } + # ]; + + networking.hostName = hostName; + + # |----------------------------------------------------------------------| # + users = { + users.power = { + isSystemUser = true; + group = "power"; + }; + 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"; + # }; + # ------------------------------ + # | SYSTEM PACKAGES | + # ------------------------------ + # environment.systemPackages = with pkgs; [ + # pkg-config + # 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.services."ibkr-flex-download" = { + # serviceConfig = { + # Type = "simple"; + # User = "root"; + # ExecStart = "${download-ibkr-flex}/bin/ibkr-flex-download"; + # }; + # }; + + # |----------------------------------------------------------------------| # + environment.persistence."/persist".files = [ + "/etc/ssh/ssh_host_rsa_key" + "/etc/ssh/ssh_host_rsa_key.pub" + ]; + # |----------------------------------------------------------------------| # + systemd.network.enable = true; + system.stateVersion = "24.05"; +}