From 0d94348de3137fe9a2d3efaf41e8ea671082340b Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Wed, 2 Oct 2024 13:07:14 -0400 Subject: [PATCH] reduced power draw + update --- configuration.nix | 17 +++++++++++++++++ flake.lock | 23 ++++++++++++++++++++--- flake.nix | 6 ++++++ 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/configuration.nix b/configuration.nix index a12ce5e..2dc3981 100644 --- a/configuration.nix +++ b/configuration.nix @@ -125,6 +125,21 @@ #!/bin/sh tmux -S /run/minecraft/${service_configs.minecraft.server_name}.sock attach '') + + (pkgs.writeScriptBin "disk-smart-test" '' + #!/bin/sh + set -e + if [[ $EUID -ne 0 ]]; then + echo "This command requires root." + exit 2 + fi + + DISKS=$(${pkgs.coreutils}/bin/ls /dev/sd* | ${pkgs.gnugrep}/bin/grep -v "[0-9]$") + for i in $DISKS; do + ${pkgs.coreutils}/bin/echo -n "$i " + ${pkgs.smartmontools}/bin/smartctl -a "$i" | ${pkgs.gnugrep}/bin/grep "SMART overall-health self-assessment test result:" | ${pkgs.coreutils}/bin/cut -d' ' -f6 + done + '') ]; services.zfs = { @@ -136,6 +151,8 @@ let no-rgb = pkgs.writeScriptBin "no-rgb" '' #!/bin/sh + set -e + NUM_DEVICES=$(${pkgs.openrgb}/bin/openrgb --noautoconnect --list-devices | ${pkgs.gnugrep}/bin/grep -E '^[0-9]+: ' | ${pkgs.coreutils}/bin/wc -l) for i in $(${pkgs.coreutils}/bin/seq 0 $(($NUM_DEVICES - 1))); do diff --git a/flake.lock b/flake.lock index 7467e6d..5bdf9ae 100644 --- a/flake.lock +++ b/flake.lock @@ -56,13 +56,29 @@ "type": "github" } }, + "nixos-hardware": { + "locked": { + "lastModified": 1727665282, + "narHash": "sha256-oKtfbQB1MBypqIyzkC8QCQcVGOa1soaXaGgcBIoh14o=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "11c43c830e533dad1be527ecce379fcf994fbbb5", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "master", + "repo": "nixos-hardware", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1727634051, - "narHash": "sha256-S5kVU7U82LfpEukbn/ihcyNt2+EvG7Z5unsKW9H/yFA=", + "lastModified": 1727802920, + "narHash": "sha256-HP89HZOT0ReIbI7IJZJQoJgxvB2Tn28V6XS3MNKnfLs=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "06cf0e1da4208d3766d898b7fdab6513366d45b9", + "rev": "27e30d177e57d912d614c88c622dcfdb2e6e6515", "type": "github" }, "original": { @@ -95,6 +111,7 @@ "root": { "inputs": { "nix-minecraft": "nix-minecraft", + "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", "quadlet-nix": "quadlet-nix" } diff --git a/flake.nix b/flake.nix index 74b8718..70641e2 100644 --- a/flake.nix +++ b/flake.nix @@ -5,6 +5,8 @@ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; # nixpkgs.url = "github:NixOS/nixpkgs/master"; + nixos-hardware.url = "github:NixOS/nixos-hardware/master"; + quadlet-nix.url = "github:SEIAROTg/quadlet-nix"; quadlet-nix.inputs.nixpkgs.follows = "nixpkgs"; @@ -17,6 +19,7 @@ nixpkgs, quadlet-nix, nix-minecraft, + nixos-hardware, ... }: let @@ -88,6 +91,9 @@ modules = [ ./configuration.nix quadlet-nix.nixosModules.quadlet + nixos-hardware.nixosModules.common-cpu-amd-pstate + nixos-hardware.nixosModules.common-cpu-amd-zenpower + nixos-hardware.nixosModules.common-pc-ssd ( { pkgs, ... }: {