dotfiles/nixos/systems/inkbook/default.nix
magic_rb 4435cdfec7
Move out custom kernels and uboots into overlays
Signed-off-by: magic_rb <magic_rb@redalder.org>
2024-08-14 22:21:42 +02:00

179 lines
4.7 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,
...
}: {
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.linuxClaraHD;
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.lightdm.enable = true;
services.xserver.displayManager.lightdm.greeters.gtk.enable = true;
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 = [
pkgs.epdc-fw
];
time.timeZone = "Europe/Amsterdam";
system.stateVersion = "23.05";
});
};
}