Add initial legacy configuration
This commit is contained in:
parent
febfe1d970
commit
db07652d99
64 changed files with 3287 additions and 13 deletions
69
nixos-modules/hardware/amd-board.nix
Normal file
69
nixos-modules/hardware/amd-board.nix
Normal file
|
@ -0,0 +1,69 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
let
|
||||
thunderboltDevices = ''
|
||||
THUNDERBOLT_DEVICES="$(${pkgs.pciutils}/bin/lspci -D | ${pkgs.gnugrep}/bin/grep -i thunderbolt | cut --delimiter=' ' --fields=1)"
|
||||
'';
|
||||
forceThunderboltOnScript = pkgs.writeScriptBin "force-thunderbolt-power-on" ''
|
||||
#!${pkgs.stdenv.shell}
|
||||
|
||||
${thunderboltDevices}
|
||||
|
||||
echo "Force PCI power on all thunderbolt devices"
|
||||
for DEVICE in $THUNDERBOLT_DEVICES; do
|
||||
echo 'on' > "/sys/bus/pci/devices/$DEVICE/power/control"
|
||||
done
|
||||
'';
|
||||
thunderboltDockRestart = pkgs.writeScriptBin "thunderbolt-dock-restart" ''
|
||||
#!${pkgs.stdenv.shell}
|
||||
|
||||
${thunderboltDevices}
|
||||
|
||||
echo "Force PCI remove on all thunderbolt devices"
|
||||
for DEVICE in $THUNDERBOLT_DEVICES; do
|
||||
echo 1 > /sys/bus/pci/devices/$DEVICE/remove
|
||||
echo "Dropped device $DEVICE"
|
||||
done
|
||||
|
||||
|
||||
echo 'Please re-plug the dock and confirm [enter]'
|
||||
read
|
||||
|
||||
echo 'Rescanning PCI devices...'
|
||||
echo 1 > /sys/bus/pci/rescan
|
||||
|
||||
echo 'Done.'
|
||||
'';
|
||||
in
|
||||
{
|
||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||
|
||||
boot.initrd.availableKernelModules = [
|
||||
"nvme"
|
||||
"usbhid"
|
||||
"usb_storage"
|
||||
"sd_mod"
|
||||
"xhci_pci"
|
||||
"ahci"
|
||||
"virtio-pci"
|
||||
"igb"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [
|
||||
"kvm-amd"
|
||||
"uhid"
|
||||
];
|
||||
boot.extraModulePackages = [ ];
|
||||
boot.kernelParams = [ "acpi_enforce_resources=lax" ];
|
||||
|
||||
environment.systemPackages = [ thunderboltDockRestart ];
|
||||
|
||||
hardware.cpu.amd.updateMicrocode = true;
|
||||
nix.settings.max-jobs = lib.mkDefault 24;
|
||||
|
||||
powerManagement.powerUpCommands = "${forceThunderboltOnScript}/bin/force-thunderbolt-power-on";
|
||||
}
|
8
nixos-modules/hardware/ecc-memory.nix
Normal file
8
nixos-modules/hardware/ecc-memory.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
...
|
||||
}:
|
||||
{
|
||||
hardware.rasdaemon = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
42
nixos-modules/hardware/thinkpad-x1-gen9.nix
Normal file
42
nixos-modules/hardware/thinkpad-x1-gen9.nix
Normal file
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
hardwareModules,
|
||||
pkgFccUnlock,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
imports = with hardwareModules; [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
hardwareModules.lenovo-thinkpad-x1-9th-gen
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [
|
||||
"xhci_pci"
|
||||
"thunderbolt"
|
||||
"nvme"
|
||||
"usb_storage"
|
||||
"sd_mod"
|
||||
"ahci"
|
||||
"usbhid"
|
||||
];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
|
||||
boot.initrd.kernelModules = [ "dm-snapshot" ]; # TODO: This should be moved to defaults
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
modemmanager
|
||||
libmbim
|
||||
];
|
||||
|
||||
environment.etc."ModemManager/fcc-unlock.d/1eac:1001" = {
|
||||
source = "${pkgFccUnlock}/bin/fcc-unlock";
|
||||
};
|
||||
|
||||
# CPU Configuration
|
||||
hardware.cpu.intel.updateMicrocode = true;
|
||||
services.throttled.enable = true;
|
||||
powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue