From b586e1051bcc2b68f3ed3fc725cbd43912ec8489 Mon Sep 17 00:00:00 2001 From: Yorick van Pelt Date: Tue, 15 May 2018 15:46:41 +0200 Subject: [PATCH 1/2] add XPS 13 (9360) --- dell/xps/13-9360/default.nix | 42 +++++++++++++++++++++++++++ dell/xps/13-9360/firmware_qca6174.nix | 22 ++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 dell/xps/13-9360/default.nix create mode 100644 dell/xps/13-9360/firmware_qca6174.nix diff --git a/dell/xps/13-9360/default.nix b/dell/xps/13-9360/default.nix new file mode 100644 index 0000000..b580a13 --- /dev/null +++ b/dell/xps/13-9360/default.nix @@ -0,0 +1,42 @@ +{ lib, pkgs, ... }: +let + firmware_qca6174 = pkgs.callPackage ./firmware_qca6174.nix {}; +in +{ + imports = [ + ../../../common/cpu/intel + ../../../common/pc/laptop + ]; + boot.kernelModules = ["kvm-intel"]; # should this be in common/cpu/intel? + boot = { + loader = { + systemd-boot.enable = lib.mkDefault true; + efi.canTouchEfiVariables = lib.mkDefault true; + }; + + kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; + initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + # touchpad goes over i2c + blacklistedKernelModules = [ "psmouse" ]; + + kernelParams = [ "i915.enable_fbc=1" "i915.enable_psr=2" ]; + }; + + # intel huc, guc. qca6174 (old?) + hardware.enableRedistributableFirmware = true; + + # 4k screen, use bigger console font + i18n.consoleFont = "latarcyrheb-sun32"; + + # touchpad + services.xserver.libinput.enable = lib.mkDefault true; + + networking.wireless.enable = lib.mkDefault true; + hardware.bluetooth.enable = lib.mkDefault true; + + services.thermald.enable = lib.mkDefault true; + + # optional: without it, firmware crashes happened + hardware.firmware = lib.mkBefore [ firmware_qca6174 ]; + +} diff --git a/dell/xps/13-9360/firmware_qca6174.nix b/dell/xps/13-9360/firmware_qca6174.nix new file mode 100644 index 0000000..c551223 --- /dev/null +++ b/dell/xps/13-9360/firmware_qca6174.nix @@ -0,0 +1,22 @@ +{ stdenv, fetchurl }: + +stdenv.mkDerivation rec { + target = "QCA6174"; + branch = "4.4.1.c1"; + version = "${branch}-00042"; + name = "${target}-firmware-${version}"; + src = fetchurl { + url = "https://github.com/kvalo/ath10k-firmware/raw/master/${target}/hw3.0/${branch}/firmware-6.bin_RM.${version}-QCARMSWP-1"; + sha256 = "01vvz3qhqw5l3yilcqgk1spk4y9k4qy7na7a57cbl037r231szdh"; + }; + buildCommand = '' + install -D $src $out/lib/firmware/ath10k/${target}/hw3.0/firmware-6.bin + ''; + meta = with stdenv.lib; { + license = with licenses; unfreeRedistributable; + homepage = "https://github.com/kvalo/ath10k-firmware/tree/master/QCA6174/hw3.0"; + description = "Updated firmware for the qca6174 wireless chip"; + platforms = with platforms; linux; + maintainers = with maintainers; [ yorickvp ]; + }; +} From 0794564c45956c1b4711b38d2a2d43d85d12cbae Mon Sep 17 00:00:00 2001 From: Yegor Timoshenko Date: Tue, 15 May 2018 19:54:18 +0300 Subject: [PATCH 2/2] dell/xps/13-9360: review --- common/cpu/intel/kaby-lake/default.nix | 8 ++++ dell/xps/13-9360/default.nix | 44 ++++++------------- ...mware_qca6174.nix => qca6174-firmware.nix} | 18 +++++--- 3 files changed, 33 insertions(+), 37 deletions(-) create mode 100644 common/cpu/intel/kaby-lake/default.nix rename dell/xps/13-9360/{firmware_qca6174.nix => qca6174-firmware.nix} (86%) diff --git a/common/cpu/intel/kaby-lake/default.nix b/common/cpu/intel/kaby-lake/default.nix new file mode 100644 index 0000000..2046cd9 --- /dev/null +++ b/common/cpu/intel/kaby-lake/default.nix @@ -0,0 +1,8 @@ +{ + imports = [ ../. ]; + + kernelParams = [ + "i915.enable_fbc=1" + "i915.enable_psr=2" + ]; +} diff --git a/dell/xps/13-9360/default.nix b/dell/xps/13-9360/default.nix index b580a13..e13e758 100644 --- a/dell/xps/13-9360/default.nix +++ b/dell/xps/13-9360/default.nix @@ -1,42 +1,26 @@ { lib, pkgs, ... }: -let - firmware_qca6174 = pkgs.callPackage ./firmware_qca6174.nix {}; -in + { imports = [ - ../../../common/cpu/intel + ../../../common/cpu/intel/kaby-lake ../../../common/pc/laptop ]; - boot.kernelModules = ["kvm-intel"]; # should this be in common/cpu/intel? - boot = { - loader = { - systemd-boot.enable = lib.mkDefault true; - efi.canTouchEfiVariables = lib.mkDefault true; - }; - kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; - initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; - # touchpad goes over i2c - blacklistedKernelModules = [ "psmouse" ]; + boot.blacklistedKernelModules = [ "psmouse" ]; # touchpad goes over i2c - kernelParams = [ "i915.enable_fbc=1" "i915.enable_psr=2" ]; + # TODO: decide on boot loader policy + boot.loader = { + efi.canTouchEfiVariables = lib.mkDefault true; + systemd-boot.enable = lib.mkDefault true; }; - # intel huc, guc. qca6174 (old?) - hardware.enableRedistributableFirmware = true; + hardware.firmware = lib.mkBefore [ pkgs.qca6174-firmware ]; - # 4k screen, use bigger console font - i18n.consoleFont = "latarcyrheb-sun32"; - - # touchpad - services.xserver.libinput.enable = lib.mkDefault true; - - networking.wireless.enable = lib.mkDefault true; - hardware.bluetooth.enable = lib.mkDefault true; - - services.thermald.enable = lib.mkDefault true; - - # optional: without it, firmware crashes happened - hardware.firmware = lib.mkBefore [ firmware_qca6174 ]; + # TODO: move to general HiDPI profile + i18n.consoleFont = lib.mkDefault "latarcyrheb-sun32"; # 4K screen, use bigger console font + # TODO: upstream to NixOS/nixpkgs + nixpkgs.overlays = [(final: previous: { + qca6174-firmware = final.callPackage ./qca6174-firmware.nix {}; + })]; } diff --git a/dell/xps/13-9360/firmware_qca6174.nix b/dell/xps/13-9360/qca6174-firmware.nix similarity index 86% rename from dell/xps/13-9360/firmware_qca6174.nix rename to dell/xps/13-9360/qca6174-firmware.nix index c551223..930107d 100644 --- a/dell/xps/13-9360/firmware_qca6174.nix +++ b/dell/xps/13-9360/qca6174-firmware.nix @@ -1,22 +1,26 @@ -{ stdenv, fetchurl }: +{ stdenv, fetchurl }: stdenv.mkDerivation rec { - target = "QCA6174"; - branch = "4.4.1.c1"; - version = "${branch}-00042"; name = "${target}-firmware-${version}"; + version = "${branch}-00042"; + + branch = "4.4.1.c1"; + target = "QCA6174"; + src = fetchurl { url = "https://github.com/kvalo/ath10k-firmware/raw/master/${target}/hw3.0/${branch}/firmware-6.bin_RM.${version}-QCARMSWP-1"; sha256 = "01vvz3qhqw5l3yilcqgk1spk4y9k4qy7na7a57cbl037r231szdh"; }; + buildCommand = '' install -D $src $out/lib/firmware/ath10k/${target}/hw3.0/firmware-6.bin ''; + meta = with stdenv.lib; { - license = with licenses; unfreeRedistributable; - homepage = "https://github.com/kvalo/ath10k-firmware/tree/master/QCA6174/hw3.0"; description = "Updated firmware for the qca6174 wireless chip"; - platforms = with platforms; linux; + homepage = "https://github.com/kvalo/ath10k-firmware/tree/master/QCA6174/hw3.0"; + license = licenses.unfreeRedistributable; maintainers = with maintainers; [ yorickvp ]; + platforms = platforms.linux; }; }