11 PATH = stdenv.lib.concatStringsSep ":"
19 stdenv.mkDerivation rec {
20 pname = "smartctl-tbw";
22 name = "${pname}-${version}";
24 src = writeShellScriptBin "smartctl-tbw" ''
26 device=''${1:-/dev/sda}
27 sudo ${smartmontools}/bin/smartctl -A $device |
29 $0 ~ /Power_On_Hours/ { poh=$10; printf "%s / %d hours / %d days / %.2f years\n", $2, $10, $10 / 24, $10 / 24 / 365.25 }
30 $0 ~ /Total_LBAs_Written/ {
36 printf "%s / %s / %d mb / %.1f gb / %.3f tb\n", $2, $10, mb, gb, tb
37 printf "mean writes per hour: / %.2f", mb/poh
39 $0 ~ /Airflow_Temperature_Cel/ { print $2 " / " $10}
40 $0 ~ /Wear_Leveling_Count/ { printf "%s / %d (%% health)\n", $2, int($4) }
43 sed -e "s\$^\$$device @ \$" |
60 description = "Wrapper around smartctl to print the Total-Bytes-Written of disks";
61 license = stdenv.lib.licenses.gpl3Plus;
62 platforms = stdenv.lib.platforms.all;