dotfiles/nixos/systems/inkbook/default.nix
magic_rb 50db2c9279
Further inkbook efforts
Signed-off-by: magic_rb <magic_rb@redalder.org>
2024-08-14 15:58:02 +02:00

222 lines
6.4 KiB
Nix

# 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
filter
hasPrefix
;
config' = config;
in {
flake.nixosConfigurations.inkbook = inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; #"armv7l-linux"; #"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,
...
}: 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 {
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 imx/epdc/epdc.fw";
EXTRA_FIRMWARE_DIR = freeform ((pkgs.symlinkJoin {
name = "embedded-extra-firmware";
paths = [
pkgs.linux-firmware
epdc-fw
];
})
+ "/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
pkgs.gdb
pkgs.weston
];
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
'';
});
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"
);
});
};
})
];
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";
services.xserver.enable = true;
# services.xserver.displayManager.lightdm.greeters.gtk.extraConfig = ''
# [greeter]
# keyboard=onboard
# '';
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 = [
"mxc_epdc_drm"
"rn5t618_power"
"rn5t618_adc"
"rtc_rc5t619"
"lm3630a_bl "
"tps6518x_regulator"
"tps6518x"
"tps6518x_hwmon"
];
hardware.firmware = [
epdc-fw
];
time.timeZone = "Europe/Amsterdam";
system.stateVersion = "23.05";
});
};
}