# SPDX-FileCopyrightText: 2022 Richard Brežák # # SPDX-License-Identifier: LGPL-3.0-or-later { inputs, lib', config, ... }: let inherit (lib') flip mapAttrs singleton mkForce ; config' = config; in { flake.nixosConfigurations.inkbook = inputs.nixpkgs.lib.nixosSystem { system = "x86_64-linux"; specialArgs = { config' = config'; inputs' = inputs; secret = lib'.loadSecrets inputs.secret; }; # https://web.archive.org/web/20240622174012/https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/u-boot-on-the-i-MX6-sabre-sd-platform-in-a-few-commands/ta-p/1114268 modules = singleton ({ pkgs, config, ... }: { nixpkgs.crossSystem.system = "armv7l-linux"; imports = [ ./bootloader.nix ./filesystems.nix ./users.nix ./nixpkgs.nix ./networking.nix ../../common/remote_access.nix inputs.disko.nixosModules.disko ]; boot.kernelPackages = pkgs.linuxPackagesFor ((pkgs.buildLinux { version = "6.9.0-drm-kobo"; modDirVersion = "6.9.0"; src = pkgs.fetchFromGitHub { owner = "akemnade"; repo = "linux"; rev = "4b0c49001732b93f6787c44e090b8e8f72e6fe6a"; hash = "sha256-rCiznEHDqrOW+CEI1I9HdHNSsVYCb7iJGE+7PKJ8H6A="; }; defconfig = "kobo_defconfig"; structuredExtraConfig = with pkgs.lib.kernel; { EXTRA_FIRMWARE = freeform "imx/sdma/sdma-imx6q.bin"; EXTRA_FIRMWARE_DIR = freeform "${pkgs.linux-firmware}/lib/firmware"; # RTW_SDIO_PM_KEEP_POWER = no; # RTW_DEBUG = no; }; extraMeta.branch = "drm-merged-6.9"; }) .overrideAttrs (old: { nativeBuildInputs = old.nativeBuildInputs ++ (with pkgs; [ lzop ]); })); environment.systemPackages = [ pkgs.kmscon pkgs.drm_info pkgs.xterm ]; nixpkgs.overlays = [ (final: prev: { procmail = prev.procmail.overrideAttrs (old: { postPatch = old.postPatch + '' sed -i $'/This actually can\'t happen/i : ; fi ; if false ; then' src/autoconf ''; }); xorg = inputs.nixpkgs-unstable.legacyPackages."armv7l-linux".xorg; }) ]; services.xserver.displayManager.startx.enable = true; services.xserver.displayManager.lightdm.enable = true; services.xserver.enable = true; systemd.network.wait-online.enable = false; systemd.network.enable = true; systemd.network.networks."50-usb0" = { matchConfig.Name = "usb0"; networkConfig.Address = "19.19.19.2/24"; linkConfig.RequiredForOnline = "no"; }; systemd.services."usb-gadget" = { partOf = ["network-setup.service"]; wantedBy = ["multi-user.target"]; path = [ pkgs.kmod ]; script = '' modprobe g_ether cd /sys/kernel/config/usb_gadget mkdir g1 cd g1 echo "0x1d6b" > idVendor echo "0x0104" > idProduct mkdir functions/rndis.rn0 mkdir configs/c1.1 ln -s functions/rndis.rn0 configs/c1.1/ ''; serviceConfig.Type = "oneshot"; }; boot.kernelParams = ["no_console_suspend" "detect_clara_rev"]; hardware.wirelessRegulatoryDatabase = true; boot.initrd.systemd.enable = false; boot.initrd.includeDefaultModules = false; boot.initrd.kernelModules = [ "tps6518x-hwmon" "tps6518x-regulator" "mxc_epdc_drm" ]; boot.initrd.availableKernelModules = builtins.fromJSON (builtins.readFile ./kernel-modules.json); hardware.firmware = [ (pkgs.runCommand "epdc.fw" {compressFirmware = false;} '' mkdir -p $out/lib/firmware/imx/epdc cp ${./epdc.fw} $out/lib/firmware/imx/epdc/epdc.fw '') ]; time.timeZone = "Europe/Amsterdam"; system.stateVersion = "23.05"; }); }; }