Skip to content

Commit

Permalink
hosts(pve-epyc): setup UPS
Browse files Browse the repository at this point in the history
  • Loading branch information
xddxdd committed Nov 27, 2024
1 parent 78e5daa commit ebcdfa5
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 4 deletions.
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions hosts/pve-epyc/configuration.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
config,
lib,
inputs,
...
}:
{
Expand Down Expand Up @@ -50,4 +51,32 @@
};

zramSwap.enable = lib.mkForce false;

age.secrets.nut-pass.file = inputs.secrets + "/nut-pass.age";
power.ups = {
enable = true;
mode = "netserver";
ups.cyberpower = {
driver = "usbhid-ups";
port = "auto";
shutdownOrder = -1;
};
users.root = {
upsmon = "primary";
passwordFile = config.age.secrets.nut-pass.path;
instcmds = [ "ALL" ];
actions = [
"SET"
"FSD"
];
};

upsmon.monitor.cyberpower = {
user = "root";
type = "primary";
system = "cyberpower@localhost";
passwordFile = config.age.secrets.nut-pass.path;
powerValue = 1;
};
};
}
2 changes: 1 addition & 1 deletion nixos/hardware/nvidia/vgpu-extension.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let
nvidia_x11 = config.hardware.nvidia.package;
in
{
hardware.nvidia.package = config.boot.kernelPackages.nvidia_x11_vgpu_16_7;
hardware.nvidia.package = lib.mkForce config.boot.kernelPackages.nvidia_x11_vgpu_16_7;
hardware.nvidia.open = false;

boot.kernelModules = [
Expand Down
15 changes: 15 additions & 0 deletions nixos/minimal-components/ups-autofix.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{ config, lib, ... }:
{
systemd.services.upsd = lib.mkIf config.power.ups.enable {
serviceConfig = {
Restart = "always";
RestartSec = 5;
};
};
systemd.services.upsmon = lib.mkIf config.power.ups.upsmon.enable {
serviceConfig = {
Restart = "always";
RestartSec = 5;
};
};
}
78 changes: 78 additions & 0 deletions patches/nixpkgs-stable/nvidia-x11-allow-override-submodules.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
diff --git a/pkgs/os-specific/linux/nvidia-x11/fabricmanager.nix b/pkgs/os-specific/linux/nvidia-x11/fabricmanager.nix
index e70857ea356e..ab79fd62a34d 100644
--- a/pkgs/os-specific/linux/nvidia-x11/fabricmanager.nix
+++ b/pkgs/os-specific/linux/nvidia-x11/fabricmanager.nix
@@ -1,4 +1,4 @@
-nvidia_x11: sha256:
+sha256:

{ stdenv, lib, fetchurl, patchelf }:

diff --git a/pkgs/os-specific/linux/nvidia-x11/generic.nix b/pkgs/os-specific/linux/nvidia-x11/generic.nix
index 3f6c5d1caaa3..e69d2aaca3b6 100644
--- a/pkgs/os-specific/linux/nvidia-x11/generic.nix
+++ b/pkgs/os-specific/linux/nvidia-x11/generic.nix
@@ -207,8 +207,9 @@ let
openSha256;
settings =
if useSettings then
- (if settings32Bit then pkgsi686Linux.callPackage else callPackage) (import ./settings.nix self settingsSha256)
+ (if settings32Bit then pkgsi686Linux.callPackage else callPackage) (import ./settings.nix settingsSha256)
{
+ nvidia_x11 = self;
withGtk2 = preferGtk2;
withGtk3 = !preferGtk2;
fetchFromGitHub = fetchFromGithubOrNvidia;
@@ -216,14 +217,17 @@ let
persistenced =
if usePersistenced then
mapNullable
- (hash: callPackage (import ./persistenced.nix self hash) {
+ (hash: callPackage (import ./persistenced.nix hash) {
+ nvidia_x11 = self;
fetchFromGitHub = fetchFromGithubOrNvidia;
})
persistencedSha256
else { };
fabricmanager =
if useFabricmanager then
- mapNullable (hash: callPackage (import ./fabricmanager.nix self hash) { }) fabricmanagerSha256
+ mapNullable (hash: callPackage (import ./fabricmanager.nix hash) {
+ nvidia_x11 = self;
+ }) fabricmanagerSha256
else { };
inherit persistencedVersion settingsVersion;
compressFirmware = false;
diff --git a/pkgs/os-specific/linux/nvidia-x11/persistenced.nix b/pkgs/os-specific/linux/nvidia-x11/persistenced.nix
index dcdd22044e2a..c95d028ca332 100644
--- a/pkgs/os-specific/linux/nvidia-x11/persistenced.nix
+++ b/pkgs/os-specific/linux/nvidia-x11/persistenced.nix
@@ -1,8 +1,9 @@
-nvidia_x11: sha256:
+sha256:

{ stdenv
, lib
, fetchFromGitHub
+, nvidia_x11
, m4
, libtirpc
}:
diff --git a/pkgs/os-specific/linux/nvidia-x11/settings.nix b/pkgs/os-specific/linux/nvidia-x11/settings.nix
index 2d9dfd81829e..23e835362997 100644
--- a/pkgs/os-specific/linux/nvidia-x11/settings.nix
+++ b/pkgs/os-specific/linux/nvidia-x11/settings.nix
@@ -1,4 +1,4 @@
-nvidia_x11: sha256:
+sha256:

{ stdenv
, lib
@@ -16,6 +16,7 @@ nvidia_x11: sha256:
, libXxf86vm
, libvdpau
, librsvg
+, nvidia_x11
, wrapGAppsHook3
, addOpenGLRunpath
, withGtk2 ? false

0 comments on commit ebcdfa5

Please sign in to comment.