This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

remove pixel8: moved to standalone repo

The pixel8 Linux project has been extracted into its own repository.
This also fixes the nix flake check failure (pixel8 was missing
nixpkgs.hostPlatform).

+1 -425
+1 -1
flake.nix
··· 187 187 ./keys/flake-module.nix 188 188 ./skills/flake-module.nix 189 189 ./games/flake-module.nix 190 - ./machines/pixel8/flake-module.nix 190 + 191 191 ./wrapperModules/pi/flake-module.nix 192 192 ] 193 193 ++ (
-69
machines/pixel8/boot-img.nix
··· 1 - { 2 - lib, 3 - stdenvNoCC, 4 - callPackage, 5 - }: 6 - 7 - let 8 - kernel = callPackage ./kernel.nix { }; 9 - initramfs = callPackage ./initramfs.nix { }; 10 - mkbootimg = callPackage ./mkbootimg.nix { }; 11 - in 12 - stdenvNoCC.mkDerivation { 13 - pname = "pixel8-boot-img"; 14 - version = "0.1.0"; 15 - 16 - dontUnpack = true; 17 - 18 - nativeBuildInputs = [ mkbootimg ]; 19 - 20 - buildPhase = '' 21 - runHook preBuild 22 - 23 - # Create init_boot.img for Pixel 8 (Android 13+) 24 - # This replaces only the init ramdisk, keeping GrapheneOS kernel + vendor_boot 25 - # Header version 4, no kernel - just our ramdisk with /init 26 - mkbootimg \ 27 - --header_version 4 \ 28 - --ramdisk ${initramfs}/initrd \ 29 - --os_version 14.0.0 \ 30 - --os_patch_level 2024-01 \ 31 - --pagesize 4096 \ 32 - --output init_boot.img 33 - 34 - # Also create full boot.img for reference/testing 35 - mkbootimg \ 36 - --kernel ${kernel}/kernel/Image \ 37 - --ramdisk ${initramfs}/initrd \ 38 - --header_version 4 \ 39 - --os_version 14.0.0 \ 40 - --os_patch_level 2024-01 \ 41 - --pagesize 4096 \ 42 - --cmdline "rdinit=/init" \ 43 - --output boot.img 44 - 45 - runHook postBuild 46 - ''; 47 - 48 - installPhase = '' 49 - runHook preInstall 50 - 51 - mkdir -p $out 52 - cp init_boot.img $out/ 53 - cp boot.img $out/ 54 - 55 - # Also provide the components separately for debugging 56 - mkdir -p $out/components 57 - ln -s ${kernel} $out/components/kernel 58 - ln -s ${initramfs}/initrd $out/components/initrd 59 - ln -s ${kernel}/dtbo.img $out/dtbo.img 60 - 61 - runHook postInstall 62 - ''; 63 - 64 - meta = with lib; { 65 - description = "Minimal NixOS boot image for Google Pixel 8"; 66 - license = licenses.gpl2Only; 67 - platforms = platforms.all; 68 - }; 69 - }
-23
machines/pixel8/flake-module.nix
··· 1 - { ... }: 2 - { 3 - perSystem = 4 - { 5 - pkgs, 6 - ... 7 - }: 8 - { 9 - packages = { 10 - # GrapheneOS prebuilt kernel for Pixel 8 11 - pixel8-kernel = pkgs.callPackage ./kernel.nix { }; 12 - 13 - # Android boot image tools 14 - mkbootimg = pkgs.callPackage ./mkbootimg.nix { }; 15 - 16 - # Minimal initramfs with debug shell 17 - pixel8-initramfs = pkgs.callPackage ./initramfs.nix { }; 18 - 19 - # Complete boot image ready to flash 20 - pixel8-boot-img = pkgs.callPackage ./boot-img.nix { }; 21 - }; 22 - }; 23 - }
-210
machines/pixel8/initramfs.nix
··· 1 - { 2 - pkgsCross, 3 - stdenvNoCC, 4 - writeScript, 5 - callPackage, 6 - cpio, 7 - gzip, 8 - }: 9 - 10 - let 11 - # Use aarch64 cross-compiled packages 12 - aarch64 = pkgsCross.aarch64-multiplatform; 13 - busybox = aarch64.busybox.override { enableStatic = true; }; 14 - 15 - kernel = callPackage ./kernel.nix { }; 16 - 17 - # Modules needed for USB (and their full dependency chain) 18 - # Traced via modinfo -F depends, topologically sorted 19 - usbModules = [ 20 - # Leaf dependencies (no deps of their own) 21 - "ect_parser" 22 - "eusb_repeater" 23 - "exynos-pd_el3" 24 - "google_tcpci_shim" 25 - "gs-chipid" 26 - "gs_perf_mon" 27 - "gvotable" 28 - "kernel-top" 29 - "logbuffer" 30 - "max77759_helper" 31 - "pixel-suspend-diag" 32 - "sched_tp" 33 - "systrace" 34 - "xhci-goog-dma" 35 - # Level 1 36 - "exynos-pmu-if" 37 - "dss" 38 - "exynos-pd_hsi0" 39 - "usb_psy" 40 - "max77759_contaminant" 41 - "max77779_contaminant" 42 - "pinctrl-exynos-gs" 43 - # Level 2 44 - "gs_acpm" 45 - "max777x9_contaminant" 46 - "bc_max77759" 47 - # Level 3 48 - "cmupmucal" 49 - "vh_sched" 50 - "pixel_metrics" 51 - # Level 4 52 - "exynos_pm_qos" 53 - "exynos-cpupm" 54 - # USB hardware 55 - "phy-exynos-usbdrd-eusb-super" 56 - "dwc3-exynos-usb" 57 - "xhci-exynos" 58 - # Type-C port manager 59 - "tcpci_max77759" 60 - ]; 61 - 62 - # Init script - with diagnostics written to metadata partition 63 - initScript = writeScript "init" '' 64 - #!/bin/busybox sh 65 - 66 - /bin/busybox mkdir -p /proc /sys /dev /tmp /config /metadata 67 - /bin/busybox mount -t proc proc /proc 68 - /bin/busybox mount -t sysfs sys /sys 69 - /bin/busybox mount -t devtmpfs dev /dev 70 - /bin/busybox mount -t tmpfs tmp /tmp 71 - /bin/busybox mount -t configfs none /config 2>/dev/null 72 - /bin/busybox --install -s /bin 73 - 74 - # Open watchdog fd 75 - exec 3>/dev/watchdog 2>/dev/null 76 - 77 - # Diagnostics written to tmpfs, then dd'd to vendor_boot at offset 60MB 78 - LOG=/tmp/debug.txt 79 - echo "=== NixOS init started ===" > $LOG 2>/dev/null 80 - date >> $LOG 2>/dev/null 81 - echo "=== /dev/block ===" >> $LOG 2>/dev/null 82 - ls -la /dev/block/platform/13200000.ufs/by-name/ >> $LOG 2>/dev/null 83 - echo "=== configfs ===" >> $LOG 2>/dev/null 84 - ls -la /config/ >> $LOG 2>/dev/null 85 - echo "=== usb_gadget exists? ===" >> $LOG 2>/dev/null 86 - ls -la /config/usb_gadget/ >> $LOG 2>/dev/null 87 - echo "=== /sys/class/udc before modules ===" >> $LOG 2>/dev/null 88 - ls -la /sys/class/udc/ >> $LOG 2>/dev/null 89 - 90 - # Load USB modules in dependency order, logging each 91 - ${builtins.concatStringsSep "\n" ( 92 - map (mod: '' 93 - echo "loading ${mod}..." >> $LOG 2>/dev/null 94 - insmod /lib/modules/${mod}.ko >> $LOG 2>&1 95 - '') usbModules 96 - )} 97 - 98 - echo "=== /sys/class/udc after modules ===" >> $LOG 2>/dev/null 99 - ls -la /sys/class/udc/ >> $LOG 2>/dev/null 100 - echo "=== usb_gadget after modules ===" >> $LOG 2>/dev/null 101 - ls -la /config/usb_gadget/ >> $LOG 2>/dev/null 102 - echo "=== dmesg (last 100 lines) ===" >> $LOG 2>/dev/null 103 - dmesg | tail -100 >> $LOG 2>/dev/null 104 - 105 - # Wait for UDC 106 - sleep 3 107 - echo "=== /sys/class/udc after sleep ===" >> $LOG 2>/dev/null 108 - ls -la /sys/class/udc/ >> $LOG 2>/dev/null 109 - 110 - # Set up USB gadget serial (ACM) 111 - if [ -d /config/usb_gadget ]; then 112 - mkdir -p /config/usb_gadget/g1/strings/0x409 113 - echo 0x18d1 > /config/usb_gadget/g1/idVendor 114 - echo 0x4ee7 > /config/usb_gadget/g1/idProduct 115 - echo "NixOS" > /config/usb_gadget/g1/strings/0x409/manufacturer 116 - echo "Pixel8" > /config/usb_gadget/g1/strings/0x409/product 117 - 118 - mkdir -p /config/usb_gadget/g1/configs/c.1/strings/0x409 119 - echo "ACM" > /config/usb_gadget/g1/configs/c.1/strings/0x409/configuration 120 - 121 - mkdir -p /config/usb_gadget/g1/functions/acm.usb0 122 - ln -s /config/usb_gadget/g1/functions/acm.usb0 /config/usb_gadget/g1/configs/c.1/ 123 - 124 - UDC=$(ls /sys/class/udc/ 2>/dev/null | head -1) 125 - echo "UDC=$UDC" >> $LOG 2>/dev/null 126 - [ -n "$UDC" ] && echo "$UDC" > /config/usb_gadget/g1/UDC 2>/dev/null 127 - else 128 - echo "=== /config/usb_gadget NOT FOUND ===" >> $LOG 2>/dev/null 129 - fi 130 - 131 - echo "=== gadget setup done ===" >> $LOG 2>/dev/null 132 - 133 - # Also dump block device info for debugging 134 - echo "=== /proc/partitions ===" >> $LOG 2>/dev/null 135 - cat /proc/partitions >> $LOG 2>/dev/null 136 - echo "=== looking for vendor_boot ===" >> $LOG 2>/dev/null 137 - 138 - # Find vendor_boot block device via sysfs partition names 139 - VB="" 140 - for part in /sys/class/block/sd*/; do 141 - pname=$(cat "''${part}uevent" 2>/dev/null | grep PARTNAME | cut -d= -f2) 142 - devname=$(cat "''${part}uevent" 2>/dev/null | grep DEVNAME | cut -d= -f2) 143 - if echo "$pname" | grep -q "vendor_boot"; then 144 - VB="/dev/$devname" 145 - echo "Found vendor_boot at $VB (partname=$pname)" >> $LOG 2>/dev/null 146 - break 147 - fi 148 - done 149 - 150 - # Write diagnostics to vendor_boot at offset 60MB 151 - if [ -n "$VB" ] && [ -b "$VB" ]; then 152 - dd if=$LOG of=$VB bs=1 seek=62914560 conv=notrunc 2>/dev/null 153 - echo "DIAG_OK" | dd of=$VB bs=1 seek=62914544 conv=notrunc 2>/dev/null 154 - echo "wrote diagnostics to $VB" >> $LOG 2>/dev/null 155 - else 156 - echo "vendor_boot block device not found" >> $LOG 2>/dev/null 157 - fi 158 - sync 159 - 160 - # Spawn shell on USB serial as background process 161 - ( 162 - sleep 2 163 - while true; do 164 - if [ -e /dev/ttyGS0 ]; then 165 - setsid sh -c 'sh </dev/ttyGS0 >/dev/ttyGS0 2>&1' 166 - fi 167 - sleep 1 168 - done 169 - ) & 170 - 171 - # PID 1 - feed watchdog and stay alive 172 - while true; do 173 - echo 1 >&3 2>/dev/null 174 - sleep 2 175 - done 176 - ''; 177 - 178 - in 179 - stdenvNoCC.mkDerivation { 180 - name = "pixel8-initramfs"; 181 - 182 - dontUnpack = true; 183 - 184 - nativeBuildInputs = [ 185 - cpio 186 - gzip 187 - ]; 188 - 189 - buildPhase = '' 190 - mkdir -p root/{bin,dev,proc,sys,tmp,run,config,lib/modules} 191 - 192 - cp ${busybox}/bin/busybox root/bin/busybox 193 - chmod 755 root/bin/busybox 194 - 195 - cp ${initScript} root/init 196 - chmod 755 root/init 197 - 198 - # Copy USB modules and dependencies 199 - ${builtins.concatStringsSep "\n" ( 200 - map (mod: " cp ${kernel}/modules/${mod}.ko root/lib/modules/") usbModules 201 - )} 202 - 203 - (cd root && find . | sort | cpio -o -H newc --quiet | gzip -9) > initrd 204 - ''; 205 - 206 - installPhase = '' 207 - mkdir -p $out 208 - cp initrd $out/initrd 209 - ''; 210 - }
-62
machines/pixel8/kernel.nix
··· 1 - { 2 - lib, 3 - stdenvNoCC, 4 - fetchFromGitHub, 5 - lz4, 6 - }: 7 - 8 - stdenvNoCC.mkDerivation rec { 9 - pname = "pixel8-kernel-grapheneos"; 10 - version = "6.1-16-qpr2"; 11 - 12 - src = fetchFromGitHub { 13 - owner = "GrapheneOS"; 14 - repo = "device_google_shusky-kernels_6.1"; 15 - rev = "16-qpr2"; 16 - hash = "sha256-bFYP0gdPQiQEf4wjwGyE8ocfKeYOWPLSBtkif3SDvzM="; 17 - }; 18 - 19 - nativeBuildInputs = [ lz4 ]; 20 - 21 - installPhase = '' 22 - runHook preInstall 23 - 24 - mkdir -p $out/{kernel,dtbs,modules} 25 - 26 - # Decompress kernel 27 - lz4 -d grapheneos/Image.lz4 $out/kernel/Image 28 - 29 - # Copy DTBs 30 - cp grapheneos/*.dtb $out/dtbs/ 31 - 32 - # Copy DTBO image 33 - cp grapheneos/dtbo.img $out/ 34 - 35 - # Copy all modules 36 - cp grapheneos/*.ko $out/modules/ 37 - 38 - # Copy module loading configuration 39 - cp grapheneos/modules.load $out/ 40 - cp grapheneos/init.insmod.shiba.cfg $out/ 41 - cp grapheneos/vendor_kernel_boot.modules.load $out/ 42 - 43 - # Copy System.map for debugging 44 - cp grapheneos/System.map $out/ 45 - 46 - runHook postInstall 47 - ''; 48 - 49 - # No compilation, just file copies - can build on any platform 50 - dontStrip = true; 51 - dontPatchELF = true; 52 - dontFixup = true; 53 - 54 - meta = with lib; { 55 - description = "GrapheneOS prebuilt kernel for Google Pixel 8 (shiba)"; 56 - homepage = "https://github.com/GrapheneOS/device_google_shusky-kernels_6.1"; 57 - license = licenses.gpl2Only; 58 - # Contains aarch64 binaries, but can be unpacked on any platform 59 - platforms = lib.platforms.all; 60 - maintainers = [ ]; 61 - }; 62 - }
-60
machines/pixel8/mkbootimg.nix
··· 1 - { 2 - lib, 3 - stdenvNoCC, 4 - fetchgit, 5 - python3, 6 - }: 7 - 8 - stdenvNoCC.mkDerivation { 9 - pname = "mkbootimg"; 10 - version = "2025-02-10"; 11 - 12 - src = fetchgit { 13 - url = "https://android.googlesource.com/platform/system/tools/mkbootimg"; 14 - rev = "d2bb0af5ba6d3198a3e99529c97eda1be0b5a093"; 15 - hash = "sha256-z7KklKf0dTyt7ZoUiZrMYRzU3h+WuLnc355LRtFMs2s="; 16 - }; 17 - 18 - nativeBuildInputs = [ python3 ]; 19 - 20 - installPhase = '' 21 - runHook preInstall 22 - 23 - mkdir -p $out/bin $out/lib/mkbootimg 24 - 25 - # Copy Python scripts and modules 26 - cp mkbootimg.py unpack_bootimg.py repack_bootimg.py $out/lib/mkbootimg/ 27 - cp -r gki $out/lib/mkbootimg/ 28 - 29 - # Create wrapper scripts with PYTHONPATH set 30 - cat > $out/bin/mkbootimg << EOF 31 - #!/bin/sh 32 - export PYTHONPATH="$out/lib/mkbootimg:\$PYTHONPATH" 33 - exec ${python3}/bin/python3 $out/lib/mkbootimg/mkbootimg.py "\$@" 34 - EOF 35 - chmod +x $out/bin/mkbootimg 36 - 37 - cat > $out/bin/unpack_bootimg << EOF 38 - #!/bin/sh 39 - export PYTHONPATH="$out/lib/mkbootimg:\$PYTHONPATH" 40 - exec ${python3}/bin/python3 $out/lib/mkbootimg/unpack_bootimg.py "\$@" 41 - EOF 42 - chmod +x $out/bin/unpack_bootimg 43 - 44 - cat > $out/bin/repack_bootimg << EOF 45 - #!/bin/sh 46 - export PYTHONPATH="$out/lib/mkbootimg:\$PYTHONPATH" 47 - exec ${python3}/bin/python3 $out/lib/mkbootimg/repack_bootimg.py "\$@" 48 - EOF 49 - chmod +x $out/bin/repack_bootimg 50 - 51 - runHook postInstall 52 - ''; 53 - 54 - meta = with lib; { 55 - description = "Android boot image creation tool from AOSP"; 56 - homepage = "https://android.googlesource.com/platform/system/tools/mkbootimg"; 57 - license = licenses.asl20; 58 - platforms = platforms.all; 59 - }; 60 - }