Skip to content

Instantly share code, notes, and snippets.

@p-alik
Last active April 19, 2024 08:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • 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";
}
@tobiasBora
Copy link

Awesome, it works great to have webcam! Just, it fails in cheese, but all other programs I tried get it right:

  1. firefox
  2. chrome
  3. obs
  4. zoom-us

Thank you so much. Note that to get sound right, I needed to run alsactl init.

@p-alik
Copy link
Author

p-alik commented Mar 8, 2024

might be cheese has a permissions issue as mentioned here

sudo cheese 

(cheese:543473): cheese-WARNING **: 09:26:02.442: Device '/dev/video1' does not support 2:0:0:0 colorimetry: ../sys/v4l2/gstv4l2object.c(4213): gst_v4l2_object_set_format_full (): /GstCameraBin:camerabin/GstWrapperCameraBinSrc:camera_source/GstBin:bin36/GstV4l2Src:v4l2src1:
Device wants 2:0:0:0 colorimetry

Without sudo see notgne2/xps_9320.nix

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