2024-02-10 15:51:59 +01:00
|
|
|
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
{
|
|
|
|
inputs,
|
|
|
|
lib',
|
|
|
|
config,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
inherit
|
|
|
|
(lib')
|
|
|
|
flip
|
|
|
|
mapAttrs
|
|
|
|
singleton
|
|
|
|
mkForce
|
2024-08-14 15:58:02 +02:00
|
|
|
filter
|
|
|
|
hasPrefix
|
2024-02-10 15:51:59 +01:00
|
|
|
;
|
|
|
|
|
|
|
|
config' = config;
|
|
|
|
in {
|
|
|
|
flake.nixosConfigurations.inkbook = inputs.nixpkgs.lib.nixosSystem {
|
2024-08-14 15:58:02 +02:00
|
|
|
system = "x86_64-linux"; #"armv7l-linux"; #"x86_64-linux";
|
2024-02-10 15:51:59 +01:00
|
|
|
|
|
|
|
specialArgs = {
|
|
|
|
config' = config';
|
|
|
|
inputs' = inputs;
|
|
|
|
secret = lib'.loadSecrets inputs.secret;
|
|
|
|
};
|
|
|
|
|
2024-06-25 22:29:39 +02:00
|
|
|
# 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
|
2024-02-10 15:51:59 +01:00
|
|
|
modules =
|
|
|
|
singleton
|
|
|
|
({
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
...
|
2024-08-14 15:58:02 +02:00
|
|
|
}: let
|
|
|
|
epdc-fw = pkgs.runCommand "epdc.fw" {compressFirmware = false;} ''
|
|
|
|
mkdir -p $out/lib/firmware/imx/epdc
|
|
|
|
cp ${./epdc.fw} $out/lib/firmware/imx/epdc/epdc.fw
|
|
|
|
'';
|
|
|
|
in {
|
2024-06-25 22:29:39 +02:00
|
|
|
nixpkgs.crossSystem.system = "armv7l-linux";
|
|
|
|
|
2024-02-10 15:51:59 +01:00
|
|
|
imports = [
|
|
|
|
./bootloader.nix
|
|
|
|
./filesystems.nix
|
|
|
|
./users.nix
|
|
|
|
./nixpkgs.nix
|
|
|
|
./networking.nix
|
|
|
|
../../common/remote_access.nix
|
|
|
|
|
|
|
|
inputs.disko.nixosModules.disko
|
|
|
|
];
|
|
|
|
|
2024-06-25 22:29:39 +02:00
|
|
|
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; {
|
2024-08-14 15:58:02 +02:00
|
|
|
EXTRA_FIRMWARE = freeform "imx/sdma/sdma-imx6q.bin imx/epdc/epdc.fw";
|
|
|
|
EXTRA_FIRMWARE_DIR = freeform ((pkgs.symlinkJoin {
|
|
|
|
name = "embedded-extra-firmware";
|
|
|
|
paths = [
|
|
|
|
pkgs.linux-firmware
|
|
|
|
epdc-fw
|
|
|
|
];
|
|
|
|
})
|
|
|
|
+ "/lib/firmware");
|
2024-06-25 22:29:39 +02:00
|
|
|
# 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
|
2024-08-14 15:58:02 +02:00
|
|
|
pkgs.gdb
|
|
|
|
pkgs.weston
|
2024-06-25 22:29:39 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
'';
|
|
|
|
});
|
|
|
|
|
2024-08-14 15:58:02 +02:00
|
|
|
libgit2 = prev.libgit2.overrideAttrs (old: {
|
|
|
|
GITTEST_FLAKY_STAT = "1";
|
|
|
|
});
|
|
|
|
|
|
|
|
libjxl = prev.libjxl.overrideAttrs (old: {
|
|
|
|
cmakeFlags = lib'.filter (x: x != "-DJPEGXL_FORCE_NEON=ON") old.cmakeFlags;
|
|
|
|
});
|
|
|
|
|
|
|
|
# libvpx = prev.libvpx.overrideAttrs (old: {
|
|
|
|
# configureFlags =
|
|
|
|
# flip filter old.configureFlags (x: !(hasPrefix "--force-target" x)) ++ ["--target=armv7-linux-gcc"];
|
|
|
|
# });
|
|
|
|
libvpx = final.callPackage ./libvpx.nix {};
|
|
|
|
|
|
|
|
libunwind = prev.libunwind.overrideAttrs (old: {
|
|
|
|
separateDebugInfo = true;
|
|
|
|
});
|
|
|
|
xorg =
|
|
|
|
prev.xorg
|
|
|
|
// {
|
|
|
|
xorgserver = prev.xorg.xorgserver.overrideAttrs (old: {
|
|
|
|
separateDebugInfo = true;
|
|
|
|
propagatedBuildInputs = flip filter old.propagatedBuildInputs (
|
|
|
|
x:
|
|
|
|
x.pname != "libunwind"
|
|
|
|
);
|
|
|
|
});
|
|
|
|
};
|
2024-06-25 22:29:39 +02:00
|
|
|
})
|
|
|
|
];
|
2024-02-10 15:51:59 +01:00
|
|
|
|
2024-08-14 15:58:02 +02:00
|
|
|
environment.enableDebugInfo = true;
|
|
|
|
|
|
|
|
documentation.enable = false;
|
|
|
|
|
|
|
|
# services.xserver.displayManager.startx.enable = true;
|
|
|
|
# services.xserver.displayManager.lightdm.enable = true;
|
|
|
|
# services.xserver.displayManager.lightdm.greeters.mobile.enable = true;
|
|
|
|
# services.xserver.displayManager.lightdm.greeters.gtk.enable = false;
|
|
|
|
services.xserver.displayManager.sddm.enable = true;
|
|
|
|
services.displayManager.sddm.settings.General.InputMethod = "qtvirtualkeyboard";
|
2024-06-25 22:29:39 +02:00
|
|
|
services.xserver.enable = true;
|
2024-08-14 15:58:02 +02:00
|
|
|
# services.xserver.displayManager.lightdm.greeters.gtk.extraConfig = ''
|
|
|
|
# [greeter]
|
|
|
|
|
|
|
|
# keyboard=onboard
|
|
|
|
# '';
|
2024-06-25 22:29:39 +02:00
|
|
|
|
|
|
|
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"
|
|
|
|
];
|
2024-08-14 15:58:02 +02:00
|
|
|
boot.initrd.availableKernelModules = [
|
|
|
|
"mxc_epdc_drm"
|
|
|
|
"rn5t618_power"
|
|
|
|
"rn5t618_adc"
|
|
|
|
"rtc_rc5t619"
|
|
|
|
"lm3630a_bl "
|
|
|
|
"tps6518x_regulator"
|
|
|
|
"tps6518x"
|
|
|
|
"tps6518x_hwmon"
|
|
|
|
];
|
2024-06-25 22:29:39 +02:00
|
|
|
hardware.firmware = [
|
2024-08-14 15:58:02 +02:00
|
|
|
epdc-fw
|
2024-06-25 22:29:39 +02:00
|
|
|
];
|
2024-02-10 15:51:59 +01:00
|
|
|
|
|
|
|
time.timeZone = "Europe/Amsterdam";
|
|
|
|
system.stateVersion = "23.05";
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|