Added specific configs from arnarg/config

This commit is contained in:
ari committed 2024-07-31 12:11:08 -04:00
1 parent b313d7a4f8
commit b80f189128
5 files changed
+150 -32

No files matched your search

+45 -14
View File
@@ -2,38 +2,69 @@
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
let
kernel = config.boot.kernelPackages.kernel;
hddled = pkgs.stdenv.mkDerivation rec {
name = "hddled_tmj33-${version}-${kernel.version}";
version = "0.3";
src = pkgs.fetchFromGitHub {
owner = "arnarg";
repo = "hddled_tmj33";
rev = version;
sha256 = "sha256-sQ8fLK8NP5sHw/9gJTO6lqgWfwmi1G5KDwWuWujNCZw=";
};
nativeBuildInputs = kernel.moduleBuildDependencies;
# We don't want to depmod yet, just build and package the module
preConfigure = ''
sed -i 's|depmod|#depmod|' Makefile
'';
makeFlags = [
"TARGET=${kernel.modDirVersion}"
"KERNEL_MODULES=${kernel.dev}/lib/modules/${kernel.modDirVersion}"
"MODDESTDIR=$(out)/lib/modules/${kernel.modDirVersion}/kernel/drivers/misc"
];
};
in
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
[
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "usbhid" "uas" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
boot.extraModulePackages = with pkgs.linuxPackages; [
it87
hddled
];
boot.kernelModules = [
"kvm-intel"
"coretemp"
"drivetemp"
"it87"
"hddled_tmj33"
];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/a3b275b4-96d4-4eb4-b01f-d80370899791";
{
device = "/dev/disk/by-uuid/a3b275b4-96d4-4eb4-b01f-d80370899791";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/AAA7-BCE9";
{
device = "/dev/disk/by-uuid/AAA7-BCE9";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp0s21f0u5.useDHCP = lib.mkDefault true;
# networking.interfaces.enp2s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
nix.settings.max-jobs = 2;
powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
}
+1 -17
View File
@@ -6,22 +6,6 @@
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.extraModulePackages = with pkgs.linuxPackages; [ it87 ];
boot.kernelModules = ["coretemp" "it87" "drivetemp"];
systemd.services.fancontrol = {
enable = true;
description = "Fan control";
wantedBy = ["multi-user.target" "graphical.target" "rescue.target"];
unitConfig = {
Type = "simple";
};
serviceConfig = {
ExecStart = "${pkgs.lm_sensors}/bin/fancontrol";
Restart = "always";
};
};
homelab.hardware.fan2go.enable = true;
}
+6
View File
@@ -0,0 +1,6 @@
{ ... }:
{
imports = [
./fan2go.nix
];
}
+95
View File
@@ -0,0 +1,95 @@
# Source: https://github.com/arnarg/config/blob/3cfad29004a92d310871a56605aa84df1b13741f/hosts/terra/fan2go.nix
{ lib
, config
, pkgs
, ...
}:
let
cfg = config.homelab.hardware.fan2go;
fan2goConfig = pkgs.writeText "fan2go.yaml" ''
dbPath: ${cfg.dbPath}
fans:
- id: out_back
hwmon:
platform: it8613
rpmChannel: 3
pwmChannel: 3
curve: case_max
sensors:
- id: cpu_package
hwmon:
platform: coretemp
index: 1
- id: nvme_ssd
hwmon:
platform: nvme
index: 2
- id: hdd
hwmon:
platform: drivetemp
index: 1
curves:
- id: cpu_curve
linear:
sensor: cpu_package
steps:
- 40: 0
- 50: 50
- 80: 255
- id: nvme_curve
linear:
sensor: nvme_ssd
min: 40
max: 70
- id: hdd_curve
linear:
sensor: hdd
min: 30
max: 50
- id: case_max
function:
type: maximum
curves:
- cpu_curve
- nvme_curve
- hdd_curve
'';
in
{
options.homelab.hardware.fan2go = with lib; {
enable = mkEnableOption "fan2go";
dbPath = mkOption {
type = types.str;
default = "/var/lib/fan2go/fan2go.db";
description = "The path of the database file.";
};
};
config = lib.mkIf cfg.enable {
systemd.services.fan2go = {
description = "A simple daemon providing dynamic fan speed control based on temperature sensors.";
wantedBy = [ "multi-user.target" ];
after = [ "lm_sensors.service" ];
serviceConfig = {
ExecStart = lib.concatStringsSep " " [
"${pkgs.fan2go}/bin/fan2go"
"-c"
"${fan2goConfig}"
"--no-style"
];
LimitNOFILE = 8192;
};
};
};
}
+3 -1
View File
@@ -48,5 +48,7 @@
else
[ ])
++ (if enableNetworkDrives then [ (import ./network-drives.nix) ] else [ ])
++ (if enableHomelabServices then [ (import ./hl-services) ] else [ ]);
++ (if enableHomelabServices then [ (import ./hl-services) ] else [ ])
++ (if enableHomelabServices then [ (import ./hl-hardware) ] else [ ])
;
}