Skip to content

Instantly share code, notes, and snippets.

@p-alik
Last active July 24, 2025 17:39
Show Gist options
  • Select an option

  • Save p-alik/6ed132ffad59de8fcbc4fb10b54d745e to your computer and use it in GitHub Desktop.

Select an option

Save p-alik/6ed132ffad59de8fcbc4fb10b54d745e to your computer and use it in GitHub Desktop.

Revisions

  1. p-alik revised this gist Jan 16, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion etc-nixos
    Original file line number Diff line number Diff line change
    @@ -118,7 +118,7 @@ let
    src = pkgs.fetchFromGitHub {
    owner = "intel";
    repo = "ivsc-firmware";
    rev = "main";
    rev = "10c214fea5560060d387fbd2fb8a1af329cb6232";
    sha256 = "sha256-kEoA0yeGXuuB+jlMIhNm+SBljH+Ru7zt3PzGb+EPBPw=";

    };
  2. p-alik created this gist Jan 12, 2024.
    193 changes: 193 additions & 0 deletions etc-nixos
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,193 @@
    # /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 = "main";
    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";
    }