mirror of
https://github.com/WiiPlayer2/switchroot-nixos.git
synced 2025-10-06 00:32:47 +02:00
Format all files
This commit is contained in:
30
flake.nix
30
flake.nix
@@ -13,18 +13,26 @@
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, deploy-rs, ... } @ inputs: {
|
||||
packages = import ./pkgs inputs;
|
||||
overlays = import ./overlays inputs;
|
||||
nixosConfigurations = import ./nixosConfigurations inputs;
|
||||
nixosModules = import ./nixosModules inputs;
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
deploy-rs,
|
||||
nixpkgs,
|
||||
...
|
||||
}@inputs:
|
||||
{
|
||||
packages = import ./pkgs inputs;
|
||||
overlays = import ./overlays inputs;
|
||||
nixosConfigurations = import ./nixosConfigurations inputs;
|
||||
nixosModules = import ./nixosModules inputs;
|
||||
|
||||
deploy.nodes.default = {
|
||||
hostname = "nintendo-switch";
|
||||
profiles.system = {
|
||||
sshUser = "root";
|
||||
path = deploy-rs.lib.aarch64-linux.activate.nixos self.nixosConfigurations.example;
|
||||
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-tree;
|
||||
deploy.nodes.default = {
|
||||
hostname = "nintendo-switch";
|
||||
profiles.system = {
|
||||
sshUser = "root";
|
||||
path = deploy-rs.lib.aarch64-linux.activate.nixos self.nixosConfigurations.example;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@@ -1,4 +1,3 @@
|
||||
inputs:
|
||||
{
|
||||
inputs: {
|
||||
example = import ./example.nix inputs;
|
||||
}
|
||||
|
@@ -3,17 +3,24 @@ inputs.nixpkgs.lib.nixosSystem {
|
||||
modules = [
|
||||
inputs.self.nixosModules.switchroot-nixos
|
||||
(
|
||||
{ lib, pkgs, config, ... }:
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
nixpkgs = {
|
||||
# buildPlatform = system;
|
||||
# buildPlatform = "x86_64-linux"; # TODO: for now only cross compilation
|
||||
# hostPlatform = "aarch64-linux";
|
||||
system = "aarch64-linux";
|
||||
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
|
||||
"nvidia-x11"
|
||||
"nvidia-settings"
|
||||
];
|
||||
config.allowUnfreePredicate =
|
||||
pkg:
|
||||
builtins.elem (lib.getName pkg) [
|
||||
"nvidia-x11"
|
||||
"nvidia-settings"
|
||||
];
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
|
@@ -1,5 +1,4 @@
|
||||
inputs:
|
||||
rec {
|
||||
inputs: rec {
|
||||
switchroot-nixos = import ./switchroot-nixos.nix inputs;
|
||||
default = switchroot-nixos;
|
||||
}
|
||||
|
@@ -13,7 +13,8 @@
|
||||
enable = true;
|
||||
installHook =
|
||||
let
|
||||
switchroot-boot = (pkgs.switchroot-nixos {
|
||||
switchroot-boot =
|
||||
(pkgs.switchroot-nixos {
|
||||
inherit (config.system.build) kernel initialRamdisk toplevel;
|
||||
}).boot;
|
||||
installApplication = pkgs.writeShellApplication {
|
||||
@@ -27,7 +28,7 @@
|
||||
'';
|
||||
};
|
||||
in
|
||||
pkgs.lib.getExe installApplication;
|
||||
pkgs.lib.getExe installApplication;
|
||||
};
|
||||
system.build.switchrootImage = pkgs.switchroot-nixos {
|
||||
inherit (config.system.build) kernel initialRamdisk toplevel;
|
||||
|
@@ -3,78 +3,80 @@
|
||||
services = {
|
||||
xserver = {
|
||||
displayManager.lightdm.extraConfig = ''
|
||||
logind-check-graphical=false
|
||||
'';
|
||||
videoDrivers = [ "nvidia" ];
|
||||
drivers = [
|
||||
{
|
||||
name = "nvidia";
|
||||
modules = [ pkgs.nvidiaPackages-l4t.x11-module ];
|
||||
# driverName = "nvidia";
|
||||
display = true;
|
||||
screenSection = ''
|
||||
Option "metamodes" "DSI-0: nvidia-auto-select @1280x720 +0+0 {ViewPortIn=1280x720, ViewPortOut=720x1280+0+0, Rotation=90}"
|
||||
'';
|
||||
}
|
||||
];
|
||||
monitorSection = ''
|
||||
ModelName "DFP-0"
|
||||
#DisplaySize 77 137
|
||||
'';
|
||||
deviceSection = ''
|
||||
Option "AllowUnofficialGLXProtocol" "true"
|
||||
Option "DPMS" "false"
|
||||
# Allow X server to be started even if no display devices are connected.
|
||||
Option "AllowEmptyInitialConfiguration" "true"
|
||||
Option "Monitor-DSI-0" "Monitor[0]"
|
||||
# Option "Monitor-DP-0" "Monitor1"
|
||||
'';
|
||||
logind-check-graphical=false
|
||||
'';
|
||||
videoDrivers = [ "nvidia" ];
|
||||
drivers = [
|
||||
{
|
||||
name = "nvidia";
|
||||
modules = [ pkgs.nvidiaPackages-l4t.x11-module ];
|
||||
# driverName = "nvidia";
|
||||
display = true;
|
||||
screenSection = ''
|
||||
Option "metamodes" "DSI-0: nvidia-auto-select @1280x720 +0+0 {ViewPortIn=1280x720, ViewPortOut=720x1280+0+0, Rotation=90}"
|
||||
'';
|
||||
}
|
||||
];
|
||||
monitorSection = ''
|
||||
ModelName "DFP-0"
|
||||
#DisplaySize 77 137
|
||||
'';
|
||||
deviceSection = ''
|
||||
Option "AllowUnofficialGLXProtocol" "true"
|
||||
Option "DPMS" "false"
|
||||
# Allow X server to be started even if no display devices are connected.
|
||||
Option "AllowEmptyInitialConfiguration" "true"
|
||||
Option "Monitor-DSI-0" "Monitor[0]"
|
||||
# Option "Monitor-DP-0" "Monitor1"
|
||||
'';
|
||||
};
|
||||
udev.packages = with pkgs; [
|
||||
nvidiaPackages-l4t.udev-rules
|
||||
];
|
||||
udev.packages = with pkgs; [
|
||||
nvidiaPackages-l4t.udev-rules
|
||||
];
|
||||
};
|
||||
|
||||
boot.blacklistedKernelModules = [
|
||||
"nouveau"
|
||||
"nvidiafb"
|
||||
];
|
||||
boot.kernelModules = [
|
||||
"nvgpu"
|
||||
];
|
||||
# hardware.nvidia.enabled = true;
|
||||
hardware.nvidia.open = false;
|
||||
hardware.nvidia.package = null;
|
||||
nixpkgs.config.nvidia.acceptLicense = true;
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
extraPackages = with pkgs; [
|
||||
nvidiaPackages-l4t.tegra-lib
|
||||
];
|
||||
};
|
||||
boot.initrd.postDeviceCommands = ''
|
||||
echo 0 > /sys/class/graphics/fb0/state
|
||||
'';
|
||||
boot.blacklistedKernelModules = [
|
||||
"nouveau"
|
||||
"nvidiafb"
|
||||
];
|
||||
boot.kernelModules = [
|
||||
"nvgpu"
|
||||
];
|
||||
# hardware.nvidia.enabled = true;
|
||||
hardware.nvidia.open = false;
|
||||
hardware.nvidia.package = null;
|
||||
nixpkgs.config.nvidia.acceptLicense = true;
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
extraPackages = with pkgs; [
|
||||
nvidiaPackages-l4t.tegra-lib
|
||||
];
|
||||
};
|
||||
boot.initrd.postDeviceCommands = ''
|
||||
echo 0 > /sys/class/graphics/fb0/state
|
||||
'';
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
xorg = prev.xorg.overrideScope (final': prev': {
|
||||
xorgserver = prev'.xorgserver.overrideAttrs (prevAttrs: {
|
||||
version = "1.20.14";
|
||||
src = prev.fetchurl {
|
||||
url = "mirror://xorg/individual/xserver/xorg-server-1.20.14.tar.gz";
|
||||
hash = "sha256-VLGZySgP+L8Pc6VKdZZFvQ7u2nJV0cmTENW3WV86wGY=";
|
||||
};
|
||||
patches = prevAttrs.patches ++ [
|
||||
# https://github.com/NixOS/nixpkgs/pull/147238
|
||||
(prev.fetchpatch {
|
||||
name = "stdbool.patch";
|
||||
url = "https://gitlab.freedesktop.org/xorg/xserver/-/commit/454b3a826edb5fc6d0fea3a9cfd1a5e8fc568747.diff";
|
||||
sha256 = "1l9qg905jvlw3r0kx4xfw5m12pbs0782v2g3267d1m6q4m6fj1zy";
|
||||
})
|
||||
];
|
||||
});
|
||||
});
|
||||
})
|
||||
];
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
xorg = prev.xorg.overrideScope (
|
||||
final': prev': {
|
||||
xorgserver = prev'.xorgserver.overrideAttrs (prevAttrs: {
|
||||
version = "1.20.14";
|
||||
src = prev.fetchurl {
|
||||
url = "mirror://xorg/individual/xserver/xorg-server-1.20.14.tar.gz";
|
||||
hash = "sha256-VLGZySgP+L8Pc6VKdZZFvQ7u2nJV0cmTENW3WV86wGY=";
|
||||
};
|
||||
patches = prevAttrs.patches ++ [
|
||||
# https://github.com/NixOS/nixpkgs/pull/147238
|
||||
(prev.fetchpatch {
|
||||
name = "stdbool.patch";
|
||||
url = "https://gitlab.freedesktop.org/xorg/xserver/-/commit/454b3a826edb5fc6d0fea3a9cfd1a5e8fc568747.diff";
|
||||
sha256 = "1l9qg905jvlw3r0kx4xfw5m12pbs0782v2g3267d1m6q4m6fj1zy";
|
||||
})
|
||||
];
|
||||
});
|
||||
}
|
||||
);
|
||||
})
|
||||
];
|
||||
}
|
||||
|
@@ -1,9 +1,9 @@
|
||||
{ pkgs, config, ... }:
|
||||
{
|
||||
hardware.firmware = with pkgs; [
|
||||
config.boot.kernelPackages.kernel
|
||||
nvidiaPackages-l4t.tegra-firmware
|
||||
];
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
hardware.bluetooth.enable = true;
|
||||
hardware.firmware = with pkgs; [
|
||||
config.boot.kernelPackages.kernel
|
||||
nvidiaPackages-l4t.tegra-firmware
|
||||
];
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
hardware.bluetooth.enable = true;
|
||||
}
|
||||
|
@@ -1,58 +1,60 @@
|
||||
{ pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
set-alsa-config = (pkgs.writeShellScriptBin "set-alsa-config" ''
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="I2S1 Sample Rate" 48000
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x SPK MIXL DAC L1 Switch" on
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x SPK MIXR DAC R1 Switch" on
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x SPOL MIX SPKVOL L Switch" on
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x SPOR MIX SPKVOL R Switch" on
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x Speaker Channel Switch" on,on
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x Speaker L Playback Switch" on
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x Speaker R Playback Switch" on
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x Stereo DAC MIXL DAC L1 Switch" on
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x Stereo DAC MIXR DAC R1 Switch" on
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="I2S1 Mux" 1
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="ADMAIF1 Mux" 11
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x DAC1 HP Playback Volume" 126,126
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x DAC1 Playback Volume" 126,126
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x DAC1 Speaker Playback Volume" 126,126
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x HP Playback Volume" 0,0
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x Speaker Playback Volume" 35,35
|
||||
echo "Internal audio initialized."
|
||||
'');
|
||||
in
|
||||
let
|
||||
set-alsa-config = (
|
||||
pkgs.writeShellScriptBin "set-alsa-config" ''
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="I2S1 Sample Rate" 48000
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x SPK MIXL DAC L1 Switch" on
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x SPK MIXR DAC R1 Switch" on
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x SPOL MIX SPKVOL L Switch" on
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x SPOR MIX SPKVOL R Switch" on
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x Speaker Channel Switch" on,on
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x Speaker L Playback Switch" on
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x Speaker R Playback Switch" on
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x Stereo DAC MIXL DAC L1 Switch" on
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x Stereo DAC MIXR DAC R1 Switch" on
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="I2S1 Mux" 1
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="ADMAIF1 Mux" 11
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x DAC1 HP Playback Volume" 126,126
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x DAC1 Playback Volume" 126,126
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x DAC1 Speaker Playback Volume" 126,126
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x HP Playback Volume" 0,0
|
||||
${pkgs.alsa-utils}/bin/amixer -c1 cset name="x Speaker Playback Volume" 35,35
|
||||
echo "Internal audio initialized."
|
||||
''
|
||||
);
|
||||
in
|
||||
{
|
||||
environment.systemPackages = [
|
||||
set-alsa-config
|
||||
set-alsa-config
|
||||
];
|
||||
|
||||
services.pipewire = {
|
||||
# package = pkgs.pipewire-with-tegra;
|
||||
wireplumber = {
|
||||
extraConfig = {
|
||||
tegra-nx = {
|
||||
"monitor.alsa.rules" = [
|
||||
{
|
||||
matches = [
|
||||
{ "device.nick" = "tegra-snd-t210ref-mobile-rt565x"; }
|
||||
];
|
||||
actions = {
|
||||
update-props = {
|
||||
"audio.format" = "S16LE";
|
||||
"audio.rate" = 48000;
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
services.pipewire = {
|
||||
# package = pkgs.pipewire-with-tegra;
|
||||
wireplumber = {
|
||||
extraConfig = {
|
||||
tegra-nx = {
|
||||
"monitor.alsa.rules" = [
|
||||
{
|
||||
matches = [
|
||||
{ "device.nick" = "tegra-snd-t210ref-mobile-rt565x"; }
|
||||
];
|
||||
actions = {
|
||||
update-props = {
|
||||
"audio.format" = "S16LE";
|
||||
"audio.rate" = 48000;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
systemd.services.tegra-speaker-init = {
|
||||
wantedBy = [ "sound.target" ];
|
||||
script = ''
|
||||
${lib.getExe set-alsa-config}
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
systemd.services.tegra-speaker-init = {
|
||||
wantedBy = [ "sound.target" ];
|
||||
script = ''
|
||||
${lib.getExe set-alsa-config}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
inputs:
|
||||
{
|
||||
inputs: {
|
||||
imports = [
|
||||
./modules/boot.nix
|
||||
./modules/graphics.nix
|
||||
|
@@ -1,5 +1,4 @@
|
||||
inputs:
|
||||
rec {
|
||||
inputs: rec {
|
||||
switchroot-nixos = import ./switchroot-nixos.nix inputs;
|
||||
default = switchroot-nixos;
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
inputs:
|
||||
final: prev:
|
||||
inputs: final: prev:
|
||||
let
|
||||
callPackage' = prev.lib.callPackageWith (final // { inherit inputs; });
|
||||
alsa-lib = prev.alsa-lib.overrideAttrs (prev': {
|
||||
@@ -14,7 +13,8 @@ in
|
||||
prev.lib.packagesFromDirectoryRecursive {
|
||||
callPackage = callPackage';
|
||||
directory = ../pkgs/by-name;
|
||||
} // {
|
||||
}
|
||||
// {
|
||||
# alsa-lib = prev.alsa-lib.overrideAttrs (prev': {
|
||||
# pname = "${prev'.pname}-with-tegra";
|
||||
# postInstall = ''
|
||||
@@ -25,4 +25,3 @@ prev.lib.packagesFromDirectoryRecursive {
|
||||
# });
|
||||
pipewire-with-tegra = prev.pipewire.override { inherit alsa-lib; };
|
||||
}
|
||||
|
||||
|
@@ -1,11 +1,13 @@
|
||||
{ linuxPackagesFor
|
||||
, recurseIntoAttrs
|
||||
, linux_4_9-l4t
|
||||
{
|
||||
linuxPackagesFor,
|
||||
recurseIntoAttrs,
|
||||
linux_4_9-l4t,
|
||||
}:
|
||||
let
|
||||
packages = recurseIntoAttrs (linuxPackagesFor linux_4_9-l4t);
|
||||
crossCompiledPackages = recurseIntoAttrs (linuxPackagesFor linux_4_9-l4t.cross-compiled);
|
||||
in
|
||||
packages // {
|
||||
packages
|
||||
// {
|
||||
cross-compiled = crossCompiledPackages;
|
||||
}
|
||||
|
@@ -1,82 +1,87 @@
|
||||
{ sources
|
||||
, callPackage
|
||||
, inputs
|
||||
, buildLinux
|
||||
, fetchurl
|
||||
, lib
|
||||
{
|
||||
sources,
|
||||
callPackage,
|
||||
inputs,
|
||||
buildLinux,
|
||||
fetchurl,
|
||||
lib,
|
||||
|
||||
, ...
|
||||
} @ args:
|
||||
buildLinux (args // rec {
|
||||
version = "4.9.140-l4t";
|
||||
modDirVersion = version;
|
||||
src = "${sources.combined-src}/kernel";
|
||||
|
||||
enableCommonConfig = false;
|
||||
defconfig = "tegra_linux_defconfig";
|
||||
structuredExtraConfig = with lib.kernel; {
|
||||
AHCI_TEGRA = no;
|
||||
BATTERY_BQ27441 = no;
|
||||
BLK_DEV_DRBD = no;
|
||||
BLK_DEV_PCIESSD_MTIP32XX = no;
|
||||
BT_HCIBFUSB = no;
|
||||
BT_HCIBPA10X = no;
|
||||
BT_HCIUART_NOKIA = no;
|
||||
BT_HCIVHCI = no;
|
||||
BT_MRVL = no;
|
||||
BT_MTKUART = no;
|
||||
CPU_IDLE_TEGRA19X = no;
|
||||
CRYPTO_LRW = no;
|
||||
DRM_NOUVEAU = no;
|
||||
DRM_TEGRA = no;
|
||||
EVENTLIB = no;
|
||||
EXTCON_ADC_JACK = no;
|
||||
HMM_DMIRROR = no;
|
||||
I2C_TEGRA194_SLAVE = no;
|
||||
INV_ICM42600_I2C = no;
|
||||
MTTCAN = no;
|
||||
MTTCAN_IVC = no;
|
||||
NVI_MPU_IIO = no;
|
||||
NVI_MPU_INPUT = no;
|
||||
NVI_MPU_RELAY = no;
|
||||
NVS = no;
|
||||
NVS_BMI160_IIO = no;
|
||||
NVS_BMI160_INPUT = no;
|
||||
NVS_BMI160_RELAY = no;
|
||||
NVS_LED_TEST = no;
|
||||
PCIE_TEGRA = no;
|
||||
PWM_TEGRA_DFLL = no;
|
||||
QCOM_SPMI_IADC = no;
|
||||
QCOM_SPMI_TEMP_ALARM = no;
|
||||
QCOM_SPMI_VADC = no;
|
||||
REGULATOR_TPS61280 = no;
|
||||
RTC_DRV_RX6110 = no;
|
||||
SCSI_UFSHCD = no;
|
||||
SND_SOC_TEGRA = no;
|
||||
SND_SOC_TEGRA_T210REF_ALT = no;
|
||||
SND_SOC_TEGRA_T210REF_P2382_ALT = no;
|
||||
TEGRA_BOOTLOADER_BOOT_CFG = no;
|
||||
TEGRA_HOST1X = no;
|
||||
...
|
||||
}@args:
|
||||
buildLinux (
|
||||
args
|
||||
// rec {
|
||||
version = "4.9.140-l4t";
|
||||
modDirVersion = version;
|
||||
src = "${sources.combined-src}/kernel";
|
||||
|
||||
SND_SOC_TEGRA210_IQC_ALT = yes;
|
||||
# SND_SOC_TEGRA210_ADSP_ALT = no;
|
||||
SND_SOC_TEGRA_T186REF_ALT = no;
|
||||
};
|
||||
kernelPatches = [
|
||||
{
|
||||
name = "01-unify_l4t_sources.patch";
|
||||
patch = fetchurl {
|
||||
url = "https://raw.githubusercontent.com/libretro/Lakka-LibreELEC/refs/heads/devel/projects/L4T/devices/Switch/patches/l4t-kernel-sources/01-unify_l4t_sources.patch";
|
||||
hash = "sha256-RQPFgWWeDJNceKYGJ7bu/ElIyIU1uf2hf3KkUzTsjLE=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "02-set_kcflags.patch";
|
||||
patch = ./patches/02-set_kcflags.patch;
|
||||
}
|
||||
{
|
||||
name = "03-add_dtbs_install_target.patch";
|
||||
patch = ./patches/03-add_dtbs_install_target.patch;
|
||||
}
|
||||
];
|
||||
} // (args.argsOverride or {}))
|
||||
enableCommonConfig = false;
|
||||
defconfig = "tegra_linux_defconfig";
|
||||
structuredExtraConfig = with lib.kernel; {
|
||||
AHCI_TEGRA = no;
|
||||
BATTERY_BQ27441 = no;
|
||||
BLK_DEV_DRBD = no;
|
||||
BLK_DEV_PCIESSD_MTIP32XX = no;
|
||||
BT_HCIBFUSB = no;
|
||||
BT_HCIBPA10X = no;
|
||||
BT_HCIUART_NOKIA = no;
|
||||
BT_HCIVHCI = no;
|
||||
BT_MRVL = no;
|
||||
BT_MTKUART = no;
|
||||
CPU_IDLE_TEGRA19X = no;
|
||||
CRYPTO_LRW = no;
|
||||
DRM_NOUVEAU = no;
|
||||
DRM_TEGRA = no;
|
||||
EVENTLIB = no;
|
||||
EXTCON_ADC_JACK = no;
|
||||
HMM_DMIRROR = no;
|
||||
I2C_TEGRA194_SLAVE = no;
|
||||
INV_ICM42600_I2C = no;
|
||||
MTTCAN = no;
|
||||
MTTCAN_IVC = no;
|
||||
NVI_MPU_IIO = no;
|
||||
NVI_MPU_INPUT = no;
|
||||
NVI_MPU_RELAY = no;
|
||||
NVS = no;
|
||||
NVS_BMI160_IIO = no;
|
||||
NVS_BMI160_INPUT = no;
|
||||
NVS_BMI160_RELAY = no;
|
||||
NVS_LED_TEST = no;
|
||||
PCIE_TEGRA = no;
|
||||
PWM_TEGRA_DFLL = no;
|
||||
QCOM_SPMI_IADC = no;
|
||||
QCOM_SPMI_TEMP_ALARM = no;
|
||||
QCOM_SPMI_VADC = no;
|
||||
REGULATOR_TPS61280 = no;
|
||||
RTC_DRV_RX6110 = no;
|
||||
SCSI_UFSHCD = no;
|
||||
SND_SOC_TEGRA = no;
|
||||
SND_SOC_TEGRA_T210REF_ALT = no;
|
||||
SND_SOC_TEGRA_T210REF_P2382_ALT = no;
|
||||
TEGRA_BOOTLOADER_BOOT_CFG = no;
|
||||
TEGRA_HOST1X = no;
|
||||
|
||||
SND_SOC_TEGRA210_IQC_ALT = yes;
|
||||
# SND_SOC_TEGRA210_ADSP_ALT = no;
|
||||
SND_SOC_TEGRA_T186REF_ALT = no;
|
||||
};
|
||||
kernelPatches = [
|
||||
{
|
||||
name = "01-unify_l4t_sources.patch";
|
||||
patch = fetchurl {
|
||||
url = "https://raw.githubusercontent.com/libretro/Lakka-LibreELEC/refs/heads/devel/projects/L4T/devices/Switch/patches/l4t-kernel-sources/01-unify_l4t_sources.patch";
|
||||
hash = "sha256-RQPFgWWeDJNceKYGJ7bu/ElIyIU1uf2hf3KkUzTsjLE=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "02-set_kcflags.patch";
|
||||
patch = ./patches/02-set_kcflags.patch;
|
||||
}
|
||||
{
|
||||
name = "03-add_dtbs_install_target.patch";
|
||||
patch = ./patches/03-add_dtbs_install_target.patch;
|
||||
}
|
||||
];
|
||||
}
|
||||
// (args.argsOverride or { })
|
||||
)
|
||||
|
@@ -1,22 +1,24 @@
|
||||
{ callPackage
|
||||
, system
|
||||
, inputs
|
||||
{
|
||||
callPackage,
|
||||
system,
|
||||
inputs,
|
||||
|
||||
, ...
|
||||
} @ args:
|
||||
...
|
||||
}@args:
|
||||
let
|
||||
sources = callPackage ./sources.nix {};
|
||||
sources = callPackage ./sources.nix { };
|
||||
kernel = callPackage ./kernel.nix ({ inherit sources; } // args);
|
||||
kernelCross =
|
||||
let
|
||||
pkgsCross = import inputs.nixpkgs {
|
||||
localSystem = "x86_64-linux";
|
||||
crossSystem = system;
|
||||
localSystem = "x86_64-linux";
|
||||
crossSystem = system;
|
||||
};
|
||||
in
|
||||
pkgsCross.callPackage ./kernel.nix ({ inherit sources; } // args);
|
||||
pkgsCross.callPackage ./kernel.nix ({ inherit sources; } // args);
|
||||
in
|
||||
kernel // {
|
||||
cross-compiled = kernelCross;
|
||||
}
|
||||
# sources.combined-src
|
||||
kernel
|
||||
// {
|
||||
cross-compiled = kernelCross;
|
||||
}
|
||||
# sources.combined-src
|
||||
|
@@ -1,6 +1,7 @@
|
||||
{ fetchFromGitHub
|
||||
, fetchFromGitLab
|
||||
, runCommand
|
||||
{
|
||||
fetchFromGitHub,
|
||||
fetchFromGitLab,
|
||||
runCommand,
|
||||
}:
|
||||
let
|
||||
kernel_rev = "linux-dev";
|
||||
@@ -8,7 +9,8 @@ let
|
||||
nx_rev = "linux-dev";
|
||||
nv_rev = "linux-dev";
|
||||
nvgpu_rev = "linux-3.4.0-r32.5";
|
||||
in rec {
|
||||
in
|
||||
rec {
|
||||
# https://github.com/theofficialgman/l4t-image-buildscripts
|
||||
# kernel sources
|
||||
switch-l4t-kernel-4_9-src = fetchFromGitHub {
|
||||
@@ -68,7 +70,7 @@ in rec {
|
||||
hash = "sha256-sEZ51GyLvtS8pYP3jxATZDCJ7mpUI02VL3zFeWN1w1M=";
|
||||
};
|
||||
|
||||
combined-src = runCommand "combined-src" {} ''
|
||||
combined-src = runCommand "combined-src" { } ''
|
||||
mkdir -p $out/kernel
|
||||
cp --no-preserve=mode -r ${switch-l4t-kernel-4_9-src}/* $out/kernel/
|
||||
sed -i 's/\/bin\/pwd/pwd/' $out/kernel/Makefile
|
||||
|
@@ -1,7 +1,8 @@
|
||||
{ config
|
||||
, runCommand
|
||||
{
|
||||
config,
|
||||
runCommand,
|
||||
}:
|
||||
runCommand "nvidia-l4t-alsa-config" {} ''
|
||||
runCommand "nvidia-l4t-alsa-config" { } ''
|
||||
mkdir -p -p $out/share
|
||||
ln -s ${config}/usr/share/alsa $out/share/
|
||||
''
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{ callPackage }:
|
||||
let
|
||||
sources = callPackage ./sources.nix {};
|
||||
sources = callPackage ./sources.nix { };
|
||||
tegra-lib = callPackage ./tegra-lib.nix {
|
||||
inherit (sources) nvidia-drivers;
|
||||
};
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{ fetchzip
|
||||
, runCommand
|
||||
{
|
||||
fetchzip,
|
||||
runCommand,
|
||||
}:
|
||||
let
|
||||
# https://developer.nvidia.com/embedded/l4t-3231-archive
|
||||
@@ -8,27 +9,36 @@ let
|
||||
url = "https://developer.nvidia.com/embedded/dlc/r32-3-1_Release_v1.0/t210ref_release_aarch64/Tegra210_Linux_R32.3.1_aarch64.tbz2";
|
||||
hash = "sha256-UfPjgonDPMhxQMp/tlwo9NODIDd6rmXfwFJGNarQyMk=";
|
||||
};
|
||||
nvidia-drivers = runCommand "nvidia_drivers" {
|
||||
passthru.version = version;
|
||||
} ''
|
||||
mkdir $out
|
||||
cd $out
|
||||
tar -xjf ${driver-package}/nv_tegra/nvidia_drivers.tbz2
|
||||
'';
|
||||
nv-tools = runCommand "nvidia_tools" {
|
||||
passthru.version = version;
|
||||
} ''
|
||||
mkdir $out
|
||||
cd $out
|
||||
tar -xjf ${driver-package}/nv_tegra/nv_tools.tbz2
|
||||
'';
|
||||
config = runCommand "config" {
|
||||
passthru.version = version;
|
||||
} ''
|
||||
mkdir $out
|
||||
cd $out
|
||||
tar -xjf ${driver-package}/nv_tegra/config.tbz2
|
||||
'';
|
||||
nvidia-drivers =
|
||||
runCommand "nvidia_drivers"
|
||||
{
|
||||
passthru.version = version;
|
||||
}
|
||||
''
|
||||
mkdir $out
|
||||
cd $out
|
||||
tar -xjf ${driver-package}/nv_tegra/nvidia_drivers.tbz2
|
||||
'';
|
||||
nv-tools =
|
||||
runCommand "nvidia_tools"
|
||||
{
|
||||
passthru.version = version;
|
||||
}
|
||||
''
|
||||
mkdir $out
|
||||
cd $out
|
||||
tar -xjf ${driver-package}/nv_tegra/nv_tools.tbz2
|
||||
'';
|
||||
config =
|
||||
runCommand "config"
|
||||
{
|
||||
passthru.version = version;
|
||||
}
|
||||
''
|
||||
mkdir $out
|
||||
cd $out
|
||||
tar -xjf ${driver-package}/nv_tegra/config.tbz2
|
||||
'';
|
||||
in
|
||||
{
|
||||
inherit
|
||||
|
@@ -1,7 +1,8 @@
|
||||
{ nvidia-drivers
|
||||
, runCommand
|
||||
{
|
||||
nvidia-drivers,
|
||||
runCommand,
|
||||
}:
|
||||
runCommand "nvidia-l4t-tegra-firmware" {} ''
|
||||
runCommand "nvidia-l4t-tegra-firmware" { } ''
|
||||
mkdir -p $out
|
||||
cp --no-preserve=mode -r ${nvidia-drivers}/lib $out/
|
||||
cd $out/lib/firmware/gm20b
|
||||
|
@@ -1,19 +1,20 @@
|
||||
{ nvidia-drivers
|
||||
, runCommand
|
||||
, writers
|
||||
, stdenv
|
||||
, autoPatchelfHook
|
||||
, libgcc
|
||||
, libglvnd
|
||||
, glib
|
||||
, alsa-lib
|
||||
, cairo
|
||||
, pango
|
||||
, gtk3
|
||||
, libv4l
|
||||
, gst_all_1
|
||||
, wayland-scanner
|
||||
, egl-wayland
|
||||
{
|
||||
nvidia-drivers,
|
||||
runCommand,
|
||||
writers,
|
||||
stdenv,
|
||||
autoPatchelfHook,
|
||||
libgcc,
|
||||
libglvnd,
|
||||
glib,
|
||||
alsa-lib,
|
||||
cairo,
|
||||
pango,
|
||||
gtk3,
|
||||
libv4l,
|
||||
gst_all_1,
|
||||
wayland-scanner,
|
||||
egl-wayland,
|
||||
}:
|
||||
let
|
||||
library-files = stdenv.mkDerivation {
|
||||
@@ -71,11 +72,11 @@ let
|
||||
library_path = "${library-files}/lib/libEGL_nvidia.so.0";
|
||||
};
|
||||
};
|
||||
combined-files = runCommand "nvidia-l4t-tegra-lib-${nvidia-drivers.version}" {} ''
|
||||
combined-files = runCommand "nvidia-l4t-tegra-lib-${nvidia-drivers.version}" { } ''
|
||||
mkdir -p $out/share/{glvnd/egl_vendor.d,vulkan/icd.d}
|
||||
ln -s ${library-files}/lib $out/
|
||||
ln -s ${nvidia-json} $out/share/glvnd/egl_vendor.d/nvidia.json
|
||||
ln -s ${nvidia-icd-json} $out/share/vulkan/icd.d/nvidia_icd.json
|
||||
'';
|
||||
in
|
||||
combined-files
|
||||
combined-files
|
||||
|
@@ -1,6 +1,7 @@
|
||||
{ nv-tools
|
||||
, stdenv
|
||||
, autoPatchelfHook
|
||||
{
|
||||
nv-tools,
|
||||
stdenv,
|
||||
autoPatchelfHook,
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
name = "nvidia-l4t-tools";
|
||||
|
@@ -1,7 +1,8 @@
|
||||
{ config
|
||||
, runCommand
|
||||
{
|
||||
config,
|
||||
runCommand,
|
||||
}:
|
||||
runCommand "nvidia-l4t-udev-rules" {} ''
|
||||
runCommand "nvidia-l4t-udev-rules" { } ''
|
||||
mkdir -p $out/etc/udev/rules.d
|
||||
cp ${config}/etc/udev/rules.d/99-tegra-devices.rules $out/etc/udev/rules.d/
|
||||
sed '/\/usr\/sbin\/camera_device_detect/d' -i $out/etc/udev/rules.d/99-tegra-devices.rules
|
||||
|
@@ -1,10 +1,11 @@
|
||||
{ nvidia-drivers
|
||||
, runCommand
|
||||
{
|
||||
nvidia-drivers,
|
||||
runCommand,
|
||||
|
||||
, tegra-lib
|
||||
, iconv
|
||||
tegra-lib,
|
||||
iconv,
|
||||
}:
|
||||
runCommand "nvidia-l4t-x11-module" {} ''
|
||||
runCommand "nvidia-l4t-x11-module" { } ''
|
||||
mkdir -p $out/lib
|
||||
cp --no-preserve=mode -r ${nvidia-drivers}/usr/lib/xorg $out/lib
|
||||
patchelf \
|
||||
|
@@ -1,9 +1,10 @@
|
||||
{ toplevel
|
||||
{
|
||||
toplevel,
|
||||
|
||||
, writeTextFile
|
||||
, runCommand
|
||||
, writeShellApplication
|
||||
, ubootTools
|
||||
writeTextFile,
|
||||
runCommand,
|
||||
writeShellApplication,
|
||||
ubootTools,
|
||||
}:
|
||||
let
|
||||
boot-cmd-main = writeTextFile {
|
||||
@@ -430,10 +431,13 @@ let
|
||||
mkimage -A arm64 -C none -T script -d "$boot_scr" "$OUT"
|
||||
'';
|
||||
};
|
||||
boot-scr = runCommand "boot.scr" {
|
||||
passthru.buildScript = build-boot-scr;
|
||||
} ''
|
||||
${build-boot-scr}/bin/build-boot-scr ${toplevel} $out
|
||||
'';
|
||||
boot-scr =
|
||||
runCommand "boot.scr"
|
||||
{
|
||||
passthru.buildScript = build-boot-scr;
|
||||
}
|
||||
''
|
||||
${build-boot-scr}/bin/build-boot-scr ${toplevel} $out
|
||||
'';
|
||||
in
|
||||
boot-scr
|
||||
boot-scr
|
||||
|
@@ -1,8 +1,9 @@
|
||||
{ kernel
|
||||
, runCommand
|
||||
, android-tools
|
||||
{
|
||||
kernel,
|
||||
runCommand,
|
||||
android-tools,
|
||||
}:
|
||||
runCommand "nx-plat.dtimg" {} ''
|
||||
runCommand "nx-plat.dtimg" { } ''
|
||||
${android-tools}/bin/mkdtboimg create $out --page_size=1000 \
|
||||
${kernel}/dtbs/tegra210-odin.dtb --id=0x4F44494E \
|
||||
${kernel}/dtbs/tegra210b01-odin.dtb --id=0x4F44494E --rev=0xb01 \
|
||||
|
@@ -1,15 +1,16 @@
|
||||
{ pkgs
|
||||
, inputs
|
||||
, runCommand
|
||||
, imagemagick
|
||||
{
|
||||
pkgs,
|
||||
inputs,
|
||||
runCommand,
|
||||
imagemagick,
|
||||
}:
|
||||
let
|
||||
# icons = (import inputs.nixos-artwork { inherit pkgs; }).icons;
|
||||
base-svg = "${inputs.nixos-artwork}/logo/nix-snowflake-rainbow.svg";
|
||||
icon-bmp = runCommand "icon.bmp" {} ''
|
||||
icon-bmp = runCommand "icon.bmp" { } ''
|
||||
${imagemagick}/bin/magick \
|
||||
${base-svg} -channel rgba -alpha on -resize 192x192 \
|
||||
BMP3:$out
|
||||
'';
|
||||
in
|
||||
icon-bmp
|
||||
icon-bmp
|
||||
|
@@ -1,11 +1,12 @@
|
||||
{ callPackage
|
||||
, runCommand
|
||||
, writeShellApplication
|
||||
, closureInfo
|
||||
, inputs
|
||||
{
|
||||
callPackage,
|
||||
runCommand,
|
||||
writeShellApplication,
|
||||
closureInfo,
|
||||
inputs,
|
||||
|
||||
, rsync
|
||||
, openssh
|
||||
rsync,
|
||||
openssh,
|
||||
}:
|
||||
{
|
||||
kernel,
|
||||
@@ -50,28 +51,40 @@ let
|
||||
'';
|
||||
};
|
||||
|
||||
switchroot-boot = runCommand "switchroot-boot" {
|
||||
passthru = {
|
||||
inherit icon uInitrd uImage boot-scr dtb-image;
|
||||
};
|
||||
} ''
|
||||
mkdir -p $out
|
||||
switchroot-boot =
|
||||
runCommand "switchroot-boot"
|
||||
{
|
||||
passthru = {
|
||||
inherit
|
||||
icon
|
||||
uInitrd
|
||||
uImage
|
||||
boot-scr
|
||||
dtb-image
|
||||
;
|
||||
};
|
||||
}
|
||||
''
|
||||
mkdir -p $out
|
||||
|
||||
cp ${icon} $out/icon.bmp
|
||||
cp ${uInitrd} $out/initramfs
|
||||
cp ${uImage} $out/uImage
|
||||
cp ${boot-scr} $out/boot.scr
|
||||
cp ${dtb-image} $out/nx-plat.dtimg
|
||||
'';
|
||||
cp ${icon} $out/icon.bmp
|
||||
cp ${uInitrd} $out/initramfs
|
||||
cp ${uImage} $out/uImage
|
||||
cp ${boot-scr} $out/boot.scr
|
||||
cp ${dtb-image} $out/nx-plat.dtimg
|
||||
'';
|
||||
|
||||
package = runCommand "switchroot-pkg" {
|
||||
passthru.boot = switchroot-boot;
|
||||
} ''
|
||||
mkdir -p $out/{misc,switchroot}
|
||||
ln -s ${closure-info} $out/misc/closure-info
|
||||
ln -s ${copy-closure}/bin/copy-closure-to $out/misc/
|
||||
ln -s ${copy-via-ssh}/bin/copy-via-ssh $out/misc/
|
||||
ln -s ${switchroot-boot} $out/switchroot/nixos
|
||||
'';
|
||||
package =
|
||||
runCommand "switchroot-pkg"
|
||||
{
|
||||
passthru.boot = switchroot-boot;
|
||||
}
|
||||
''
|
||||
mkdir -p $out/{misc,switchroot}
|
||||
ln -s ${closure-info} $out/misc/closure-info
|
||||
ln -s ${copy-closure}/bin/copy-closure-to $out/misc/
|
||||
ln -s ${copy-via-ssh}/bin/copy-via-ssh $out/misc/
|
||||
ln -s ${switchroot-boot} $out/switchroot/nixos
|
||||
'';
|
||||
in
|
||||
package
|
||||
package
|
||||
|
@@ -1,14 +1,15 @@
|
||||
{ kernel
|
||||
, ubootTools
|
||||
, gzip
|
||||
, runCommand
|
||||
{
|
||||
kernel,
|
||||
ubootTools,
|
||||
gzip,
|
||||
runCommand,
|
||||
}:
|
||||
let
|
||||
image-gz = runCommand "Image.gz" {} ''
|
||||
image-gz = runCommand "Image.gz" { } ''
|
||||
${gzip}/bin/gzip -c ${kernel}/Image > $out
|
||||
'';
|
||||
uimage = runCommand "uImage" {} ''
|
||||
uimage = runCommand "uImage" { } ''
|
||||
${ubootTools}/bin/mkimage -A arm64 -a 0x80200000 -e 0x80200000 -n "NixOS kernel" -d ${image-gz} $out
|
||||
'';
|
||||
in
|
||||
uimage
|
||||
uimage
|
||||
|
@@ -1,8 +1,9 @@
|
||||
{ initialRamdisk
|
||||
, ubootTools
|
||||
, runCommand
|
||||
{
|
||||
initialRamdisk,
|
||||
ubootTools,
|
||||
runCommand,
|
||||
}:
|
||||
runCommand "uInitrd" {} ''
|
||||
runCommand "uInitrd" { } ''
|
||||
initrdFile="${initialRamdisk}/initrd"
|
||||
${ubootTools}/bin/mkimage -A arm64 -T ramdisk -C gzip -n "NixOS initrd" -d $initrdFile $out
|
||||
''
|
||||
|
@@ -1,4 +1,4 @@
|
||||
{ nixpkgs, ... } @ inputs:
|
||||
{ nixpkgs, ... }@inputs:
|
||||
let
|
||||
supportedSystems = [
|
||||
"aarch64-linux"
|
||||
@@ -10,7 +10,8 @@ let
|
||||
packagesFromDirectoryRecursive
|
||||
callPackageWith
|
||||
;
|
||||
pkgsForSystem = system:
|
||||
pkgsForSystem =
|
||||
system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
# inherit system;
|
||||
@@ -25,16 +26,12 @@ let
|
||||
directory = ./by-name;
|
||||
};
|
||||
in
|
||||
localPkgs;
|
||||
pkgsSets =
|
||||
listToAttrs
|
||||
(
|
||||
map
|
||||
(system: {
|
||||
name = system;
|
||||
value = pkgsForSystem system;
|
||||
})
|
||||
supportedSystems
|
||||
);
|
||||
localPkgs;
|
||||
pkgsSets = listToAttrs (
|
||||
map (system: {
|
||||
name = system;
|
||||
value = pkgsForSystem system;
|
||||
}) supportedSystems
|
||||
);
|
||||
in
|
||||
pkgsSets
|
||||
pkgsSets
|
||||
|
Reference in New Issue
Block a user