Skip to content

Instantly share code, notes, and snippets.

@p-alik
Last active January 13, 2025 15:31
Show Gist options
  • Save p-alik/6ed132ffad59de8fcbc4fb10b54d745e to your computer and use it in GitHub Desktop.
Save p-alik/6ed132ffad59de8fcbc4fb10b54d745e to your computer and use it in GitHub Desktop.
NixOS config on Dell XPS 13 Plus 9320
# /etc/nixos/configuration.nix
{ config, pkgs, ... }:
{
imports =
[
./hardware-configuration.nix
];
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "ls03064"; # Define your hostname.
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "Europe/Berlin";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "de_DE.UTF-8";
LC_IDENTIFICATION = "de_DE.UTF-8";
LC_MEASUREMENT = "de_DE.UTF-8";
LC_MONETARY = "de_DE.UTF-8";
LC_NAME = "de_DE.UTF-8";
LC_NUMERIC = "de_DE.UTF-8";
LC_PAPER = "de_DE.UTF-8";
LC_TELEPHONE = "de_DE.UTF-8";
LC_TIME = "de_DE.UTF-8";
};
# Enable the X11 windowing system.
services.xserver.enable = true;
# https://nixos.org/manual/nixos/stable/index.html#sec-x11--graphics-cards-intel
services.xserver.videoDrivers = [ "intel" ];
services.xserver.deviceSection = ''
Option "DRI" "2"
Option "TearFree" "true"
'';
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
# Configure keymap in X11
services.xserver = {
layout = "de";
xkbVariant = "";
};
console.keyMap = "de";
services.printing.enable = true;
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
# for sake of ipu6-camera-bins
nixpkgs.config.allowUnfree = true;
users.users.<USER> = {
isNormalUser = true;
description = "..";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [
home-manager
# leave browsers here for sake of camera support
firefox
google-chrome
];
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
file
glxinfo
htop
inxi
lshw
openvpn
pciutils
# https://discourse.nixos.org/t/v4l2loopback-cannot-find-module/26301/5
# obs-studio
v4l-utils
vim
];
programs.vim.defaultEditor = true;
system.stateVersion = "23.11";
}
# /etc/nixos/hardware-configuration.nix
{ config, lib, pkgs, modulesPath, ... }:
let
ivsc-firmware = with pkgs;
stdenv.mkDerivation rec {
pname = "ivsc-firmware";
version = "main";
src = pkgs.fetchFromGitHub {
owner = "intel";
repo = "ivsc-firmware";
rev = "10c214fea5560060d387fbd2fb8a1af329cb6232";
sha256 = "sha256-kEoA0yeGXuuB+jlMIhNm+SBljH+Ru7zt3PzGb+EPBPw=";
};
installPhase = ''
mkdir -p $out/lib/firmware/vsc/soc_a1_prod
cp firmware/ivsc_pkg_ovti01a0_0.bin $out/lib/firmware/vsc/soc_a1_prod/ivsc_pkg_ovti01a0_0_a1_prod.bin
cp firmware/ivsc_skucfg_ovti01a0_0_1.bin $out/lib/firmware/vsc/soc_a1_prod/ivsc_skucfg_ovti01a0_0_1_a1_prod.bin
cp firmware/ivsc_fw.bin $out/lib/firmware/vsc/soc_a1_prod/ivsc_fw_a1_prod.bin
'';
};
in
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "usbhid" "sd_mod" "i915" ];
boot.initrd.kernelModules = [];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [];
# https://discourse.nixos.org/t/i915-driver-has-bug-for-iris-xe-graphics/25006/10
# resolved: i915 0000:00:02.0: [drm] Selective fetch area calculation failed in pipe A
boot.kernelParams = [
"i915.enable_psr=0"
];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/5cfd71ea-6978-427b-9b10-75249bcc63ff";
fsType = "ext4";
};
boot.initrd.luks.devices."luks-5f6a700d-cfdb-492c-b52d-d875e818631c".device = "/dev/disk/by-uuid/5f6a700d-cfdb-492c-b52d-d875e818631c";
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/F642-A1B7";
fsType = "vfat";
};
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.enp0s13f0u1u4.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
# Tracking Issue: Intel MIPI/IPU6 webcam-support
# https://github.com/NixOS/nixpkgs/issues/225743#issuecomment-1849613797
# Infrastructure Processing Unit
hardware.ipu6 = {
enable = true;
platform = "ipu6ep";
};
hardware.enableRedistributableFirmware = true;
hardware.firmware = [
ivsc-firmware
];
# environment.etc.camera.source = "${ipu6-camera-hal}/share/defaults/etc/camera";
}
@p-alik
Copy link
Author

