mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-21 15:13:55 -05:00
tree: add nixhw modules as flake outputs (#111)
This commit is contained in:
parent
de94ddb875
commit
8bfa0a602e
21
flake.lock
21
flake.lock
|
@ -437,26 +437,6 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixhw": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1727291538,
|
||||
"narHash": "sha256-80ll70/S/rENWSp63jxpPnENSlM3BcO6vh/1DjjPIrs=",
|
||||
"owner": "alyraffauf",
|
||||
"repo": "nixhw",
|
||||
"rev": "193e927e1d6b9f567ac9beb04fe7ca16e45a4edb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "alyraffauf",
|
||||
"repo": "nixhw",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1727264057,
|
||||
|
@ -554,7 +534,6 @@
|
|||
"home-manager": "home-manager_2",
|
||||
"iio-hyprland": "iio-hyprland",
|
||||
"lanzaboote": "lanzaboote",
|
||||
"nixhw": "nixhw",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"nur": "nur",
|
||||
|
|
20
flake.nix
20
flake.nix
|
@ -30,11 +30,6 @@
|
|||
url = "github:nix-community/lanzaboote/v0.4.1";
|
||||
};
|
||||
|
||||
nixhw = {
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
url = "github:alyraffauf/nixhw";
|
||||
};
|
||||
|
||||
nur.url = "github:nix-community/NUR";
|
||||
|
||||
stylix = {
|
||||
|
@ -137,6 +132,21 @@
|
|||
};
|
||||
|
||||
nixosModules = {
|
||||
hw-framework-13-amd-7000 = import ./hwModules/framework/13/amd-7000;
|
||||
hw-framework-13-intel-11th = import ./hwModules/framework/13/intel-11th;
|
||||
hw-lenovo-yoga-9i-intel-13th = import ./hwModules/lenovo/yoga-9i/intel-13th;
|
||||
hw-thinkpad-t440p = import ./hwModules/thinkpad/t440p;
|
||||
|
||||
hw-common-amd-cpu = import ./hwModules/common/gpu/amd;
|
||||
hw-common-amd-gpu = import ./hwModules/common/cpu/amd;
|
||||
hw-common-bluetooth = import ./hwModules/common/bluetooth;
|
||||
hw-common-intel-cpu = import ./hwModules/common/cpu/intel;
|
||||
hw-common-intel-gpu = import ./hwModules/common/gpu/intel;
|
||||
hw-common-laptop = import ./hwModules/common/laptop;
|
||||
hw-common-laptop-amd-gpu = import ./hwModules/common/laptop/amd-gpu.nix;
|
||||
hw-common-laptop-intel-cpu = import ./hwModules/common/laptop/intel-cpu.nix;
|
||||
hw-common-ssd = import ./hwModules/common/ssd;
|
||||
|
||||
common-auto-upgrade = import ./common/autoUpgrade.nix;
|
||||
common-base = import ./common/base.nix;
|
||||
common-locale = import ./common/locale.nix;
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
./home.nix
|
||||
./secrets.nix
|
||||
./stylix.nix
|
||||
self.inputs.nixhw.nixosModules.framework-13-intel-11th
|
||||
self.nixosModules.common-base
|
||||
self.nixosModules.common-locale
|
||||
self.nixosModules.common-mauville-share
|
||||
|
@ -18,6 +17,7 @@
|
|||
self.nixosModules.common-overlays
|
||||
self.nixosModules.common-pkgs
|
||||
self.nixosModules.common-wifi-profiles
|
||||
self.nixosModules.hw-framework-13-intel-11th
|
||||
];
|
||||
|
||||
boot.loader = {
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
./secrets.nix
|
||||
./stylix.nix
|
||||
(import ./../../disko/luks-btrfs-subvolumes.nix {disks = ["/dev/nvme0n1"];})
|
||||
self.inputs.nixhw.nixosModules.framework-13-amd-7000
|
||||
self.nixosModules.common-auto-upgrade
|
||||
self.nixosModules.common-base
|
||||
self.nixosModules.common-locale
|
||||
|
@ -20,6 +19,7 @@
|
|||
self.nixosModules.common-pkgs
|
||||
self.nixosModules.common-tailscale
|
||||
self.nixosModules.common-wifi-profiles
|
||||
self.nixosModules.hw-framework-13-amd-7000
|
||||
];
|
||||
|
||||
boot = {
|
||||
|
|
|
@ -14,10 +14,6 @@ in {
|
|||
./raffauflabs.nix
|
||||
./secrets.nix
|
||||
./stylix.nix
|
||||
self.inputs.nixhw.nixosModules.common-amd-cpu
|
||||
self.inputs.nixhw.nixosModules.common-amd-gpu
|
||||
self.inputs.nixhw.nixosModules.common-bluetooth
|
||||
self.inputs.nixhw.nixosModules.common-ssd
|
||||
self.nixosModules.common-auto-upgrade
|
||||
self.nixosModules.common-base
|
||||
self.nixosModules.common-locale
|
||||
|
@ -26,6 +22,10 @@ in {
|
|||
self.nixosModules.common-pkgs
|
||||
self.nixosModules.common-tailscale
|
||||
self.nixosModules.common-wifi-profiles
|
||||
self.nixosModules.hw-common-amd-cpu
|
||||
self.nixosModules.hw-common-amd-gpu
|
||||
self.nixosModules.hw-common-bluetooth
|
||||
self.nixosModules.hw-common-ssd
|
||||
];
|
||||
|
||||
boot = {
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
./secrets.nix
|
||||
./stylix.nix
|
||||
(import ./../../disko/luks-btrfs-subvolumes.nix {disks = ["/dev/nvme0n1"];})
|
||||
self.inputs.nixhw.nixosModules.lenovo-yoga-9i-intel-13th
|
||||
self.nixosModules.common-auto-upgrade
|
||||
self.nixosModules.common-base
|
||||
self.nixosModules.common-locale
|
||||
|
@ -20,6 +19,7 @@
|
|||
self.nixosModules.common-pkgs
|
||||
self.nixosModules.common-tailscale
|
||||
self.nixosModules.common-wifi-profiles
|
||||
self.nixosModules.hw-lenovo-yoga-9i-intel-13th
|
||||
];
|
||||
|
||||
boot = {
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
./secrets.nix
|
||||
./stylix.nix
|
||||
(import ./../../disko/luks-btrfs-subvolumes.nix {disks = ["/dev/sda"];})
|
||||
self.inputs.nixhw.nixosModules.thinkpad-t440p
|
||||
self.nixosModules.common-auto-upgrade
|
||||
self.nixosModules.common-base
|
||||
self.nixosModules.common-locale
|
||||
|
@ -20,6 +19,7 @@
|
|||
self.nixosModules.common-pkgs
|
||||
self.nixosModules.common-tailscale
|
||||
self.nixosModules.common-wifi-profiles
|
||||
self.nixosModules.hw-thinkpad-t440p
|
||||
];
|
||||
|
||||
boot = {
|
||||
|
|
|
@ -8,10 +8,6 @@
|
|||
./raffauflabs.nix
|
||||
./secrets.nix
|
||||
(import ./../../disko/btrfs-subvolumes.nix {disks = ["/dev/sda"];})
|
||||
self.inputs.nixhw.nixosModules.common-bluetooth
|
||||
self.inputs.nixhw.nixosModules.common-intel-cpu
|
||||
self.inputs.nixhw.nixosModules.common-intel-gpu
|
||||
self.inputs.nixhw.nixosModules.common-ssd
|
||||
self.nixosModules.common-auto-upgrade
|
||||
self.nixosModules.common-base
|
||||
self.nixosModules.common-locale
|
||||
|
@ -21,6 +17,10 @@
|
|||
self.nixosModules.common-pkgs
|
||||
self.nixosModules.common-tailscale
|
||||
self.nixosModules.common-wifi-profiles
|
||||
self.nixosModules.hw-common-bluetooth
|
||||
self.nixosModules.hw-common-intel-cpu
|
||||
self.nixosModules.hw-common-intel-gpu
|
||||
self.nixosModules.hw-common-ssd
|
||||
];
|
||||
|
||||
boot = {
|
||||
|
|
22
hwModules/common/bluetooth/default.nix
Normal file
22
hwModules/common/bluetooth/default.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
hardware = {
|
||||
bluetooth.enable = true;
|
||||
|
||||
pulseaudio = {
|
||||
enable = lib.mkForce false;
|
||||
package = pkgs.pulseaudioFull; # Use extra Bluetooth codecs like aptX
|
||||
|
||||
extraConfig = ''
|
||||
load-module module-bluetooth-discover
|
||||
load-module module-bluetooth-policy
|
||||
load-module module-switch-on-connect
|
||||
'';
|
||||
|
||||
support32Bit = true;
|
||||
};
|
||||
};
|
||||
}
|
9
hwModules/common/cpu/amd/default.nix
Normal file
9
hwModules/common/cpu/amd/default.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{lib, ...}: {
|
||||
boot = {
|
||||
kernelModules = ["kvm-amd"];
|
||||
kernelParams = ["amd_pstate=active"];
|
||||
};
|
||||
|
||||
hardware.cpu.amd.updateMicrocode = true;
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
}
|
5
hwModules/common/cpu/intel/default.nix
Normal file
5
hwModules/common/cpu/intel/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{lib, ...}: {
|
||||
boot.kernelModules = ["kvm-intel"];
|
||||
hardware.cpu.intel.updateMicrocode = true;
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
}
|
14
hwModules/common/gpu/amd/default.nix
Normal file
14
hwModules/common/gpu/amd/default.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{...}: {
|
||||
environment.variables.VDPAU_DRIVER = "radeonsi";
|
||||
|
||||
hardware.amdgpu = {
|
||||
initrd.enable = true;
|
||||
|
||||
amdvlk = {
|
||||
enable = true;
|
||||
support32Bit.enable = true;
|
||||
};
|
||||
|
||||
opencl.enable = true;
|
||||
};
|
||||
}
|
32
hwModules/common/gpu/intel/default.nix
Normal file
32
hwModules/common/gpu/intel/default.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
{pkgs, ...}: {
|
||||
boot.initrd.kernelModules = ["i915"];
|
||||
|
||||
environment.sessionVariables = {
|
||||
LIBVA_DRIVER_NAME = "iHD";
|
||||
VDPAU_DRIVER = "va_gl";
|
||||
};
|
||||
|
||||
hardware = {
|
||||
intel-gpu-tools.enable = true;
|
||||
|
||||
opengl = {
|
||||
enable = true;
|
||||
driSupport = true;
|
||||
driSupport32Bit = true;
|
||||
|
||||
extraPackages = with pkgs; [
|
||||
intel-media-driver # LIBVA_DRIVER_NAME=iHD
|
||||
(intel-vaapi-driver.override {enableHybridCodec = true;})
|
||||
libvdpau-va-gl
|
||||
];
|
||||
|
||||
extraPackages32 = with pkgs.driversi686Linux; [
|
||||
intel-media-driver # LIBVA_DRIVER_NAME=iHD
|
||||
(intel-vaapi-driver.override {enableHybridCodec = true;})
|
||||
libvdpau-va-gl
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
services.xserver.videoDrivers = ["modesetting"];
|
||||
}
|
2
hwModules/common/laptop/amd-gpu.nix
Normal file
2
hwModules/common/laptop/amd-gpu.nix
Normal file
|
@ -0,0 +1,2 @@
|
|||
{...}: {
|
||||
}
|
27
hwModules/common/laptop/default.nix
Normal file
27
hwModules/common/laptop/default.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
services = {
|
||||
pipewire.wireplumber.extraConfig = {
|
||||
# Pipewire eats battery by never disabling the camera.
|
||||
"10-disable-camera" = {
|
||||
"wireplumber.profiles" = {
|
||||
main = {
|
||||
"monitor.libcamera" = "disabled";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
power-profiles-daemon.enable = lib.mkDefault true;
|
||||
|
||||
udev.extraRules = ''
|
||||
SUBSYSTEM=="power_supply", ATTR{online}=="1", ACTION=="change", RUN+="${lib.getExe pkgs.power-profiles-daemon} set balanced"
|
||||
SUBSYSTEM=="power_supply", ATTR{online}=="0", ACTION=="change", RUN+="${lib.getExe pkgs.power-profiles-daemon} set power-saver"
|
||||
'';
|
||||
|
||||
upower.enable = lib.mkDefault true;
|
||||
};
|
||||
}
|
4
hwModules/common/laptop/intel-cpu.nix
Normal file
4
hwModules/common/laptop/intel-cpu.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{...}: {
|
||||
powerManagement.powertop.enable = true;
|
||||
services.thermald.enable = true;
|
||||
}
|
3
hwModules/common/ssd/default.nix
Normal file
3
hwModules/common/ssd/default.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{...}: {
|
||||
services.fstrim.enable = true;
|
||||
}
|
30
hwModules/framework/13/amd-7000/default.nix
Normal file
30
hwModules/framework/13/amd-7000/default.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
../../../common/bluetooth
|
||||
../../../common/cpu/amd
|
||||
../../../common/gpu/amd
|
||||
../../../common/laptop
|
||||
../../../common/laptop/amd-gpu.nix
|
||||
../../../common/ssd
|
||||
../../common.nix
|
||||
../common.nix
|
||||
];
|
||||
|
||||
boot = {
|
||||
initrd.availableKernelModules = ["nvme" "sd_mod" "thunderbolt" "usb_storage" "xhci_pci"];
|
||||
extraModprobeConfig = ''
|
||||
options snd_hda_intel power_save=1
|
||||
'';
|
||||
kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
||||
};
|
||||
|
||||
networking.networkmanager = {
|
||||
enable = true;
|
||||
wifi.powersave = true;
|
||||
wifi.backend = "iwd";
|
||||
};
|
||||
}
|
2
hwModules/framework/13/common.nix
Normal file
2
hwModules/framework/13/common.nix
Normal file
|
@ -0,0 +1,2 @@
|
|||
{...}: {
|
||||
}
|
28
hwModules/framework/13/intel-11th/default.nix
Normal file
28
hwModules/framework/13/intel-11th/default.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
../../../common/bluetooth
|
||||
../../../common/cpu/intel
|
||||
../../../common/gpu/intel
|
||||
../../../common/laptop
|
||||
../../../common/laptop/intel-cpu.nix
|
||||
../../../common/ssd
|
||||
../../common.nix
|
||||
../common.nix
|
||||
];
|
||||
|
||||
boot = {
|
||||
blacklistedKernelModules = ["cros-usbpd-charger"];
|
||||
initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod"];
|
||||
kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
||||
|
||||
kernelParams = [
|
||||
"nvme.noacpi=1" # https://community.frame.work/t/linux-battery-life-tuning/6665/156
|
||||
];
|
||||
};
|
||||
|
||||
hardware.acpilight.enable = true;
|
||||
}
|
35
hwModules/framework/common.nix
Normal file
35
hwModules/framework/common.nix
Normal file
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
boot = {
|
||||
extraModulePackages = with config.boot.kernelPackages; [
|
||||
framework-laptop-kmod
|
||||
];
|
||||
|
||||
kernelModules = [
|
||||
# https://github.com/DHowett/framework-laptop-kmod?tab=readme-ov-file#usage
|
||||
"cros_ec_lpcs"
|
||||
"cros_ec"
|
||||
];
|
||||
};
|
||||
|
||||
environment.systemPackages = [pkgs.framework-tool] ++ lib.optional (pkgs ? "fw-ectool") pkgs.fw-ectool;
|
||||
|
||||
hardware = {
|
||||
enableAllFirmware = true;
|
||||
sensor.iio.enable = true;
|
||||
};
|
||||
|
||||
services = {
|
||||
fprintd.enable = true;
|
||||
fwupd.enable = true;
|
||||
|
||||
udev.extraRules = ''
|
||||
# Ethernet expansion card support
|
||||
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0bda", ATTR{idProduct}=="8156", ATTR{power/autosuspend}="20"
|
||||
'';
|
||||
};
|
||||
}
|
3
hwModules/lenovo/common.nix
Normal file
3
hwModules/lenovo/common.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{...}: {
|
||||
hardware.enableAllFirmware = true;
|
||||
}
|
3
hwModules/lenovo/yoga-9i/common.nix
Normal file
3
hwModules/lenovo/yoga-9i/common.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{...}: {
|
||||
hardware.sensor.iio.enable = true;
|
||||
}
|
21
hwModules/lenovo/yoga-9i/intel-13th/default.nix
Normal file
21
hwModules/lenovo/yoga-9i/intel-13th/default.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
../../../common/bluetooth
|
||||
../../../common/cpu/intel
|
||||
../../../common/gpu/intel
|
||||
../../../common/laptop
|
||||
../../../common/laptop/intel-cpu.nix
|
||||
../../../common/ssd
|
||||
../../common.nix
|
||||
../common.nix
|
||||
];
|
||||
|
||||
boot = {
|
||||
initrd.availableKernelModules = ["nvme" "sd_mod" "thunderbolt" "usb_storage" "xhci_pci"];
|
||||
kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
||||
};
|
||||
}
|
10
hwModules/thinkpad/common.nix
Normal file
10
hwModules/thinkpad/common.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{...}: {
|
||||
hardware = {
|
||||
enableAllFirmware = true;
|
||||
|
||||
trackpoint = {
|
||||
enable = true;
|
||||
emulateWheel = true;
|
||||
};
|
||||
};
|
||||
}
|
32
hwModules/thinkpad/t440p/default.nix
Normal file
32
hwModules/thinkpad/t440p/default.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
{...}: {
|
||||
imports = [
|
||||
../../common/bluetooth
|
||||
../../common/cpu/intel
|
||||
../../common/gpu/intel
|
||||
../../common/laptop
|
||||
../../common/laptop/intel-cpu.nix
|
||||
../../common/ssd
|
||||
../common.nix
|
||||
];
|
||||
|
||||
boot = {
|
||||
extraModprobeConfig = ''
|
||||
options bbswitch use_acpi_to_detect_card_state=1
|
||||
options thinkpad_acpi force_load=1 fan_control=1
|
||||
'';
|
||||
|
||||
initrd.availableKernelModules = [
|
||||
"ahci"
|
||||
"ehci_pci"
|
||||
"rtsx_pci_sdmmc"
|
||||
"sd_mod"
|
||||
"sr_mod"
|
||||
"usb_storage"
|
||||
"xhci_pci"
|
||||
];
|
||||
};
|
||||
|
||||
powerManagement.cpuFreqGovernor = "ondemand";
|
||||
|
||||
services.fwupd.enable = true;
|
||||
}
|
Loading…
Reference in a new issue