Add scripts for installing drivers

This commit is contained in:
Manuel Thalmann 2024-09-20 02:01:22 +02:00
parent 5ad3657b32
commit c5fbcc0a4b
9 changed files with 184 additions and 0 deletions

View file

@ -14,6 +14,18 @@
default = []; default = [];
}; };
surfaceBook = mkOption {
type = types.bool;
description = "A value indicating whether the system is a Surface Book 2.";
default = false;
};
xoneReceiver = mkOption {
type = types.bool;
description = "A value indicating whether an Xbox receiver is present.";
default = false;
};
eyeX = mkOption { eyeX = mkOption {
type = types.bool; type = types.bool;
description = "A value indicating whether a Tobii EyeX device is present."; description = "A value indicating whether a Tobii EyeX device is present.";

View file

@ -42,6 +42,7 @@
"Predator Z301C" "Predator Z301C"
]; ];
xoneReceiver = true;
eyeX = true; eyeX = true;
amdCPU = true; amdCPU = true;
nvidiaGPU = true; nvidiaGPU = true;

View file

@ -7,6 +7,12 @@
valhalla = { valhalla = {
hostname = "manu-surface"; hostname = "manu-surface";
linux.secureBoot = true; linux.secureBoot = true;
hardware = {
surfaceBook = true;
xoneReceiver = true;
};
partition.os.deviceName = "nvme0n1"; partition.os.deviceName = "nvme0n1";
}; };
}; };

View file

@ -0,0 +1,44 @@
#!/bin/env fish
begin
set -l dir (status dirname)
source "$dir/../../Scripts/software.fish"
function installSW -V dir
set -l repo "linux-surface"
set -l file "/etc/pacman.conf"
curl -s https://raw.githubusercontent.com/linux-surface/linux-surface/master/pkg/keys/surface.asc \
| sudo pacman-key --add -
sudo pacman-key --finger 56C464BAAC421453
sudo pacman-key --lsign-key 56C464BAAC421453
if ! grep "^\[$repo\]\$" $file
begin
printf %s\n \
"" \
"[$repo]" \
"Server = https://pkg.surfacelinux.com/arch/"
end | sudo tee -a $file > /dev/null
sudo pacinst
sudo pacinst \
intel-ucode \
linux-surface \
linux-surface-headers \
linux-surface-secureboot-mok \
iptsd \
linux-firmware-marvell
yes | runYay libwacom-surface
yayinst libcamera-git
end
end
function configureSW -V dir
fish "$dir/../../Software/GRUB/main.fish" configure
end
runInstaller $argv
end

View file

@ -0,0 +1,25 @@
#!/bin/env fish
begin
set -l dir (status dirname)
source "$dir/../../Scripts/software.fish"
function installSW -V dir
yayinst \
surface-dtx-daemon-bin \
surface-control-bin
end
function configureSW -V dir
begin
printf %s\n \
"# vim:set ft=sh" \
"MODULES+=(pinctrl_sunrisepoint surface_dtx)"
end | sudo tee /etc/mkinitcpio.conf.d/surface-book-2.conf > /dev/null
sudo systemctl enable surface-dtx-daemon.service
sudo systemctl enable --global surface-dtx-userd.service
end
runInstaller $argv
fish "$dir/../Surface/main.fish" $argv
end

View file

@ -18,6 +18,18 @@ function deploySoftware -d "Deploys a the specified software action" -a action
source "$dir/../Config/SecureBoot/main.fish" $argv source "$dir/../Config/SecureBoot/main.fish" $argv
end end
and if isEnabled valhalla.linux.hardware.surfaceBook
source "$dir/../Drivers/SurfaceBook2/main.fish" $argv
end
and if isEnabled valhalla.linux.hardware.nvidiaGPU
source "$dir/../Software/nvidia-dkms/main.fish" $argv
end
and if isEnabled valhalla.linux.hardware.xoneReceiver
source "$dir/../Software/xone/main.fish" $argv
end
and if isEnabled valhalla.windows.dualboot.enable && $isInstall and if isEnabled valhalla.windows.dualboot.enable && $isInstall
yayinst bt-dualboot yayinst bt-dualboot
end end

View file

@ -0,0 +1,28 @@
#!/bin/env fish
begin
set -l dir (status dirname)
source "$dir/../../Scripts/software.fish"
function installSW
yayinst \
nvidia-beta-dkms \
lib32-nvidia-utils-beta
end
function configureSW -V dir
begin
printf %s\n \
"MODULES+=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)" \
"" \
'for i in "${!HOOKS[@]}"; do' \
' if [ "${HOOKS[i]}" = "kms" ]; then' \
' unset "HOOKS[i]"' \
" fi" \
"done"
end | sudo tee /etc/mkinitcpio.conf.d/nvidia.conf > /dev/null
fish "$dir/../../../Common/Software/nvidia-dkms/main.fish" configure
end
runInstaller $argv
end

View file

@ -0,0 +1,22 @@
#!/bin/env fish
begin
set -l dir (status dirname)
source "$dir/../../Scripts/software.fish"
function installSW
set -l contextRoot (mktemp -d)
set -l repo https://github.com/manuth/xone.git
yayinst cabextract
if not dkms status --all | grep xone > /dev/null
git clone "$repo" "$contextRoot"
sudo env -C "$contextRoot" ./install.sh --release
sudo chmod -R a+rx /usr/src/xone*
yes "" | sudo xone-get-firmware.sh
end
rm -rf "$contextRoot" > /dev/null
end
runInstaller $argv
end

View file

@ -0,0 +1,34 @@
#!/bin/env fish
begin
set -l dir (status dirname)
source "$dir/../../Scripts/software.fish"
function configureSW -V dir
set -l indicator "GRUB_CMDLINE_LINUX_DEFAULT=\""
set -l config "nvidia_drm.fbdev=1"
# According to: https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks
begin
printf %s\n \
"options nvidia NVreg_PreserveVideoMemoryAllocations=1" \
"options nvidia NVreg_TemporaryFilePath=/var/tmp"
end | sudo tee /etc/modprobe.d/nvidia-power-management.conf > /dev/null
sudo systemctl enable \
nvidia-suspend.service \
nvidia-hibernate.service \
nvidia-resume.service
if ! cat /etc/default/grub | grep "$indicator.*$config" > /dev/null
sudo sed -i /etc/default/grub \
-e "/$indicator/{" \
-e "s/\($indicator.*[^ ]\)\(\"\)/\1 \2/" \
-e "s/\($indicator.*\)\(\"\)/\1$config\2/" \
-e "}"
fish "$dir/../GRUB/main.fish" configure
end
end
runInstaller $argv
end