p-alik commented Jan 13, 2025

@AdrienLemaire, here the current state for my Dell XPS 13 Plus 9320

$ nix-info -m
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.43, NixOS, 24.05 (Uakari), 24.05.7376.b134951a4c9f`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.8`
 - channels(root): `"nixos-24.05"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

$ uname -r
6.6.43
       error: xf86videointel has been removed as the package is unmaintained and the driver is no longer functional.
       Please remove "intel" from `services.xserver.videoDrivers` and switch to the "modesetting" driver.

@p-alik
Copy link
Author

p-alik commented Jan 13, 2025

No success on 24.11 with services.xserver.videoDrivers = [ "modesetting" ]; suggested in Intel Graphics drivers {#sec-x11--graphics-cards-intel}

$ nix-info -m
 - system: `"x86_64-linux"`
 - host os: `Linux 6.12.9, NixOS, 24.11 (Vicuna), 24.11.713063.635e887b4852`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.24.11`
 - channels(root): `"nixos-24.11"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

$ uname -r
6.12.9
[   23.956291] ------------[ cut here ]------------
[   23.956294] WARNING: CPU: 11 PID: 736 at kernel/dma/mapping.c:597 dma_alloc_attrs+0x14e/0x160
[   23.956302] Modules linked in: snd_soc_rt1316_sdw(+) regmap_sdw_mbq regmap_sdw snd_soc_dmic intel_ipu6_psys(O+) snd_sof_pci_intel_tgl snd_sof_pci_intel_cnl snd_sof_intel_hda_generic soundwire_intel soundwire_cadence snd_sof_intel_hda_common xt_conntrack snd_soc_hdac_hda snd_sof_intel_hda_mlink snd_sof_intel_hda snd_sof_pci snd_sof_xtensa_dsp iwlmvm(+) ip6t_rpfilter snd_sof ipt_rpfilter intel_ipu6_isys snd_sof_utils snd_soc_acpi_intel_match hid_sensor_als hid_sensor_custom_intel_hinge videobuf2_dma_sg hid_sensor_trigger soundwire_generic_allocation snd_soc_acpi industrialio_triggered_buffer videobuf2_memops xt_pkttype soundwire_bus kfifo_buf videobuf2_v4l2 hid_sensor_iio_common xt_LOG nf_log_syslog snd_soc_avs videobuf2_common industrialio ivsc_csi(+) xt_tcpudp ivsc_ace(+) mac80211 nft_compat hid_sensor_custom snd_soc_hda_codec snd_hda_ext_core hid_sensor_hub intel_uncore_frequency snd_soc_core intel_uncore_frequency_common x86_pkg_temp_thermal intel_powerclamp nls_iso8859_1 snd_compress nls_cp437 coretemp ac97_bus ptp
[   23.956334]  crct10dif_pclmul snd_pcm_dmaengine crc32_pclmul spi_pxa2xx_platform pps_core vfat intel_ishtp_hid joydev dw_dmac polyval_clmulni typec_displayport hid_multitouch fat xe libarc4 nf_tables sch_fq_codel dw_dmac_core polyval_generic mei_vsc spi_pxa2xx_core 8250_dw snd_hda_intel snd_usb_audio ghash_clmulni_intel btusb iwlwifi snd_intel_dspcfg cmdlinepart r8153_ecm snd_intel_sdw_acpi btrtl snd_usbmidi_lib processor_thermal_device_pci rapl cdc_ether btintel snd_hda_codec snd_ump spi_nor mei_hdcp processor_thermal_device iTCO_wdt btbcm mei_pxp processor_thermal_wt_hint usbnet snd_rawmidi intel_pmc_bxt drm_gpuvm dell_pc processor_thermal_rfim tpm_crb ucsi_acpi btmtk platform_profile intel_cstate drm_exec intel_rapl_msr watchdog mtd spi_ljca i2c_ljca gpio_ljca dell_laptop v4l2loopback(O) snd_hda_core typec_ucsi gpu_sched dell_wmi cfg80211 snd_seq_device processor_thermal_rapl bluetooth intel_uncore dell_wmi_ddv dell_smm_hwmon snd_ctl_led dell_wmi_sysman firmware_attributes_class psmouse ov01a10(O) snd_hwdep
[   23.956373]  intel_rapl_common loop intel_ish_ipc intel_ipu6 mei_me igen6_edac processor_thermal_wt_req snd_pcm r8152 tpm_tis drm_suballoc_helper typec intel_ishtp i2c_i801 dell_smbios spi_intel_pci processor_thermal_power_floor cpufreq_powersave intel_lpss_pci dcdbas mii intel_lpss libphy dell_wmi_descriptor wmi_bmof snd_timer tiny_power_button spi_intel hid_jabra mousedev snd v4l2_fwnode i2c_mux xt_nat mei idma64 usb_ljca rfkill 8250_pci drm_ttm_helper ipu_bridge edac_core tpm_tis_core processor_thermal_mbox roles button battery soundcore virt_dma i2c_smbus v4l2_async nf_nat intel_skl_int3472_tps68470 mei_vsc_hw tps68470_regulator int3403_thermal i2c_hid_acpi videodev nf_conntrack clk_tps68470 int340x_thermal_zone i2c_hid intel_pmc_core nf_defrag_ipv6 intel_vsec mc nf_defrag_ipv4 pmt_telemetry intel_skl_int3472_discrete libcrc32c int3400_thermal intel_hid pmt_class acpi_thermal_rel intel_skl_int3472_common pinctrl_tigerlake acpi_tad acpi_pad evdev sparse_keymap br_netfilter mac_hid ac veth tun serio_raw tap macvlan
[   23.956413]  bridge stp llc kvm_intel kvm fuse efi_pstore configfs nfnetlink efivarfs dmi_sysfs ip_tables x_tables autofs4 ext4 crc32c_generic crc16 mbcache jbd2 dm_crypt cbc encrypted_keys trusted asn1_encoder tee tpm rng_core libaescfb ecdh_generic ecc hid_generic usbhid hid i915 input_leds i2c_algo_bit led_class drm_buddy ttm atkbd intel_gtt libps2 nvme xhci_pci crc32c_intel vivaldi_fmap drm_display_helper thunderbolt sha512_ssse3 xhci_hcd sha256_ssse3 nvme_core sha1_ssse3 aesni_intel video gf128mul crypto_simd cryptd cec nvme_auth i8042 wmi rtc_cmos serio backlight dm_mod dax
[   23.956444] CPU: 11 UID: 0 PID: 736 Comm: (udev-worker) Tainted: G     U     O       6.12.9 #1-NixOS
[   23.956447] Tainted: [U]=USER, [O]=OOT_MODULE
[   23.956448] Hardware name: Dell Inc. XPS 9320/0CW9KM, BIOS 2.14.0 07/09/2024
[   23.956450] RIP: 0010:dma_alloc_attrs+0x14e/0x160
[   23.956453] Code: ff ff 90 0f 0b 90 45 31 ff 5b 5d 4c 89 f8 41 5c 41 5d 41 5e 41 5f 31 d2 31 c9 31 f6 31 ff 45 31 c0 45 31 c9 c3 cc cc cc cc 90 <0f> 0b 90 e9 e9 fe ff ff 45 31 ff e9 1e ff ff ff 66 90 90 90 90 90
[   23.956455] RSP: 0018:ffffafcb40bb7be0 EFLAGS: 00010246
[   23.956457] RAX: 0000000000000000 RBX: ffffa37f8dc36000 RCX: 0000000000000cc0
[   23.956459] RDX: ffffa37f9392d018 RSI: 0000000000002000 RDI: ffffa37f8dc36000
[   23.956460] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
[   23.956461] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000002000
[   23.956462] R13: ffffa37f9392d018 R14: 0000000000000000 R15: ffffa37fa2222028
[   23.956464] FS:  00007fb38e453840(0000) GS:ffffa386ef780000(0000) knlGS:0000000000000000
[   23.956466] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   23.956467] CR2: 000055b0ec66b190 CR3: 0000000103c58000 CR4: 0000000000f52ef0
[   23.956469] PKRU: 55555554
[   23.956470] Call Trace:
[   23.956472]  <TASK>
[   23.956474]  ? __warn+0x89/0x130
[   23.956478]  ? dma_alloc_attrs+0x14e/0x160
[   23.956481]  ? report_bug+0x172/0x1a0
[   23.956485]  ? handle_bug+0x61/0xb0
[   23.956488]  ? exc_invalid_op+0x17/0x80
[   23.956490]  ? asm_exc_invalid_op+0x1a/0x20
[   23.956495]  ? dma_alloc_attrs+0x14e/0x160
[   23.956509]  ipu6_psys_probe+0x321/0x640 [intel_ipu6_psys]
[   23.956520]  ? __pfx_ipu6_psys_probe+0x10/0x10 [intel_ipu6_psys]
[   23.956528]  auxiliary_bus_probe+0x3f/0xa0
[   23.956532]  really_probe+0xd3/0x3a0
[   23.956535]  ? __pfx___driver_attach+0x10/0x10
[   23.956537]  __driver_probe_device+0x78/0x160
[   23.956540]  driver_probe_device+0x1f/0xa0
[   23.956543]  __driver_attach+0xea/0x1e0
[   23.956546]  bus_for_each_dev+0x89/0xe0
[   23.956548]  bus_add_driver+0x14d/0x280
[   23.956550]  driver_register+0x5d/0x120
[   23.956553]  __auxiliary_driver_register+0x72/0xf0
[   23.956556]  ? __pfx_ipu6_psys_aux_driver_init+0x10/0x10 [intel_ipu6_psys]
[   23.956563]  do_one_initcall+0x58/0x330
[   23.956568]  do_init_module+0x90/0x280
[   23.956573]  __do_sys_init_module+0x18a/0x1c0
[   23.956576]  do_syscall_64+0xb7/0x210
[   23.956579]  entry_SYSCALL_64_after_hwframe+0x77/0x7f
[   23.956582] RIP: 0033:0x7fb38df1891e
[   23.956608] Code: 48 8b 0d f5 84 0d 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 49 89 ca b8 af 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d c2 84 0d 00 f7 d8 64 89 01 48
[   23.956609] RSP: 002b:00007ffd755f77d8 EFLAGS: 00000246 ORIG_RAX: 00000000000000af
[   23.956612] RAX: ffffffffffffffda RBX: 000055fe96c6caa0 RCX: 00007fb38df1891e
[   23.956613] RDX: 00007fb38de00304 RSI: 000000000026d908 RDI: 00007fb38c1a0010
[   23.956614] RBP: 00007fb38c1a0010 R08: 0000000000000000 R09: 0000000000000000
[   23.956615] R10: 0000000000000000 R11: 0000000000000246 R12: 00007fb38de00304
[   23.956616] R13: 0000000000020000 R14: 000055fe96c79dd0 R15: 0000000000000000
[   23.956619]  </TASK>
[   23.956620] ---[ end trace 0000000000000000 ]---

@p-alik
Copy link
Author

p-alik commented Jan 13, 2025

Opened an issue kernel intel_ipu6_psys bug

@AdrienLemaire
Copy link

thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment