Merge branch 'master' into lenovo-legion-16ARHA7
This commit is contained in:
commit
78365a8f03
|
@ -5,8 +5,7 @@ queue_rules:
|
|||
defaults:
|
||||
actions:
|
||||
queue:
|
||||
allow_merging_configuration_change: true
|
||||
method: rebase
|
||||
merge_method: rebase
|
||||
pull_request_rules:
|
||||
- name: merge using the merge queue
|
||||
conditions:
|
||||
|
|
|
@ -80,7 +80,9 @@ See code for all available configurations.
|
|||
| [Apple MacBook Pro 11,5](apple/macbook-pro/11-5) | `<nixos-hardware/apple/macbook-pro/11-5>` |
|
||||
| [Apple MacBook Pro 12,1](apple/macbook-pro/12-1) | `<nixos-hardware/apple/macbook-pro/12-1>` |
|
||||
| [Apple MacBook Pro 14,1](apple/macbook-pro/14-1) | `<nixos-hardware/apple/macbook-pro/14-1>` |
|
||||
| [Apple MacMini (2010, Intel, Nvidia)](apple/macmini/4) | `<nixos-hardware/apple/macmini/4>` |
|
||||
| [Apple Macs with a T2 Chip](apple/t2) | `<nixos-hardware/apple/t2>` |
|
||||
| [Asus Pro WS X570-ACE](asus/pro-ws-x570-ace) | `<nixos-hardware/asus/pro-ws-x570-ace>` |
|
||||
| [Asus ROG Ally RC71L (2023)](asus/ally/rc71l) | `<nixos-hardware/asus/ally/rc71l>` |
|
||||
| [Asus ROG Strix G513IM](asus/rog-strix/g513im) | `<nixos-hardware/asus/rog-strix/g513im>` |
|
||||
| [Asus ROG Strix G733QS](asus/rog-strix/g733qs) | `<nixos-hardware/asus/rog-strix/g733qs>` |
|
||||
|
@ -93,6 +95,7 @@ See code for all available configurations.
|
|||
| [Asus ROG Zephyrus M16 GU603H](asus/zephyrus/gu603h) | `<nixos-hardware/asus/zephyrus/gu603h>` |
|
||||
| [Asus TUF FX504GD](asus/fx504gd) | `<nixos-hardware/asus/fx504gd>` |
|
||||
| [Asus TUF FA507RM](asus/fa507rm) | `<nixos-hardware/asus/fa507rm>` |
|
||||
| [Asus TUF FA507NV](asus/fa507nv) | `<nixos-hardware/asus/fa507nv>` |
|
||||
| [BeagleBoard PocketBeagle](beagleboard/pocketbeagle) | `<nixos-hardware/beagleboard/pocketbeagle>` |
|
||||
| [Deciso DEC series](deciso/dec) | `<nixos-hardware/deciso/dec>` |
|
||||
| [Dell G3 3779](dell/g3/3779) | `<nixos-hardware/dell/g3/3779>` |
|
||||
|
@ -143,6 +146,7 @@ See code for all available configurations.
|
|||
| [Framework 12th Gen Intel Core](framework/13-inch/12th-gen-intel) | `<nixos-hardware/framework/13-inch/12th-gen-intel>` |
|
||||
| [Framework 13th Gen Intel Core](framework/13-inch/13th-gen-intel) | `<nixos-hardware/framework/13-inch/13th-gen-intel>` |
|
||||
| [Framework 13 AMD Ryzen 7040 Series](framework/13-inch/7040-amd) | `<nixos-hardware/framework/13-inch/7040-amd>` |
|
||||
| [Framework 16 AMD Ryzen 7040 Series](framework/16-inch/cpu/7040-amd) | `<nixos-hardware/framework/16-inch/cpu/7040-amd>` |
|
||||
| [FriendlyARM NanoPC-T4](friendlyarm/nanopc-t4) | `<nixos-hardware/friendlyarm/nanopc-t4>` |
|
||||
| [FriendlyARM NanoPi R5s](friendlyarm/nanopi-r5s) | `<nixos-hardware/friendlyarm/nanopi-r5s>` |
|
||||
| [Focus M2 Gen 1](focus/m2/gen1) | `<nixos-hardware/focus/m2/gen1>` |
|
||||
|
@ -154,6 +158,7 @@ See code for all available configurations.
|
|||
| [GPD WIN Max 2 2023](gpd/win-max-2/2023) | `<nixos-hardware/gpd/win-max-2/2023>` |
|
||||
| [Google Pixelbook](google/pixelbook) | `<nixos-hardware/google/pixelbook>` |
|
||||
| [HP Elitebook 2560p](hp/elitebook/2560p) | `<nixos-hardware/hp/elitebook/2560p>` |
|
||||
| [HP Elitebook 830g6](hp/elitebook/830/g6) | `<nixos-hardware/hp/elitebook/830/g6>` |
|
||||
| [HP Elitebook 845g7](hp/elitebook/845/g7) | `<nixos-hardware/hp/elitebook/845/g7>` |
|
||||
| [HP Elitebook 845g8](hp/elitebook/845/g8) | `<nixos-hardware/hp/elitebook/845/g8>` |
|
||||
| [HP Elitebook 845g9](hp/elitebook/845/g9) | `<nixos-hardware/hp/elitebook/845/g9>` |
|
||||
|
@ -238,7 +243,8 @@ See code for all available configurations.
|
|||
| [Lenovo ThinkPad X280](lenovo/thinkpad/x280) | `<nixos-hardware/lenovo/thinkpad/x280>` |
|
||||
| [Lenovo ThinkPad X390](lenovo/thinkpad/x390) | `<nixos-hardware/lenovo/thinkpad/x390>` |
|
||||
| [Lenovo ThinkPad Z Series](lenovo/thinkpad/z) | `<nixos-hardware/lenovo/thinkpad/z>` |
|
||||
| [Lenovo ThinkPad Z13](lenovo/thinkpad/z/z13) | `<nixos-hardware/lenovo/thinkpad/z/z13>` |
|
||||
| [Lenovo ThinkPad Z13 Gen 1](lenovo/thinkpad/z/gen1/z13) | `<nixos-hardware/lenovo/thinkpad/z/gen1/z13>` |
|
||||
| [Lenovo ThinkPad Z13 Gen 2](lenovo/thinkpad/z/gen2/z13) | `<nixos-hardware/lenovo/thinkpad/z/gen2/z13>` |
|
||||
| [LENOVO Yoga 6 13ALC6 82ND](lenovo/yoga/6/13ALC6) | `<nixos-hardware/lenovo/yoga/6/13ALC6>` |
|
||||
| [LENOVO Yoga Slim 7 Pro-X 14ARH7 82ND](lenovo/yoga/7/14ARH7/amdgpu) | `<nixos-hardware/lenovo/yoga/7/14ARH7/amdgpu>` |
|
||||
| [LENOVO Yoga Slim 7 Pro-X 14ARH7 82ND](lenovo/yoga/7/14ARH7/nvidia) | `<nixos-hardware/lenovo/yoga/7/14ARH7/nvidia>` |
|
||||
|
@ -286,4 +292,5 @@ See code for all available configurations.
|
|||
| [Toshiba Chromebook 2 `swanky`](toshiba/swanky) | `<nixos-hardware/toshiba/swanky>` |
|
||||
| [Tuxedo InfinityBook v4](tuxedo/infinitybook/v4) | `<nixos-hardware/tuxedo/infinitybook/v4>` |
|
||||
| [TUXEDO InfinityBook Pro 14 - Gen7](tuxedo/infinitybook/pro14/gen7) | `<nixos-hardware/tuxedo/infinitybook/pro14/gen7>` |
|
||||
| [TUXEDO Pulse 14 - Gen3](tuxedo/pulse/14/gen3) | `<nixos-hardware/tuxedo/pulse/14/gen3>` |
|
||||
| [TUXEDO Pulse 15 - Gen2](tuxedo/pulse/15/gen2) | `<nixos-hardware/tuxedo/pulse/15/gen2>` |
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkDefault;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
../.
|
||||
];
|
||||
|
||||
services.xserver.videoDrivers = mkDefault [ "nvidiaLegacy340" ];
|
||||
|
||||
hardware.opengl = {
|
||||
enable = mkDefault true;
|
||||
driSupport = mkDefault true;
|
||||
driSupport32Bit = mkDefault true;
|
||||
};
|
||||
|
||||
hardware.nvidia = {
|
||||
modesetting.enable = mkDefault true;
|
||||
powerManagement.enable = mkDefault false;
|
||||
powerManagement.finegrained = mkDefault false;
|
||||
open = mkDefault false;
|
||||
nvidiaSettings = mkDefault true;
|
||||
};
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
../.
|
||||
../../common/cpu/intel
|
||||
];
|
||||
}
|
|
@ -24,6 +24,8 @@ let
|
|||
|
||||
pipewirePackage = overrideAudioFiles pkgs.pipewire "spa/plugins/";
|
||||
|
||||
tiny-dfrPackage = pkgs.callPackage ./pkgs/tiny-dfr.nix { };
|
||||
|
||||
apple-set-os-loader-installer = pkgs.stdenv.mkDerivation {
|
||||
name = "apple-set-os-loader-installer-1.0";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
|
@ -60,9 +62,10 @@ in
|
|||
boot.kernelPackages = pkgs.linuxPackagesFor (pkgs.callPackage ./pkgs/linux-t2.nix { });
|
||||
boot.initrd.kernelModules = [ "apple-bce" ];
|
||||
|
||||
services.udev.packages = [ audioFilesUdevRules tiny-dfrPackage ];
|
||||
|
||||
# For audio
|
||||
boot.kernelParams = [ "pcie_ports=compat" "intel_iommu=on" "iommu=pt" ];
|
||||
services.udev.packages = [ audioFilesUdevRules ];
|
||||
|
||||
hardware.pulseaudio.package = overrideAudioFiles pkgs.pulseaudio "src/modules/";
|
||||
|
||||
|
@ -71,18 +74,25 @@ in
|
|||
pipewire = pipewirePackage;
|
||||
};
|
||||
|
||||
# For tiny-dfr
|
||||
systemd.services.tiny-dfr = {
|
||||
enable = true;
|
||||
description = "Tiny Apple silicon touch bar daemon";
|
||||
after = [ "systemd-user-sessions.service" "getty@tty1.service" "plymouth-quit.service" "systemd-logind.service" ];
|
||||
bindsTo = [ "dev-tiny_dfr_display.device" "dev-tiny_dfr_backlight.device" ];
|
||||
startLimitIntervalSec = 30;
|
||||
startLimitBurst = 2;
|
||||
script = "${tiny-dfrPackage}/bin/tiny-dfr";
|
||||
restartTriggers = [ tiny-dfrPackage ];
|
||||
};
|
||||
|
||||
environment.etc."tiny-dfr/config.toml" = {
|
||||
source = "${tiny-dfrPackage}/share/tiny-dfr/config.toml";
|
||||
};
|
||||
|
||||
# Make sure post-resume.service exists
|
||||
powerManagement.enable = true;
|
||||
|
||||
systemd.services.fix-keyboard-backlight-and-touchbar = {
|
||||
path = [ pkgs.kmod ];
|
||||
serviceConfig.ExecStart = ''${pkgs.systemd}/bin/systemd-inhibit --what=sleep --why="fixing keyboard backlight and touchbar must finish before sleep" --mode=delay ${./fix-keyboard-backlight-and-touchbar.sh}'';
|
||||
serviceConfig.Type = "oneshot";
|
||||
description = "reload touchbar driver and restart upower";
|
||||
wantedBy = [ "display-manager.service" "post-resume.target" ];
|
||||
after = [ "post-resume.target" ];
|
||||
};
|
||||
|
||||
# Activation script to install apple-set-os-loader in order to unlock the iGPU
|
||||
system.activationScripts.appleSetOsLoader = lib.optionalString t2Cfg.enableAppleSetOsLoader ''
|
||||
if [[ -e /boot/efi/efi/boot/bootx64_original.efi ]]; then
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -eux
|
||||
|
||||
unload () {
|
||||
if modprobe -r "$1" 2>&1;
|
||||
then echo ok
|
||||
else echo fail
|
||||
fi
|
||||
}
|
||||
|
||||
wait_unload() {
|
||||
while sleep 1; do
|
||||
output="$(unload "$1")"
|
||||
case "$output" in
|
||||
*is\ in\ use*) :;;
|
||||
*ok*) return 0;;
|
||||
*) echo "modprobe said: $output"; echo giving up; return 1;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
wait_unload apple_touchbar
|
||||
modprobe apple_touchbar
|
||||
|
||||
# After suspend, the inode for the backlight device has changed. This service
|
||||
# simply restarts upower to inform it of that change.
|
||||
systemctl restart upower.service
|
|
@ -5,11 +5,11 @@ let
|
|||
patchRepo = fetchFromGitHub {
|
||||
owner = "t2linux";
|
||||
repo = "linux-t2-patches";
|
||||
rev = "46dd873d1d9d12b26916790045008a91a95d0c11";
|
||||
hash = "sha256-YGUGuzsAJFtZYjIW9d2XU4eGKNvMKCaWXqgqJn5TdeY=";
|
||||
rev = "7cd298e227e95bac9a704ffc8f5ff5e89a1bf4d7";
|
||||
hash = "sha256-Oi3CwQl0IwdVc9w+pbmJjBnyqwLFhbqFwxs5o0mqtbE=";
|
||||
};
|
||||
|
||||
version = "6.5";
|
||||
version = "6.7.7";
|
||||
majorVersion = with lib; (elemAt (take 1 (splitVersion version)) 0);
|
||||
in
|
||||
buildLinux (args // {
|
||||
|
@ -22,7 +22,7 @@ buildLinux (args // {
|
|||
src = runCommand "patched-source" {} ''
|
||||
cp -r ${fetchzip {
|
||||
url = "mirror://kernel/linux/kernel/v${majorVersion}.x/linux-${version}.tar.xz";
|
||||
hash = "sha256-qJmVSju69WcvDIbgrbtMyCi+OXUNTzNX2G+/0zwsPR4=";
|
||||
hash = "sha256-j+Ufl6C1Mqjthk18GPt2e7j+i7viauOgNnVy9dJSgaM=";
|
||||
}} $out
|
||||
chmod -R u+w $out
|
||||
cd $out
|
||||
|
@ -40,10 +40,11 @@ buildLinux (args // {
|
|||
BT_HCIBCM4377 = module;
|
||||
BT_HCIUART_BCM = yes;
|
||||
BT_HCIUART = module;
|
||||
HID_APPLE_IBRIDGE = module;
|
||||
HID_APPLETB_BL = module;
|
||||
HID_APPLETB_KBD = module;
|
||||
HID_APPLE = module;
|
||||
DRM_APPLETBDRM = module;
|
||||
HID_APPLE_MAGIC_BACKLIGHT = module;
|
||||
HID_APPLE_TOUCHBAR = module;
|
||||
HID_SENSOR_ALS = module;
|
||||
SND_PCM = module;
|
||||
STAGING = yes;
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
{ pkgs, fetchFromGitHub, rustPlatform, ... }:
|
||||
|
||||
let
|
||||
repo = fetchFromGitHub {
|
||||
owner = "kekrby";
|
||||
repo = "tiny-dfr";
|
||||
rev = "8a5d413cb1dbe2a25b77a9e7f3cb5b9c88ef3ffb";
|
||||
hash = "sha256-l4D7aePz/CYpkRorrvsgIYrvSzoZl59OGcFGJqqJftk=";
|
||||
};
|
||||
|
||||
in
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "tiny-dfr";
|
||||
version = repo.rev;
|
||||
|
||||
src = repo;
|
||||
|
||||
cargoLock.lockFile = "${src}/Cargo.lock";
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
pkg-config
|
||||
];
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
udev
|
||||
glib
|
||||
pango
|
||||
cairo
|
||||
gdk-pixbuf
|
||||
libxml2
|
||||
libinput
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace src/main.rs --replace "/usr/share/tiny-dfr/" "$out/share/tiny-dfr/"
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p $out/etc $out/share
|
||||
|
||||
cp -r etc/udev $out/etc/
|
||||
cp -r share/tiny-dfr $out/share/
|
||||
'';
|
||||
|
||||
meta = with pkgs.lib; {
|
||||
description = "The most basic dynamic function row daemon possible";
|
||||
homepage = "https://github.com/kekrby/tiny-dfr";
|
||||
license = with licenses; [ asl20 bsd3 cc0 isc lgpl21Plus mit mpl20 unicode-dfs-2016 asl20 asl20-llvm mit unlicense ];
|
||||
maintainers = [];
|
||||
};
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
# ASUS TUF A15 FA507NV
|
||||
As Nvidia offload is not available for AMD CPU, nvidia prime is using sync. Additionally the kernel is set to the latest stable release(using boot.kernelPackages = pkgs.linuxPackages_latest) as the keyboard and wireless drivers does not work in the default NixOS kernel which is the LTS kernel.
|
|
@ -0,0 +1,21 @@
|
|||
{ lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../../common/cpu/amd
|
||||
../../common/cpu/amd/raphael/igpu.nix
|
||||
../../common/cpu/amd/pstate.nix
|
||||
../../common/gpu/nvidia
|
||||
../../common/gpu/nvidia/prime-sync.nix
|
||||
../../common/hidpi.nix
|
||||
../../common/pc/laptop
|
||||
../../common/pc/ssd
|
||||
];
|
||||
|
||||
boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.6") pkgs.linuxPackages_latest;
|
||||
|
||||
hardware.nvidia.prime = {
|
||||
amdgpuBusId = "PCI:54:0:0";
|
||||
nvidiaBusId = "PCI:1:0:0";
|
||||
};
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
= ASUS Pro WS X570-ACE =
|
||||
|
||||
== Firmware issues ==
|
||||
|
||||
=== BIOS ===
|
||||
|
||||
BIOS version 4805 (and possibly older) has broken <code>X2APIC</code> mode, which in turn breaks <code>amd-pstate</code> support.
|
||||
Other possible config values for <code>APIC</code> are <code>Compatibility</code>, <code>Auto</code> and <code>XAPIC</code>; best results were observed with <code>XAPIC</code>.
|
||||
|
||||
This is the error in dmesg when <code>X2APIC</code> is enabled:
|
||||
|
||||
<code>
|
||||
amd_pstate: the _CPC object is not present in SBIOS or ACPI disabled
|
||||
</code>
|
||||
|
||||
=== IPMI ===
|
||||
|
||||
The IPMI is half-baked and for the most part unusable in a pure Linux environment, see https://forum.level1techs.com/t/remote-management-on-the-asus-pro-ws-x570-ace-under-linux
|
||||
|
||||
== Firmware features ==
|
||||
|
||||
=== IOMMU ===
|
||||
|
||||
The groups are great, it's a good board for VFIO.
|
||||
|
||||
=== ECC Memory ===
|
||||
|
||||
As stated on the product page, it works; explicitly enabling in BIOS might be required.
|
||||
Tested with <code>M391A2K43BB1-CTD</code>.
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
imports = [
|
||||
../../common/pc
|
||||
../../common/pc/ssd
|
||||
../../common/cpu/amd/pstate.nix
|
||||
];
|
||||
|
||||
boot.kernelModules = [
|
||||
# Nuvoton NCT6798D - temperature, voltage and RPM
|
||||
"nct6775"
|
||||
|
||||
# a single "temp1" sensor, always at "+31.9°C"
|
||||
# commented because it's not useful, but left here for reference
|
||||
# Bus `SMBus PIIX4 adapter port 1 at 0b20'
|
||||
# Busdriver `i2c_piix4', I2C address 0x4f
|
||||
# Chip `ds75'
|
||||
# "lm75"
|
||||
];
|
||||
}
|
|
@ -1,15 +1,26 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
boot.initrd.kernelModules = [ "i915" ];
|
||||
|
||||
environment.variables = {
|
||||
VDPAU_DRIVER = lib.mkIf config.hardware.opengl.enable (lib.mkDefault "va_gl");
|
||||
options.hardware.intelgpu.loadInInitrd = lib.mkEnableOption (lib.mdDoc
|
||||
"loading `i195` kernelModule at stage 1. (Add `i915` to `boot.initrd.kernelModules`)"
|
||||
) // {
|
||||
default = true;
|
||||
};
|
||||
|
||||
hardware.opengl.extraPackages = with pkgs; [
|
||||
(if (lib.versionOlder (lib.versions.majorMinor lib.version) "23.11") then vaapiIntel else intel-vaapi-driver)
|
||||
libvdpau-va-gl
|
||||
intel-media-driver
|
||||
config = lib.mkMerge [
|
||||
(lib.mkIf config.hardware.intelgpu.loadInInitrd {
|
||||
boot.initrd.kernelModules = [ "i915" ];
|
||||
})
|
||||
{
|
||||
environment.variables = {
|
||||
VDPAU_DRIVER = lib.mkIf config.hardware.opengl.enable (lib.mkDefault "va_gl");
|
||||
};
|
||||
|
||||
hardware.opengl.extraPackages = with pkgs; [
|
||||
(if (lib.versionOlder (lib.versions.majorMinor lib.version) "23.11") then vaapiIntel else intel-vaapi-driver)
|
||||
libvdpau-va-gl
|
||||
intel-media-driver
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
{ lib, config, ... }:
|
||||
|
||||
{
|
||||
imports = [ ./. ];
|
||||
|
||||
hardware.nvidia.prime = {
|
||||
# For people who want to use sync instead of offload. Especially for AMD CPU users
|
||||
sync.enable = lib.mkOverride 990 true;
|
||||
};
|
||||
}
|
|
@ -4,6 +4,4 @@
|
|||
boot.blacklistedKernelModules = lib.optionals (!config.hardware.enableRedistributableFirmware) [
|
||||
"ath3k"
|
||||
];
|
||||
|
||||
services.xserver.libinput.enable = lib.mkDefault true;
|
||||
}
|
||||
|
|
11
flake.nix
11
flake.nix
|
@ -13,11 +13,14 @@
|
|||
apple-macbook-pro-11-5 = import ./apple/macbook-pro/11-5;
|
||||
apple-macbook-pro-12-1 = import ./apple/macbook-pro/12-1;
|
||||
apple-macbook-pro-14-1 = import ./apple/macbook-pro/14-1;
|
||||
apple-macmini-4-1 = import ./apple/macmini/4;
|
||||
apple-t2 = import ./apple/t2;
|
||||
asus-battery = import ./asus/battery.nix;
|
||||
asus-ally-rc71l = import ./asus/ally/rc71l;
|
||||
asus-fx504gd = import ./asus/fx504gd;
|
||||
asus-fa507nv = import ./asus/fa507nv;
|
||||
asus-fa507rm = import ./asus/fa507rm;
|
||||
asus-pro-ws-x570-ace = import ./asus/pro-ws-x570-ace;
|
||||
asus-rog-strix-g513im = import ./asus/rog-strix/g513im;
|
||||
asus-rog-strix-g733qs = import ./asus/rog-strix/g733qs;
|
||||
asus-zephyrus-ga401 = import ./asus/zephyrus/ga401;
|
||||
|
@ -76,6 +79,7 @@
|
|||
framework-12th-gen-intel = import ./framework/13-inch/12th-gen-intel;
|
||||
framework-13th-gen-intel = import ./framework/13-inch/13th-gen-intel;
|
||||
framework-13-7040-amd = import ./framework/13-inch/7040-amd;
|
||||
framework-16-7040-amd = import ./framework/16-inch/cpu/7040-amd;
|
||||
friendlyarm-nanopc-t4 = import ./friendlyarm/nanopc-t4;
|
||||
friendlyarm-nanopi-r5s = import ./friendlyarm/nanopi-r5s;
|
||||
focus-m2-gen1 = import ./focus/m2/gen1;
|
||||
|
@ -86,6 +90,7 @@
|
|||
gpd-win-2 = import ./gpd/win-2;
|
||||
gpd-win-max-2-2023 = import ./gpd/win-max-2/2023;
|
||||
hp-elitebook-2560p = import ./hp/elitebook/2560p;
|
||||
hp-elitebook-830g6 = import ./hp/elitebook/830/g6;
|
||||
hp-elitebook-845g7 = import ./hp/elitebook/845/g7;
|
||||
hp-elitebook-845g8 = import ./hp/elitebook/845/g8;
|
||||
hp-elitebook-845g9 = import ./hp/elitebook/845/g9;
|
||||
|
@ -175,7 +180,8 @@
|
|||
lenovo-thinkpad-x280 = import ./lenovo/thinkpad/x280;
|
||||
lenovo-thinkpad-x390 = import ./lenovo/thinkpad/x390;
|
||||
lenovo-thinkpad-z = import ./lenovo/thinkpad/z;
|
||||
lenovo-thinkpad-z13 = import ./lenovo/thinkpad/z/z13;
|
||||
lenovo-thinkpad-z13-gen1 = import ./lenovo/thinkpad/z/gen1/z13;
|
||||
lenovo-thinkpad-z13-gen2 = import ./lenovo/thinkpad/z/gen2/z13;
|
||||
lenovo-yoga-6-13ALC6 = import ./lenovo/yoga/6/13ALC6;
|
||||
lenovo-yoga-7-14ARH7 = import ./lenovo/yoga/7/14ARH7;
|
||||
lenovo-yoga-7-slim-gen8 = import ./lenovo/yoga/7/slim/gen8;
|
||||
|
@ -186,6 +192,7 @@
|
|||
microsoft-surface-laptop-amd = import ./microsoft/surface/surface-laptop-amd;
|
||||
microsoft-surface-common = import ./microsoft/surface/common;
|
||||
microsoft-surface-pro-3 = import ./microsoft/surface-pro/3;
|
||||
milkv-pioneer = import ./milkv/pioneer;
|
||||
morefine-m600 = import ./morefine/m600;
|
||||
msi-b350-tomahawk = import ./msi/b350-tomahawk;
|
||||
msi-b550-a-pro = import ./msi/b550-a-pro;
|
||||
|
@ -226,6 +233,7 @@
|
|||
toshiba-swanky = import ./toshiba/swanky;
|
||||
tuxedo-infinitybook-v4 = import ./tuxedo/infinitybook/v4;
|
||||
tuxedo-infinitybook-pro14-gen7 = import ./tuxedo/infinitybook/pro14/gen7;
|
||||
tuxedo-pulse-14-gen3 = import ./tuxedo/pulse/14/gen3;
|
||||
tuxedo-pulse-15-gen2 = import ./tuxedo/pulse/15/gen2;
|
||||
|
||||
common-cpu-amd = import ./common/cpu/amd;
|
||||
|
@ -242,6 +250,7 @@
|
|||
common-gpu-intel = import ./common/gpu/intel;
|
||||
common-gpu-intel-disable = import ./common/gpu/intel/disable.nix;
|
||||
common-gpu-nvidia = import ./common/gpu/nvidia/prime.nix;
|
||||
common-gpu-nvidia-sync = import ./common/gpu/nvidia/prime-sync.nix;
|
||||
common-gpu-nvidia-nonprime = import ./common/gpu/nvidia;
|
||||
common-gpu-nvidia-disable = import ./common/gpu/nvidia/disable.nix;
|
||||
common-hidpi = import ./common/hidpi.nix;
|
||||
|
|
|
@ -1,52 +1,62 @@
|
|||
{ lib, pkgs, ... }: {
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
../common
|
||||
../common/intel.nix
|
||||
];
|
||||
|
||||
boot.kernelParams = [
|
||||
# For Power consumption
|
||||
# https://kvark.github.io/linux/framework/2021/10/17/framework-nixos.html
|
||||
"mem_sleep_default=deep"
|
||||
# Workaround iGPU hangs
|
||||
# https://discourse.nixos.org/t/intel-12th-gen-igpu-freezes/21768/4
|
||||
"i915.enable_psr=1"
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
hardware.intelgpu.loadInInitrd = lib.versionOlder config.boot.kernelPackages.kernel.version "6.2";
|
||||
}
|
||||
# https://community.frame.work/t/tracking-hard-freezing-on-fedora-36-with-the-new-12th-gen-system/20675/391
|
||||
(lib.mkIf (lib.versionOlder config.boot.kernelPackages.kernel.version "6.2") {
|
||||
boot.kernelParams = [
|
||||
# Workaround iGPU hangs
|
||||
# https://discourse.nixos.org/t/intel-12th-gen-igpu-freezes/21768/4
|
||||
"i915.enable_psr=1"
|
||||
];
|
||||
})
|
||||
(lib.mkIf (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") {
|
||||
boot.blacklistedKernelModules = [
|
||||
# This enables the brightness and airplane mode keys to work
|
||||
# https://community.frame.work/t/12th-gen-not-sending-xf86monbrightnessup-down/20605/11
|
||||
"hid-sensor-hub"
|
||||
# This fixes controller crashes during sleep
|
||||
# https://community.frame.work/t/tracking-fn-key-stops-working-on-popos-after-a-while/21208/32
|
||||
(lib.mkIf (config.hardware.framework.enableKmod == false) "cros_ec_lpcs")
|
||||
];
|
||||
|
||||
boot.kernelParams = [
|
||||
# For Power consumption
|
||||
# https://kvark.github.io/linux/framework/2021/10/17/framework-nixos.html
|
||||
# Update 04/2024: Combined with acpi_osi from framework-intel it increases the idle power-usage in my test (SebTM)
|
||||
# (see: https://github.com/NixOS/nixos-hardware/pull/903#issuecomment-2068146658)
|
||||
"mem_sleep_default=deep"
|
||||
];
|
||||
|
||||
# Further tweak to ensure the brightness and airplane mode keys work
|
||||
# https://community.frame.work/t/responded-12th-gen-not-sending-xf86monbrightnessup-down/20605/67
|
||||
systemd.services.bind-keys-driver = {
|
||||
description = "Bind brightness and airplane mode keys to their driver";
|
||||
wantedBy = [ "default.target" ];
|
||||
after = [ "network.target" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "root";
|
||||
};
|
||||
script = ''
|
||||
ls -lad /sys/bus/i2c/devices/i2c-*:* /sys/bus/i2c/drivers/i2c_hid_acpi/i2c-*:*
|
||||
if [ -e /sys/bus/i2c/devices/i2c-FRMW0001:00 -a ! -e /sys/bus/i2c/drivers/i2c_hid_acpi/i2c-FRMW0001:00 ]; then
|
||||
echo fixing
|
||||
echo i2c-FRMW0001:00 > /sys/bus/i2c/drivers/i2c_hid_acpi/bind
|
||||
ls -lad /sys/bus/i2c/devices/i2c-*:* /sys/bus/i2c/drivers/i2c_hid_acpi/i2c-*:*
|
||||
echo done
|
||||
else
|
||||
echo no fix needed
|
||||
fi
|
||||
'';
|
||||
};
|
||||
})
|
||||
];
|
||||
|
||||
boot.blacklistedKernelModules = [
|
||||
# This enables the brightness and airplane mode keys to work
|
||||
# https://community.frame.work/t/12th-gen-not-sending-xf86monbrightnessup-down/20605/11
|
||||
"hid-sensor-hub"
|
||||
# This fixes controller crashes during sleep
|
||||
# https://community.frame.work/t/tracking-fn-key-stops-working-on-popos-after-a-while/21208/32
|
||||
"cros_ec_lpcs"
|
||||
];
|
||||
|
||||
# Further tweak to ensure the brightness and airplane mode keys work
|
||||
# https://community.frame.work/t/responded-12th-gen-not-sending-xf86monbrightnessup-down/20605/67
|
||||
systemd.services.bind-keys-driver = {
|
||||
description = "Bind brightness and airplane mode keys to their driver";
|
||||
wantedBy = [ "default.target" ];
|
||||
after = [ "network.target" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "root";
|
||||
};
|
||||
script = ''
|
||||
ls -lad /sys/bus/i2c/devices/i2c-*:* /sys/bus/i2c/drivers/i2c_hid_acpi/i2c-*:*
|
||||
if [ -e /sys/bus/i2c/devices/i2c-FRMW0001:00 -a ! -e /sys/bus/i2c/drivers/i2c_hid_acpi/i2c-FRMW0001:00 ]; then
|
||||
echo fixing
|
||||
echo i2c-FRMW0001:00 > /sys/bus/i2c/drivers/i2c_hid_acpi/bind
|
||||
ls -lad /sys/bus/i2c/devices/i2c-*:* /sys/bus/i2c/drivers/i2c_hid_acpi/i2c-*:*
|
||||
echo done
|
||||
else
|
||||
echo no fix needed
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
# Alder Lake CPUs benefit from kernel 5.18 for ThreadDirector
|
||||
# https://www.tomshardware.com/news/intel-thread-director-coming-to-linux-5-18
|
||||
boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.18") (lib.mkDefault pkgs.linuxPackages_latest);
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
imports = [
|
||||
../../../common/pc/laptop
|
||||
../../../common/pc/laptop/ssd
|
||||
../../kmod.nix
|
||||
];
|
||||
|
||||
# Fix TRRS headphones missing a mic
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
{ lib, pkgs, ... }: {
|
||||
{ config, lib, pkgs, ... }: {
|
||||
imports = [
|
||||
../../../common/cpu/intel
|
||||
];
|
||||
|
||||
boot.kernelParams = [
|
||||
# Fixes a regression in s2idle, making it more power efficient than deep sleep
|
||||
"acpi_osi=\"!Windows 2020\""
|
||||
boot.kernelParams = [
|
||||
# For Power consumption
|
||||
# https://community.frame.work/t/linux-battery-life-tuning/6665/156
|
||||
"nvme.noacpi=1"
|
||||
];
|
||||
]
|
||||
# Fixes a regression in s2idle, making it more power efficient than deep sleep
|
||||
# Update 04/2024: It appears that s2idle-regression got fixed in newer kernel-versions (SebTM)
|
||||
# (see: https://github.com/NixOS/nixos-hardware/pull/903#discussion_r1556096657)
|
||||
++ lib.lists.optional (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") "acpi_osi=\"!Windows 2020\"";
|
||||
|
||||
# Requires at least 5.16 for working wi-fi and bluetooth.
|
||||
# https://community.frame.work/t/using-the-ax210-with-linux-on-the-framework-laptop/1844/89
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
# [Framework Laptop 16](https://frame.work/)
|
||||
|
||||
## Updating Firmware
|
||||
The Framework Laptop 16 uses LVFS, so it can be updated via fwupd; see https://wiki.nixos.org/wiki/Fwupd for details
|
|
@ -0,0 +1,10 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../common
|
||||
../common/amd.nix
|
||||
../../../../common/cpu/amd/raphael/igpu.nix
|
||||
];
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
{ lib, config, ... }: {
|
||||
imports = [
|
||||
../../../../common/cpu/amd
|
||||
../../../../common/cpu/amd/pstate.nix
|
||||
../../../../common/gpu/amd
|
||||
];
|
||||
|
||||
# Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/20231106162310.85711-1-mario.limonciello@amd.com/
|
||||
boot.kernelParams = lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") ["rtc_cmos.use_acpi_alarm=1"] ;
|
||||
|
||||
# AMD has better battery life with PPD over TLP:
|
||||
# https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13
|
||||
services.power-profiles-daemon.enable = lib.mkDefault true;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
{ lib, pkgs, ... }: {
|
||||
imports = [
|
||||
../../../../common/pc/laptop
|
||||
../../../../common/pc/laptop/ssd
|
||||
];
|
||||
|
||||
# Fix TRRS headphones missing a mic
|
||||
# https://community.frame.work/t/headset-microphone-on-linux/12387/3
|
||||
boot.extraModprobeConfig = lib.mkIf (lib.versionOlder pkgs.linux.version "6.6.8") ''
|
||||
options snd-hda-intel model=dell-headset-multi
|
||||
'';
|
||||
|
||||
# For fingerprint support
|
||||
services.fprintd.enable = lib.mkDefault true;
|
||||
|
||||
# Custom udev rules
|
||||
services.udev.extraRules = ''
|
||||
# Ethernet expansion card support
|
||||
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0bda", ATTR{idProduct}=="8156", ATTR{power/autosuspend}="20"
|
||||
'';
|
||||
|
||||
# Needed for desktop environments to detect/manage display brightness
|
||||
hardware.sensor.iio.enable = lib.mkDefault true;
|
||||
|
||||
# Enable keyboard customization
|
||||
hardware.keyboard.qmk.enable = lib.mkDefault true;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
{ config, lib, ... }:
|
||||
{
|
||||
options.hardware.framework.enableKmod = lib.mkEnableOption (lib.mdDoc
|
||||
"Enable the community created Framework kernel module that allows interacting with the embedded controller from sysfs."
|
||||
) // {
|
||||
# Enable by default if on new enough version of NixOS
|
||||
default = (lib.versionAtLeast (lib.versions.majorMinor lib.version) "24.05");
|
||||
};
|
||||
|
||||
config = lib.mkIf config.hardware.framework.enableKmod {
|
||||
boot.extraModulePackages = with config.boot.kernelPackages; [
|
||||
framework-laptop-kmod
|
||||
];
|
||||
# https://github.com/DHowett/framework-laptop-kmod?tab=readme-ov-file#usage
|
||||
boot.kernelModules = [ "cros_ec" "cros_ec_lpcs" ];
|
||||
};
|
||||
}
|
|
@ -4,7 +4,7 @@ This document on how I configure [NixOS](https://nixos.org/) on [NanoPC-T4](http
|
|||
|
||||
# Installation
|
||||
|
||||
To install NixOS on you can follow the [official instructions](https://nixos.wiki/wiki/NixOS_on_ARM/NanoPC-T4) and use the [pre-built images](https://github.com/tmountain/arch-nanopct4/tree/main/images/) from @tmountain. You can also build the U-Boot image yourself from `nixpkgs` based on changes added in [#111034](https://github.com/NixOS/nixpkgs/pull/111034).
|
||||
To install NixOS on you can follow the [official instructions](https://wiki.nixos.org/wiki/NixOS_on_ARM/NanoPC-T4) and use the [pre-built images](https://github.com/tmountain/arch-nanopct4/tree/main/images/) from @tmountain. You can also build the U-Boot image yourself from `nixpkgs` based on changes added in [#111034](https://github.com/NixOS/nixpkgs/pull/111034).
|
||||
|
||||
## NixOS on NVMe with ZFS
|
||||
|
||||
|
@ -62,7 +62,7 @@ A reader using `CP2102` chip did not work but `FT232RL` works fine:
|
|||
|
||||
You can use `minicom` or `picocom` to connect:
|
||||
```
|
||||
sudo minicom -b 1500000 -D /dev/ttyUSB0
|
||||
sudo minicom -b 1500000 -D /dev/ttyUSB0
|
||||
sudo picocom -b 1500000 /dev/ttyUSB0
|
||||
```
|
||||
But you'll need to disable flow control with `Ctrl-A x`.
|
||||
|
|
|
@ -3,10 +3,9 @@ with lib;
|
|||
{
|
||||
config = {
|
||||
# Wifi can't connect if rand mac address is used
|
||||
networking.networkmanager.extraConfig = concatStringsSep "\n" [
|
||||
"[device]"
|
||||
"match-device=driver:iwlwifi"
|
||||
"wifi.scan-rand-mac-address=no"
|
||||
];
|
||||
networking.networkmanager.settings.device = {
|
||||
match-device = "driver:iwlwifi";
|
||||
wifi.scan-rand-mac-address = "no";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
# HP Elitebook 830 G6
|
||||
|
||||
## solved problems
|
||||
* KDE Plasma 5 (haven't tested others), ~20% of the time freezes at login screen on resume - setting hardare.enableAllFirmware seems to fix
|
||||
|
||||
## Unsolved Problems
|
||||
|
||||
* sometimes fails to sleep (seems to be an application causing it, so probably not a driver/kernel problem)
|
|
@ -0,0 +1,26 @@
|
|||
{ pkgs, lib, ... }:
|
||||
{
|
||||
imports = [
|
||||
../../../../common/cpu/intel
|
||||
../../../../common/pc/laptop
|
||||
../../../../common/pc/laptop/acpi_call.nix
|
||||
../../../../common/pc/laptop/ssd
|
||||
];
|
||||
|
||||
# Needed for wifi
|
||||
hardware.enableRedistributableFirmware = lib.mkDefault true;
|
||||
|
||||
# Cooling management
|
||||
services.thermald.enable = lib.mkDefault true;
|
||||
|
||||
# Allows for updating firmware via `fwupdmgr`.
|
||||
services.fwupd.enable = lib.mkDefault true;
|
||||
|
||||
# Enables ACPI platform profiles
|
||||
boot = lib.mkIf (lib.versionAtLeast pkgs.linux.version "6.1") {
|
||||
kernelModules = [ "hp-wmi" ];
|
||||
};
|
||||
|
||||
# reduces warnings/errors in boot log, seems to eliminate the ocassional boot hangs described in readme
|
||||
hardware.enableAllFirmware = lib.mkDefault true;
|
||||
}
|
|
@ -7,17 +7,14 @@
|
|||
../../../common/pc/laptop
|
||||
../../../common/pc/laptop/acpi_call.nix
|
||||
../../../common/pc/laptop/ssd
|
||||
../../../common/hidpi.nix # can be dropped after nixos 23.05
|
||||
];
|
||||
# kernel versions prior to 5.18 won't boot
|
||||
boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.18") (lib.mkDefault pkgs.linuxPackages_latest);
|
||||
|
||||
hardware.enableRedistributableFirmware = lib.mkDefault true;
|
||||
hardware.trackpoint.device = lib.mkDefault "TPPS/2 Elan TrackPoint";
|
||||
|
||||
services.fprintd.enable = lib.mkDefault true;
|
||||
|
||||
# kernel versions below 6.0 don't contain ACPI suspend2idle drivers for the Z13s AMD hardware
|
||||
# kernel versions below 6.0 don’t contain ACPI suspend2idle drivers for the Z-series’ AMD hardware
|
||||
# my Z13 froze after waking up from suspend/ hibernate
|
||||
services.logind.lidSwitch = lib.mkIf (lib.versionOlder pkgs.linux.version "6.00") (lib.mkDefault "lock");
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
{ lib, pkgs, ... }: {
|
||||
imports = [
|
||||
../../../../lenovo/thinkpad/z
|
||||
];
|
||||
|
||||
# Kernel 5.18 is required for the Ryzen 6000 series
|
||||
boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.18") (lib.mkDefault pkgs.linuxPackages_latest);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
imports = [
|
||||
../../../../../lenovo/thinkpad/z/gen1
|
||||
];
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
{ lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../../../../lenovo/thinkpad/z
|
||||
];
|
||||
|
||||
# Kernel 6.4 is required for the Ryzen 7040 series
|
||||
boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.4") (lib.mkDefault pkgs.linuxPackages_latest);
|
||||
|
||||
systemd.services = {
|
||||
# Modified from Arch Wiki
|
||||
"touchpad-fix" = {
|
||||
enable = lib.mkDefault true;
|
||||
description = "I2C HID devices can fail to initialize so try to reload";
|
||||
unitConfig = {
|
||||
Type = "oneshot";
|
||||
};
|
||||
serviceConfig = {
|
||||
User = "root";
|
||||
};
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "multi-user.target" ];
|
||||
script = ''
|
||||
count=0
|
||||
while true; do
|
||||
${lib.getExe pkgs.libinput} list-devices | ${lib.getExe pkgs.gnugrep} --quiet SNSL && break
|
||||
count=$((count + 1))
|
||||
|
||||
if test $count -ge 5; then
|
||||
echo "Touchpad not read after $count attempts"
|
||||
break
|
||||
fi
|
||||
|
||||
echo "Touchpad not ready; attempt $count to reload"
|
||||
${pkgs.kmod}/bin/rmmod i2c_hid_acpi
|
||||
${pkgs.kmod}/bin/modprobe i2c_hid_acpi
|
||||
|
||||
sleep $((2 + (count * 3)))
|
||||
done
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
{ pkgs, lib, ...}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../../../../../lenovo/thinkpad/z/gen2
|
||||
];
|
||||
|
||||
sound.extraConfig = ''
|
||||
pcm.!default {
|
||||
type plug
|
||||
slave.pcm "hw:1,0"
|
||||
}
|
||||
|
||||
ctl.!default {
|
||||
type hw
|
||||
card 1
|
||||
}
|
||||
'';
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
imports = [
|
||||
../../../../lenovo/thinkpad/z
|
||||
];
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
assertions = [
|
||||
{
|
||||
assertion = true;
|
||||
message = ''
|
||||
Lenovo Z-series received a second generation so the hardware configuration has been split by generation. For the Z13 Gen 1 config, change from `lenovo-thinkpad-z13` to `lenovo-thinkpad-z13-gen1`.
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
|
@ -5,7 +5,7 @@ let
|
|||
|
||||
in {
|
||||
imports = [
|
||||
./linux-6.6.x
|
||||
./linux-6.8.x
|
||||
];
|
||||
|
||||
options.microsoft-surface.kernelVersion = mkOption {
|
||||
|
|
|
@ -7,14 +7,14 @@ let
|
|||
|
||||
cfg = config.microsoft-surface;
|
||||
|
||||
version = "6.6.13";
|
||||
version = "6.8.6";
|
||||
kernelPatches = surfacePatches {
|
||||
inherit version;
|
||||
patchFn = ./patches.nix;
|
||||
};
|
||||
kernelPackages = linuxPackage {
|
||||
inherit version kernelPatches;
|
||||
sha256 = "sha256-iLiefdQerU46seQRyLuNWSV1rPgVzx3zwNxX4uiCwLw=";
|
||||
sha256 = "sha256-nnIyMtYDq0Xr8EPDRxTEjyd6sZXCmry4Ry8qTDpaGZU=";
|
||||
ignoreConfigErrors=true;
|
||||
};
|
||||
|
|
@ -4,8 +4,8 @@
|
|||
linux-surface = fetchFromGitHub {
|
||||
owner = "linux-surface";
|
||||
repo = "linux-surface";
|
||||
rev = "arch-6.6.6-1";
|
||||
hash = "sha256-0pP/A0XllR/iheIBEBwEApaXpyFYzsnGZ+wdm4w5Jjg=";
|
||||
rev = "arch-6.8.6-1";
|
||||
hash = "sha256-kLnHcYFeQ7/8lbSL4p9D2aC4V/Ib1tU225UOkRcNnH4=";
|
||||
};
|
||||
|
||||
# This is the owner and repo for the pre-patched kernel from the "linux-surface" project:
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
# Creating an installation SD card image
|
||||
|
||||
Create and customize a `flake.nix` file:
|
||||
|
||||
```nix
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
nixos-hardware.url = "github:nixos/nixos-hardware";
|
||||
};
|
||||
|
||||
outputs = { nixpkgs, nixos-hardware, ... }:
|
||||
let
|
||||
supportedSystems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"riscv64-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
forAllSupportedSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||
in
|
||||
{
|
||||
packages = forAllSupportedSystems (system: rec {
|
||||
default = sd-image;
|
||||
sd-image = (import "${nixpkgs}/nixos" {
|
||||
configuration = {
|
||||
imports = [
|
||||
"${nixos-hardware}/milkv/pioneer/sd-image-installer.nix"
|
||||
];
|
||||
|
||||
nixpkgs.buildPlatform.system = system;
|
||||
nixpkgs.hostPlatform.system = "riscv64-linux";
|
||||
|
||||
system.stateVersion = "24.05";
|
||||
};
|
||||
inherit system;
|
||||
}).config.system.build.sdImage;
|
||||
});
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Then build the image by running `nix build .#` in the same folder.
|
||||
|
||||
# Known issues
|
||||
|
||||
LinuxBoot will not output the boot menu on the serial console, only on the graphical console.
|
||||
Unfortuately, it might also pick up boot options from other devices, e.g. an nvme or sata drive.
|
||||
It might end up booting by default from those instead of booting from the SD card.
|
|
@ -0,0 +1,28 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
boot = {
|
||||
consoleLogLevel = lib.mkDefault 7;
|
||||
initrd = {
|
||||
availableKernelModules = [
|
||||
"amdgpu"
|
||||
"radeon"
|
||||
"mmc_block"
|
||||
"sdhci_sophgo"
|
||||
];
|
||||
};
|
||||
kernelPackages = pkgs.linuxPackagesFor (pkgs.callPackage ./linux.nix {
|
||||
inherit (config.boot) kernelPatches;
|
||||
});
|
||||
kernelParams = lib.mkDefault [
|
||||
"earlycon"
|
||||
"console=ttyS0,115200"
|
||||
"console=tty1"
|
||||
];
|
||||
};
|
||||
|
||||
hardware.deviceTree = {
|
||||
enable = true;
|
||||
name = lib.mkDefault "sophgo/mango-milkv-pioneer.dtb";
|
||||
};
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{ fetchurl, ... }:
|
||||
|
||||
# Download the vendor's Firmware Image Package
|
||||
fetchurl {
|
||||
url = "https://github.com/sophgo/bootloader-riscv/raw/3f750677e0249ff549ad3fe20bbc800998503539/firmware/fip.bin";
|
||||
hash = "sha256-rav00Ok6+FU77lI0piQPHCaz7Tw1RSbyUal4PyeSccg=";
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
{ stdenv
|
||||
, writeText
|
||||
, opensbi
|
||||
, fip
|
||||
, zsbl
|
||||
, linuxboot-kernel
|
||||
, linuxboot-initrd
|
||||
, dtbs ? "${linuxboot-kernel}/dtbs"
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
# Configure a conf.init for linuxboot. If this is not found on the sdcard,
|
||||
# zsbl will load it from spi flash even when booting from sd. That conf.ini
|
||||
# might be configured differently and thus not properly boot from sd.
|
||||
conf-ini = writeText "conf.ini" ''
|
||||
[sophgo-config]
|
||||
|
||||
[devicetree]
|
||||
name = mango-milkv-pioneer.dtb
|
||||
|
||||
[kernel]
|
||||
name = riscv64_Image
|
||||
|
||||
[firmware]
|
||||
name = fw_dynamic.bin
|
||||
|
||||
[ramfs]
|
||||
name = initrd.img
|
||||
|
||||
[eof]
|
||||
'';
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "milkv-pioneer-firmware";
|
||||
buildCommand = ''
|
||||
install -D ${conf-ini} $out/riscv64/conf.ini
|
||||
install -D ${fip} $out/fip.bin
|
||||
install -D ${zsbl} $out/zsbl.bin
|
||||
install -D ${opensbi}/share/opensbi/lp64/generic/firmware/fw_dynamic.bin $out/riscv64/
|
||||
install -D ${linuxboot-initrd}/initrd.img $out/riscv64/
|
||||
install -D ${dtbs}/sophgo/mango-milkv-pioneer.dtb $out/riscv64/
|
||||
install -D ${linuxboot-kernel}/Image $out/riscv64/riscv64_Image
|
||||
'';
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
{ buildLinux, fetchFromGitHub, kernelPatches, lib, ... } @ args:
|
||||
|
||||
let
|
||||
modDirVersion = "6.6.20";
|
||||
in
|
||||
buildLinux (args // {
|
||||
inherit kernelPatches modDirVersion;
|
||||
version = "${modDirVersion}-milkv-pioneer";
|
||||
src = fetchFromGitHub {
|
||||
owner = "sophgo";
|
||||
repo = "linux-riscv";
|
||||
rev = "caa949e3690fe8a4656313b2b56f52666fa880db";
|
||||
hash = "sha256-qJpR3KMgvP4tfPfBfQ/MiEWg/uuuxHYuACK8taKKK3E=";
|
||||
};
|
||||
|
||||
defconfig = "sophgo_mango_normal_defconfig";
|
||||
structuredExtraConfig = let inherit (lib.kernel) freeform module yes; in {
|
||||
# LinuxBoot will override the console bootparams which will result
|
||||
# in the distro kernel to be booted with e.g. console=tty1 only.
|
||||
# https://github.com/sophgo/bootloader-riscv/issues/71
|
||||
# Force output on serial console through the config. This is also
|
||||
# needed to get the forced serial-getty to be started.
|
||||
# We also list tty1 again because according to
|
||||
# https://docs.kernel.org/admin-guide/serial-console.html and
|
||||
# https://0pointer.de/blog/projects/serial-console.html
|
||||
# this will be the main console.
|
||||
CMDLINE = freeform "console=ttyS0,115200 console=tty1";
|
||||
CMDLINE_EXTEND = yes;
|
||||
|
||||
# Enable these explicitly because they are not enabled by the defconfig.
|
||||
# The all-hardware profile expects these to be built.
|
||||
VIRTIO_MENU = yes;
|
||||
VIRTIO_PCI = module;
|
||||
|
||||
# There is an i2c mcu driver (drivers/soc/sophgo/umcu) which is always
|
||||
# compiled into the kernel. Hence some of the i2c support also needs to
|
||||
# be compiled in instead of being compiled as a module.
|
||||
I2C = yes;
|
||||
I2C_CHARDEV = yes;
|
||||
I2C_DESIGNWARE_PLATFORM = yes;
|
||||
};
|
||||
|
||||
extraMeta.branch = "sg2042-dev-6.6";
|
||||
} // (args.argsOverride or { }))
|
|
@ -0,0 +1,73 @@
|
|||
{ buildPackages
|
||||
, fetchFromGitHub
|
||||
, fetchpatch
|
||||
, linux-firmware
|
||||
, buildGoModule
|
||||
, ...
|
||||
}:
|
||||
|
||||
# Based on
|
||||
# https://github.com/sophgo/bootloader-riscv/blob/e0839852d571df106db622611f4786ae17e8df0f/scripts/envsetup.sh#L809-L819
|
||||
let
|
||||
u-root = buildPackages.buildGoModule rec {
|
||||
pname = "u-root";
|
||||
version = "0.14.0";
|
||||
src = fetchFromGitHub {
|
||||
owner = "u-root";
|
||||
repo = "u-root";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-8zA3pHf45MdUcq/MA/mf0KCTxB1viHieU/oigYwIPgo=";
|
||||
};
|
||||
vendorHash = null;
|
||||
patches = [
|
||||
(fetchpatch {
|
||||
url = "https://github.com/sophgo/bootloader-riscv/commit/322c3305763872a9b88a1c85d79bca63b8fbe7a6.patch";
|
||||
hash = "sha256-l5r3DbcMqRYD5FhRBqtEIEscZAdDvjmQJE4BIAtWYWE=";
|
||||
stripLen = 1;
|
||||
})
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
cp -r . $out/src
|
||||
'';
|
||||
|
||||
# We only build the u-root binary in the build phase and the initrd in the
|
||||
# postBuild hook.
|
||||
subPackages = [ "." ];
|
||||
|
||||
# Tests time out after 10min for native riscv64 builds on the pioneer.
|
||||
doCheck = false;
|
||||
};
|
||||
in
|
||||
buildGoModule {
|
||||
name = "linuxboot-initrd";
|
||||
src = null;
|
||||
vendorHash = null;
|
||||
dontUnpack = true;
|
||||
nativeBuildInputs = [ u-root ];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
pushd ${u-root}/src
|
||||
mkdir -p $out
|
||||
GOROOT="$(go env GOROOT)" u-root \
|
||||
-build bb \
|
||||
-uinitcmd=boot \
|
||||
-files "${linux-firmware}/lib/firmware/amdgpu/:lib/firmware/amdgpu/" \
|
||||
-files "${linux-firmware}/lib/firmware/radeon/:lib/firmware/radeon/" \
|
||||
-o $out/initramfs.cpio \
|
||||
core boot
|
||||
popd
|
||||
|
||||
# The vendor does not compress the initrd. We do since we include more
|
||||
# firmware files. CRC32 is required by the kernel's decompressor.
|
||||
xz --check=crc32 $out/initramfs.cpio
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mv $out/initramfs.cpio.xz $out/initrd.img
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
{ fetchFromGitHub, lib, linuxManualConfig, stdenv, ... }:
|
||||
|
||||
linuxManualConfig rec {
|
||||
inherit lib stdenv;
|
||||
modDirVersion = "6.6.20";
|
||||
version = "${modDirVersion}-milkv-pioneer";
|
||||
src = fetchFromGitHub {
|
||||
owner = "sophgo";
|
||||
repo = "linux-riscv";
|
||||
rev = "caa949e3690fe8a4656313b2b56f52666fa880db";
|
||||
hash = "sha256-qJpR3KMgvP4tfPfBfQ/MiEWg/uuuxHYuACK8taKKK3E=";
|
||||
};
|
||||
configfile = "${src}/arch/riscv/configs/sophgo_mango_normal_defconfig";
|
||||
extraMeta.branch = "sg2042-dev-6.6";
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
{ fetchFromGitHub, opensbi, ... }:
|
||||
|
||||
opensbi.overrideAttrs (attrs: {
|
||||
# Based on the vendor's sg2042-master branch.
|
||||
version = "1.4-git-a6e158f7";
|
||||
src = fetchFromGitHub {
|
||||
owner = "sophgo";
|
||||
repo = "opensbi";
|
||||
rev = "a6e158f71aab17155e2bf25a325ce4f0be51d9dd";
|
||||
hash = "sha256-5ggrEx1e53pB2+m0TBjDzDJXf2wjsQ2edu01FqqGt/Y=";
|
||||
};
|
||||
|
||||
makeFlags =
|
||||
# Based on the vendor options
|
||||
# https://github.com/sophgo/bootloader-riscv/blob/01dc52ce10e7cf489c93e4f24b6bfe1bf6e55919/scripts/envsetup.sh#L299
|
||||
attrs.makeFlags ++ [
|
||||
"PLATFORM=generic"
|
||||
"FW_PIC=y"
|
||||
"BUILD_INFO=y"
|
||||
"DEBUG=1"
|
||||
];
|
||||
})
|
|
@ -0,0 +1,12 @@
|
|||
{ modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
"${modulesPath}/profiles/installation-device.nix"
|
||||
./sd-image.nix
|
||||
];
|
||||
|
||||
# the installation media is also the installation target,
|
||||
# so we don't want to provide the installation configuration.nix.
|
||||
installer.cloneConfig = false;
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
{ config, lib, modulesPath, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (pkgs) callPackage;
|
||||
|
||||
fip = callPackage ./fip.nix { };
|
||||
zsbl = callPackage ./zsbl.nix { };
|
||||
opensbi = callPackage ./opensbi.nix { };
|
||||
linuxboot-kernel = callPackage ./linuxboot-kernel.nix { };
|
||||
linuxboot-initrd = callPackage ./linuxboot-initrd.nix { };
|
||||
dtbs = config.hardware.deviceTree.package;
|
||||
firmware = callPackage ./firmware.nix {
|
||||
inherit fip zsbl opensbi linuxboot-kernel linuxboot-initrd dtbs;
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
"${modulesPath}/profiles/base.nix"
|
||||
"${modulesPath}/installer/sd-card/sd-image.nix"
|
||||
./default.nix
|
||||
];
|
||||
|
||||
boot.loader = {
|
||||
grub.enable = lib.mkDefault false;
|
||||
generic-extlinux-compatible.enable = lib.mkDefault true;
|
||||
};
|
||||
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
|
||||
# For some reason the serial getty is not started automatically
|
||||
# even though console=ttyS0,115200 is passed to the kernel.
|
||||
# https://docs.kernel.org/admin-guide/serial-console.html
|
||||
# https://github.com/NixOS/nixpkgs/issues/84105
|
||||
systemd.services."serial-getty@ttyS0" = {
|
||||
enable = true;
|
||||
wantedBy = [ "getty.target" ];
|
||||
serviceConfig.Restart = "always";
|
||||
};
|
||||
|
||||
sdImage = {
|
||||
imageName = "${config.sdImage.imageBaseName}-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}-milkv-pioneer.img";
|
||||
|
||||
populateFirmwareCommands = ''
|
||||
mkdir -p firmware/
|
||||
cp -a ${firmware}/* firmware/
|
||||
touch firmware/BOOT
|
||||
'';
|
||||
|
||||
firmwarePartitionOffset = 1;
|
||||
firmwareSize = 128;
|
||||
|
||||
populateRootCommands = ''
|
||||
mkdir -p ./files/boot
|
||||
${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
--- a/drivers/sd/sd.c
|
||||
+++ b/drivers/sd/sd.c
|
||||
@@ -560,11 +560,11 @@ static int bm_sd_read(int lba, uintptr_t buf, size_t size)
|
||||
} else {
|
||||
udelay(1);
|
||||
timeout++;
|
||||
}
|
||||
|
||||
- if (timeout >= 10000) {
|
||||
+ if (timeout >= 100000) {
|
||||
printf("sdhci read data timeout\n");
|
||||
goto timeout;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
{ buildPackages
|
||||
, bison
|
||||
, fetchFromGitHub
|
||||
, flex
|
||||
, lib
|
||||
, stdenv
|
||||
|
||||
, ...
|
||||
}:
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "zsbl-sg2042";
|
||||
version = "git-cc806273";
|
||||
src = fetchFromGitHub {
|
||||
owner = "sophgo";
|
||||
repo = "zsbl";
|
||||
rev = "cc806273e0f679bef2f6b017c68adede1594ad31";
|
||||
hash = "sha256-zOlBM7mwz8FUM/BlzOxJmpI8LI/KcFOGXegvgiilbaM=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# Depending on the sdcard, reading larger initrds (say >= 25MB)
|
||||
# can hit the timeout.
|
||||
./zsbl-increase-timeout.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
bison
|
||||
flex
|
||||
];
|
||||
depsBuildBuild = [
|
||||
buildPackages.stdenv.cc
|
||||
];
|
||||
hardeningDisable = [
|
||||
"fortify"
|
||||
"stackprotector"
|
||||
];
|
||||
|
||||
makeFlags = [
|
||||
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
|
||||
];
|
||||
configurePhase = "make sg2042_defconfig";
|
||||
installPhase = "install -D zsbl.bin $out";
|
||||
enableParallelBuilding = true;
|
||||
dontStrip = true;
|
||||
|
||||
meta = {
|
||||
homepage = "https://github.com/sophgo/zsbl";
|
||||
description = "Sophgo RISC-V Zero Stage Boot Loader";
|
||||
license = lib.licenses.gpl2;
|
||||
};
|
||||
}
|
|
@ -6,4 +6,8 @@
|
|||
boot.initrd.kernelModules = [
|
||||
"sdhci_pci" # 16G eMMC on board
|
||||
];
|
||||
|
||||
boot.kernelModules = [
|
||||
"it87" # ITE IT8786E Super IO Sensors
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,29 +1,9 @@
|
|||
{ lib
|
||||
, fetchFromGitHub
|
||||
, buildUBoot
|
||||
, buildPackages
|
||||
{ buildUBoot
|
||||
, opensbi
|
||||
}:
|
||||
|
||||
buildUBoot rec {
|
||||
version = "2024.01";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "u-boot";
|
||||
repo = "u-boot";
|
||||
rev = "refs/tags/v${version}";
|
||||
hash = "sha256-0Da7Czy9cpQ+D5EICc3/QSZhAdCBsmeMvBgykYhAQFw=";
|
||||
};
|
||||
|
||||
# workaround for https://github.com/NixOS/nixpkgs/pull/146634
|
||||
# uboot: only apply raspberry pi patches to raspberry pi builds
|
||||
patches = [ ];
|
||||
|
||||
buildUBoot {
|
||||
extraMakeFlags = [
|
||||
# workaround for https://github.com/NixOS/nixpkgs/pull/277997
|
||||
# buildUBoot: specify absolute path of dtc, fix building u-boot 2023.10+
|
||||
"DTC=${lib.getExe buildPackages.dtc}"
|
||||
|
||||
"OPENSBI=${opensbi}/share/opensbi/lp64/generic/firmware/fw_dynamic.bin"
|
||||
];
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
# TUXEDO Pulse 14 - Gen3
|
||||
|
||||
## About
|
||||
|
||||
[NixOS hardware configuration](https://github.com/NixOS/nixos-hardware) for
|
||||
[TUXEDO Pulse 14 -
|
||||
Gen3](https://www.tuxedocomputers.com/en/TUXEDO-Pulse-14-Gen3).
|
|
@ -0,0 +1,9 @@
|
|||
{pkgs, ...}: {
|
||||
imports = [
|
||||
../../../../common/cpu/amd
|
||||
../../../../common/cpu/amd/pstate.nix
|
||||
../../../../common/cpu/amd/raphael/igpu.nix
|
||||
../../../../common/pc/laptop
|
||||
../../../../common/pc/laptop/ssd
|
||||
];
|
||||
}
|
Loading…
Reference in New Issue