Rebase to flake parts #4
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
# Monitor layout for 14900k (ported from NixOS-New `hosts/clients/14900k/home.nix`).
|
||||
# Niri: `chiasson.desktop.niri.extraSettings.extraConfig` (wrapper-modules / system package).
|
||||
# Hyprland: `chiasson.desktop.hyprland.settings` (merged in HM when `chiasson.desktop.hyprland.enable`).
|
||||
|
||||
#TODO[epic=Moderate] Clean this up, move to host's configuration.nix.
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
gpuPassthrough = config.chiasson.system.vm.gpuPassthrough.enable;
|
||||
in
|
||||
{
|
||||
chiasson.desktop.niri.extraSettings.extraConfig =
|
||||
if gpuPassthrough then
|
||||
''
|
||||
output "DP-1" {
|
||||
mode "2560x1080@144"
|
||||
scale 1.0
|
||||
position x=1920 y=0
|
||||
focus-at-startup
|
||||
}
|
||||
output "HDMI-A-2" {
|
||||
mode "1920x1080@60"
|
||||
scale 1.0
|
||||
position x=0 y=0
|
||||
}
|
||||
''
|
||||
else
|
||||
''
|
||||
output "DP-2" {
|
||||
mode "2560x1080@144"
|
||||
scale 1.0
|
||||
position x=0 y=0
|
||||
focus-at-startup
|
||||
}
|
||||
output "HDMI-A-3" {
|
||||
mode "1920x1080@60"
|
||||
scale 1.0
|
||||
position x=-1920 y=0
|
||||
}
|
||||
output "DP-4" {
|
||||
mode "1920x1080@144"
|
||||
scale 1.0
|
||||
position x=0 y=-1080
|
||||
}
|
||||
|
||||
'';
|
||||
|
||||
chiasson.desktop.hyprland.settings = lib.mkIf config.chiasson.desktop.hyprland.enable (
|
||||
let
|
||||
monitorList =
|
||||
if gpuPassthrough then
|
||||
[
|
||||
"DP-1, 2560x1080@144, 0x0, 1"
|
||||
"HDMI-A-2, 1920x1080@60, auto-up, 1"
|
||||
]
|
||||
else
|
||||
[
|
||||
"DP-2, 2560x1080@144, 0x0, 1"
|
||||
"DP-4, 1920x1080@144, 0x-1080, 1"
|
||||
"HDMI-A-3, 1920x1080@60, -1920x0, 1"
|
||||
];
|
||||
workspaceList =
|
||||
if gpuPassthrough then
|
||||
[
|
||||
"1, monitor:DP-1, default:true"
|
||||
"2, monitor:DP-1"
|
||||
"3, monitor:DP-1"
|
||||
"4, monitor:DP-1"
|
||||
"5, monitor:HDMI-A-2, default:true"
|
||||
"6, monitor:HDMI-A-2"
|
||||
"7, monitor:HDMI-A-2"
|
||||
"8, monitor:HDMI-A-2"
|
||||
"9, monitor:DP-1"
|
||||
]
|
||||
else
|
||||
[
|
||||
"1, monitor:DP-3, default:true"
|
||||
"2, monitor:DP-3"
|
||||
"3, monitor:DP-3"
|
||||
"4, monitor:Unknown-2, default:true"
|
||||
"5, monitor:Unknown-2"
|
||||
"6, monitor:Unknown-2"
|
||||
"7, monitor:DP-4"
|
||||
"8, monitor:DP-4"
|
||||
"9, monitor:DP-4"
|
||||
];
|
||||
in
|
||||
{
|
||||
monitor = lib.mkBefore monitorList;
|
||||
workspace = workspaceList;
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
# NVIDIA for host desktop; when `chiasson.system.vm.gpuPassthrough` is enabled, drop NVIDIA for VFIO (port later).
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
passthrough = config.chiasson.system.vm.gpuPassthrough.enable;
|
||||
in
|
||||
{
|
||||
boot.kernelParams = [ "snd_hda_core.gpu_bind=0" ];
|
||||
boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
||||
|
||||
services.xserver.videoDrivers = if passthrough then [ "modesetting" ] else [ "nvidia" ];
|
||||
|
||||
hardware.nvidia =
|
||||
if passthrough then
|
||||
lib.mkForce { }
|
||||
else {
|
||||
modesetting.enable = true;
|
||||
powerManagement.enable = false;
|
||||
powerManagement.finegrained = false;
|
||||
open = true;
|
||||
nvidiaSettings = true;
|
||||
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||
};
|
||||
|
||||
# Needed for `docker compose` GPU passthrough (e.g. `--gpus all` / DEVICE=gpu).
|
||||
hardware.nvidia-container-toolkit.enable = !passthrough;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
# Logitech Unifying / Bolt receivers; Keychron VIA/VIAL on hidraw.
|
||||
{ ... }:
|
||||
{
|
||||
hardware.logitech.wireless.enable = true;
|
||||
|
||||
services.udev.extraRules = ''
|
||||
# Keychron VIA/VIAL on hidraw
|
||||
KERNEL=="hidraw*", ATTRS{idVendor}=="3434", MODE="0660", GROUP="users", TAG+="uaccess", TAG+="udev-acl"
|
||||
# PS5 DualSense & DualSense Edge controllers over USB hidraw
|
||||
KERNEL=="hidraw*", ATTRS{idVendor}=="054c", ATTRS{idProduct}=="0ce6|0df2", MODE="0660", TAG+="uaccess"
|
||||
'';
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{ ... }: {
|
||||
#TODO[epic=Moderate] Clean this up, move to host's configuration.nix.
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
powerManagement.cpuFreqGovernor = "performance";
|
||||
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
hardware.enableAllFirmware = true;
|
||||
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
|
||||
system.stateVersion = "25.11";
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{ lib, pkgs, ... }:
|
||||
let
|
||||
uconsole4gRuntime = with pkgs; [
|
||||
bash
|
||||
coreutils
|
||||
gnugrep
|
||||
gnused
|
||||
gawk
|
||||
util-linux
|
||||
usbutils
|
||||
pciutils
|
||||
lsb-release
|
||||
libgpiod
|
||||
modemmanager
|
||||
iproute2
|
||||
iputils
|
||||
busybox
|
||||
socat
|
||||
systemd
|
||||
];
|
||||
|
||||
# Use a lightweight wrapper to avoid ShellCheck gating the build.
|
||||
uconsole4gCm5 = pkgs.writeShellScriptBin "uconsole-4g-cm5" ''
|
||||
export PATH=${lib.makeBinPath uconsole4gRuntime}:$PATH
|
||||
exec ${pkgs.bash}/bin/bash ${./uconsole-4g-cm5.sh} "$@"
|
||||
'';
|
||||
in
|
||||
{
|
||||
networking.modemmanager.enable = true;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
libgpiod
|
||||
uconsole4gCm5
|
||||
socat
|
||||
ripgrep
|
||||
];
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,16 @@
|
||||
{ pkgs, ... }: {
|
||||
# Keep Raspberry Pi kernel cmdline in sync with current system profile.
|
||||
system.activationScripts.updateRpiCmdline.text = ''
|
||||
export PATH="${pkgs.gnused}/bin:''${PATH}"
|
||||
for cmdline in /boot/firmware/nixos/*/cmdline.txt; do
|
||||
[ -e "$cmdline" ] || continue
|
||||
current_init="$(readlink -f /nix/var/nix/profiles/system)/init"
|
||||
if grep -q 'init=/nix/store/' "$cmdline"; then
|
||||
sed -i "s#init=/nix/store/[^ ]*/init#init=$current_init#" "$cmdline"
|
||||
fi
|
||||
if ! grep -q 'root=' "$cmdline"; then
|
||||
sed -i 's/ init=/ root=PARTUUID=4d44c78a-ee3c-4e3e-9eee-0f2eb10347b6 rootfstype=ext4 init=/' "$cmdline"
|
||||
fi
|
||||
done
|
||||
'';
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
{ ... }: {
|
||||
#TODO[epic=Moderate] Clean this up, move to host's configuration.nix.
|
||||
# Native Raspberry Pi boot flow.
|
||||
boot.loader.raspberry-pi.bootloader = "kernel";
|
||||
boot.loader.grub.enable = false;
|
||||
boot.consoleLogLevel = 7;
|
||||
boot.kernelModules = [ "nvme" ];
|
||||
|
||||
# Root device for kernel cmdline (NVMe boot).
|
||||
boot.kernelParams = [
|
||||
"root=PARTUUID=4d44c78a-ee3c-4e3e-9eee-0f2eb10347b6"
|
||||
"rootfstype=ext4"
|
||||
];
|
||||
|
||||
console = {
|
||||
earlySetup = true;
|
||||
font = "ter-v32n";
|
||||
};
|
||||
|
||||
# Enable PCIe x1 for CM5 NVMe adapter.
|
||||
hardware.raspberry-pi.config.cm5.base-dt-params.pciex1 = {
|
||||
enable = true;
|
||||
value = "on";
|
||||
};
|
||||
|
||||
powerManagement.cpuFreqGovernor = "powersave";
|
||||
|
||||
# Root + firmware as boot-critical mounts.
|
||||
fileSystems."/".neededForBoot = true;
|
||||
fileSystems."/boot/firmware".neededForBoot = true;
|
||||
|
||||
# Pi generational boot expects boot-firmware.mount to exist.
|
||||
systemd.mounts = [
|
||||
{
|
||||
what = "/dev/disk/by-label/FIRMWARE";
|
||||
where = "/boot/firmware";
|
||||
type = "vfat";
|
||||
options = "noatime,fmask=0022,dmask=0022";
|
||||
wantedBy = [ "local-fs.target" ];
|
||||
after = [ "local-fs-pre.target" ];
|
||||
}
|
||||
];
|
||||
|
||||
# There is no serial console on uConsole CM5 by default.
|
||||
systemd.services."serial-getty@ttyS0".enable = false;
|
||||
|
||||
system.stateVersion = "25.11";
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{ ... }: {
|
||||
#TODO[epic=Moderate] Clean this up, move to host's configuration.nix.
|
||||
# Enable uinput for gamepad remap.
|
||||
hardware.uinput.enable = true;
|
||||
programs.mosh.enable = true;
|
||||
}
|
||||
Reference in New Issue
Block a user