configurations: update

This commit is contained in:
Mateusz Słodkowicz 2023-09-17 13:00:37 +02:00
parent e70cb83ce8
commit 96c425a05e
Signed by: materus
GPG Key ID: 28D140BCA60B4FD1
13 changed files with 218 additions and 162 deletions

View File

@ -9,6 +9,8 @@
./scripts.nix
./tmp.nix
./network.nix
./kde.nix
];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";

View File

@ -12,13 +12,22 @@
enableTerminal = lib.mkDefault true;
enableTerminalExtra = lib.mkDefault true;
enableNixDevel = lib.mkDefault true;
editor.code.fhs.enable = true;
editor.code.fhs.packages = (ps: with ps;[
llvmPackages_16.clang
llvmPackages_16.llvm
llvmPackages_16.bintools
llvmPackages_16.lld
llvmPackages_16.lldb
llvmPackages_16.libllvm
]);
};
home.packages = [
pkgs.papirus-icon-theme
materusPkgs.ffmpeg6-amf-full
(materusPkgs.polymc.wrap { extraJDKs = [ pkgs.graalvm17-ce ]; })
(materusPkgs.polymc.wrap { extraJDKs = [ pkgs.graalvm17-ce ]; extraLibs = [ ]; })
];
programs.obs-studio = {

View File

@ -19,6 +19,7 @@
services.gnome.core-os-services.enable = true;
programs.gnupg.agent.pinentryFlavor = "gnome3";
programs.gnome-terminal.enable = true;

View File

@ -1,11 +1,26 @@
{ config, pkgs, lib, inputs, materusFlake, ... }:
let
video = [
#"video=DP-3:1920x1080@144"
"video=HDMI-A-3:1920x1080@144"
"video=DP-1:1920x1080@240"
#"video=DP-2:1920x1080@240"
#"video=HDMI-A-1:1920x1080@240"
#"video=HDMI-A-2:1920x1080@240"
];
in
{
#Kernel
boot.kernelPackages = pkgs.linuxPackages_zen;
boot.kernelParams = [ "nvme_core.default_ps_max_latency_us=0" "nvme_core.io_timeout=255" "nvme_core.max_retries=10" "nvme_core.shutdown_timeout=10" "amd_iommu=on" "iommu=pt" "pcie_acs_override=downstream,multifunction" ];
boot.kernelModules = [ "i2c_dev" "kvm_amd" "vfio-pci" "v4l2loopback" "kvmfr" ];
boot.kernelParams = [ /*"pci-stub.ids=1002:744c"*/ "nox2apic" "nvme_core.default_ps_max_latency_us=0" "nvme_core.io_timeout=255" "nvme_core.max_retries=10" "nvme_core.shutdown_timeout=10" "amd_iommu=on" "iommu=pt"] ++ video;
boot.kernelModules = [ "pci-stub" "amdgpu" "i2c_dev" "kvm_amd" "vfio" "vfio_iommu_type1" "vfio-pci" "v4l2loopback" ];
boot.extraModprobeConfig = ''
options kvm_amd nested=1
options kvm_amd nested=1 avic=1 npt=1
options vfio_iommu_type1 allow_unsafe_interrupts=1
'';
boot.kernel.sysctl = {"vm.max_map_count" = 1000000;};
@ -13,7 +28,7 @@
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback kvmfr];
boot.extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ];
boot.supportedFilesystems = [ "ntfs" "btrfs" "vfat" "exfat" "ext4"];
@ -28,8 +43,8 @@
enable = true;
efiSupport = true;
device = "nodev";
gfxmodeEfi = pkgs.lib.mkDefault "1920x1080";
gfxmodeBios = pkgs.lib.mkDefault "1920x1080";
gfxmodeEfi = pkgs.lib.mkDefault "1920x1080@240";
gfxmodeBios = pkgs.lib.mkDefault "1920x1080@240";
useOSProber = true;
memtest86.enable = true;
};

View File

@ -15,7 +15,7 @@ in
];
hardware.firmware = with pkgs; [
materusPkgs.amdgpu-pro-libs.firmware.vcn
materusPkgs.amdgpu-pro-libs.firmware
#materusPkgs.amdgpu-pro-libs.firmware
linux-firmware
alsa-firmware
sof-firmware
@ -45,12 +45,14 @@ in
materusPkgs.i686Linux.amdgpu-pro-libs.vulkan
libvdpau-va-gl
];
#GPU bar size
users.groups.gpurun = {};
services.udev.extraRules = ''
#GPU bar size
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x1002", ATTR{device}=="0x744c", ATTR{resource0_resize}="15"
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x1002", ATTR{device}=="0x744c", ATTR{resource2_resize}="8"
'';
#Trim
services.fstrim = {

View File

@ -35,7 +35,7 @@ in
CursorSize = "24";
};
Wayland = {
#CompositorCommand = "${pkgs.weston}/bin/weston --drm-device=card0 --additional-devices=card1 -c ${westonSddm}";
#CompositorCommand = "${pkgs.weston}/bin/weston -c ${westonSddm}";
};
};
services.xserver.desktopManager.plasma5.enable = true;
@ -46,7 +46,7 @@ in
environment.plasma5.excludePackages = with pkgs; [ libsForQt5.kwallet libsForQt5.kwalletmanager libsForQt5.kwallet-pam ];
environment.variables = {
KWIN_DRM_NO_AMS = "1";
#KWIN_DRM_NO_AMS = "1";
};
environment.systemPackages = with pkgs; [

View File

@ -1,4 +1,5 @@
{ config, pkgs, lib, inputs, materusFlake, materusPkgs, ... }:
{
virtualisation.lxc.enable = false;
virtualisation.lxc.lxcfs.enable = false;
@ -12,7 +13,7 @@
services.xserver.displayManager.startx.enable = true;
services.teamviewer.enable = true;
systemd.tmpfiles.rules = [
@ -37,17 +38,16 @@
services.xserver.videoDrivers = [ "amdgpu" ];
services.dbus.enable = true;
services.dbus.packages = [ pkgs.gcr_4 ];
services.xserver.displayManager.lightdm.enable = true;
services.xserver.displayManager.lightdm.greeters.enso.enable = true;
services.xserver.displayManager.lightdm.greeters.enso.blur = true;
services.xserver.desktopManager.plasma5.enable = true;
services.xserver.desktopManager.plasma5.phononBackend = "gstreamer";
services.xserver.desktopManager.plasma5.useQtScaling = true;
services.xserver.desktopManager.plasma5.runUsingSystemd = true;
environment.plasma5.excludePackages = with pkgs; [ libsForQt5.kwallet libsForQt5.kwalletmanager libsForQt5.kwallet-pam ];
#services.xserver.displayManager.autoLogin.user = "materus";
services.xserver.displayManager.startx.enable = false;
/*
services.xserver.displayManager.lightdm.enable = true;
services.xserver.displayManager.lightdm.greeters.enso.enable = true;
services.xserver.displayManager.lightdm.greeters.enso.blur = true;
*/
services.xserver.config = pkgs.lib.mkAfter ''
Section "OutputClass"
Identifier "amd-options"
@ -60,8 +60,7 @@
'';
services.xserver.displayManager.defaultSession = "plasmawayland";
services.xserver.displayManager.autoLogin.user = "materus";
services.printing.enable = true;
@ -106,11 +105,11 @@
# ];
};
environment.variables = {
KWIN_DRM_NO_AMS = "1";
DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1 = "1";
VK_ICD_FILENAMES = "/run/opengl-driver/share/vulkan/icd.d/radeon_icd.x86_64.json:/run/opengl-driver-32/share/vulkan/icd.d/radeon_icd.i686.json";
AMD_VULKAN_ICD = "RADV";
RADV_PERFTEST = "gpl,rt,sam";
ALSOFT_DRIVERS = "pulse";
};
environment.sessionVariables = rec {
XDG_CACHE_HOME = "\${HOME}/.cache";
@ -131,7 +130,7 @@
'';
i18n.inputMethod.enabled = "fcitx5";
i18n.inputMethod.fcitx5.addons = [ pkgs.fcitx5-configtool pkgs.fcitx5-lua pkgs.fcitx5-mozc pkgs.libsForQt5.fcitx5-qt ];
i18n.inputMethod.fcitx5.addons = [ pkgs.fcitx5-configtool pkgs.fcitx5-lua pkgs.fcitx5-mozc pkgs.fcitx5-gtk pkgs.libsForQt5.fcitx5-qt ];
# Some programs need SUID wrappers, can be configured further or are
@ -150,7 +149,7 @@
enable = true;
enableSSHSupport = false;
enableBrowserSocket = true;
pinentryFlavor = "gtk2";
};
programs.ssh.startAgent = true;
services.openssh.enable = true;
@ -198,7 +197,7 @@
gtk3
gtk4
gsettings-desktop-schemas
libsForQt5.dolphin
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
@ -268,6 +267,8 @@
monkeysphere
gparted
virt-viewer
inkscape
gimp
@ -282,22 +283,6 @@
binutils
config.materus.profile.packages.firefox
/*
gnome3.adwaita-icon-theme
gnome3.gnome-tweaks
gnome3.gnome-color-manager
gnome3.gnome-shell-extensions
gnomeExtensions.appindicator
gnomeExtensions.desktop-clock
gnomeExtensions.gtk4-desktop-icons-ng-ding
gnomeExtensions.compiz-windows-effect
gnomeExtensions.burn-my-windows
gnomeExtensions.user-themes
gnomeExtensions.gsconnect
gnomeExtensions.dash-to-panel
gnomeExtensions.dash-to-dock
*/
];
@ -308,148 +293,148 @@
environment.etc = {
/*
"libvirt/hooks/qemu.d/win11/prepare/begin/start.sh" = {
"libvirt/hooks/qemu.d/win11/prepare/begin/start.sh" = {
text =
''
#!/usr/bin/env bash
# Debugging
exec 19>/home/materus/startlogfile
BASH_XTRACEFD=19
set -x
''
#!/usr/bin/env bash
# Debugging
exec 19>/home/materus/startlogfile
BASH_XTRACEFD=19
set -x
exec 3>&1 4>&2
trap 'exec 2>&4 1>&3' 0 1 2 3
exec 1>/home/materus/startlogfile.out 2>&1
exec 3>&1 4>&2
trap 'exec 2>&4 1>&3' 0 1 2 3
exec 1>/home/materus/startlogfile.out 2>&1
# Stop display manager
killall -u materus
systemctl stop display-manager.service
killall gdm-x-session
#systemctl isolate multi-user.target
sleep 1
# Stop display manager
killall -u materus
systemctl stop display-manager.service
killall gdm-x-session
#systemctl isolate multi-user.target
sleep 1
# Load variables we defined
source "/etc/libvirt/hooks/kvm.conf"
# Load variables we defined
source "/etc/libvirt/hooks/kvm.conf"
# Isolate host to core 0
systemctl set-property --runtime -- user.slice AllowedCPUs=0
systemctl set-property --runtime -- system.slice AllowedCPUs=0
systemctl set-property --runtime -- init.scope AllowedCPUs=0
# Isolate host to core 0
systemctl set-property --runtime -- user.slice AllowedCPUs=0
systemctl set-property --runtime -- system.slice AllowedCPUs=0
systemctl set-property --runtime -- init.scope AllowedCPUs=0
# Unbind VTconsoles
for (( i = 0; i < 16; i++))
do
if test -x /sys/class/vtconsole/vtcon"''${i}"; then
if [ "$(grep -c "frame buffer" /sys/class/vtconsole/vtcon"''${i}"/name)" = 1 ]; then
echo 0 > /sys/class/vtconsole/vtcon"''${i}"/bind
echo "$DATE Unbinding Console ''${i}"
fi
fi
done
# Unbind VTconsoles
for (( i = 0; i < 16; i++))
do
if test -x /sys/class/vtconsole/vtcon"''${i}"; then
if [ "$(grep -c "frame buffer" /sys/class/vtconsole/vtcon"''${i}"/name)" = 1 ]; then
echo 0 > /sys/class/vtconsole/vtcon"''${i}"/bind
echo "$DATE Unbinding Console ''${i}"
fi
fi
done
# Unbind EFI Framebuffer
echo "efi-framebuffer.0" > /sys/bus/platform/drivers/efi-framebuffer/unbind
# Unbind EFI Framebuffer
echo "efi-framebuffer.0" > /sys/bus/platform/drivers/efi-framebuffer/unbind
# Avoid race condition
sleep 1
# Avoid race condition
sleep 1
# Unload NVIDIA kernel modules
modprobe -r nvidia_uvm
modprobe -r nvidia_drm
modprobe -r nvidia_modeset
modprobe -r nvidia
modprobe -r i2c_nvidia_gpu
modprobe -r drm_kms_helper
modprobe -r drm
# Unload NVIDIA kernel modules
modprobe -r nvidia_uvm
modprobe -r nvidia_drm
modprobe -r nvidia_modeset
modprobe -r nvidia
modprobe -r i2c_nvidia_gpu
modprobe -r drm_kms_helper
modprobe -r drm
# Detach GPU devices from host
#virsh nodedev-detach $VIRSH_GPU_VIDEO
#virsh nodedev-detach $VIRSH_GPU_AUDIO
#virsh nodedev-detach $VIRSH_GPU_USB
#virsh nodedev-detach $VIRSH_GPU_SERIAL_BUS
# Detach GPU devices from host
#virsh nodedev-detach $VIRSH_GPU_VIDEO
#virsh nodedev-detach $VIRSH_GPU_AUDIO
#virsh nodedev-detach $VIRSH_GPU_USB
#virsh nodedev-detach $VIRSH_GPU_SERIAL_BUS
# Load vfio module
modprobe vfio
modprobe vfio_pci
modprobe vfio_iommu_type1
'';
# Load vfio module
modprobe vfio
modprobe vfio_pci
modprobe vfio_iommu_type1
'';
mode = "0755";
};
};
"libvirt/hooks/qemu.d/win11/release/end/stop.sh" = {
"libvirt/hooks/qemu.d/win11/release/end/stop.sh" = {
text =
''
#!/usr/bin/env bash
# Debugging
exec 19>/home/materus/stoplogfile
BASH_XTRACEFD=19
set -x
''
#!/usr/bin/env bash
# Debugging
exec 19>/home/materus/stoplogfile
BASH_XTRACEFD=19
set -x
exec 3>&1 4>&2
trap 'exec 2>&4 1>&3' 0 1 2 3
exec 1>/home/materus/stoplogfile.out 2>&1
exec 3>&1 4>&2
trap 'exec 2>&4 1>&3' 0 1 2 3
exec 1>/home/materus/stoplogfile.out 2>&1
# Load variables we defined
source "/etc/libvirt/hooks/kvm.conf"
# Load variables we defined
source "/etc/libvirt/hooks/kvm.conf"
# Unload vfio module
modprobe -r vfio-pci
modprobe -r vfio_iommu_type1
modprobe -r vfio
# Unload vfio module
modprobe -r vfio-pci
modprobe -r vfio_iommu_type1
modprobe -r vfio
modprobe drm
modprobe drm_kms_helper
modprobe i2c_nvidia_gpu
modprobe nvidia
modprobe nvidia_modeset
modprobe nvidia_drm
modprobe nvidia_uvm
modprobe drm
modprobe drm_kms_helper
modprobe i2c_nvidia_gpu
modprobe nvidia
modprobe nvidia_modeset
modprobe nvidia_drm
modprobe nvidia_uvm
# Attach GPU devices from host
#virsh nodedev-reattach $VIRSH_GPU_VIDEO
#virsh nodedev-reattach $VIRSH_GPU_AUDIO
#virsh nodedev-reattach $VIRSH_GPU_USB
#virsh nodedev-reattach $VIRSH_GPU_SERIAL_BUS
# Attach GPU devices from host
#virsh nodedev-reattach $VIRSH_GPU_VIDEO
#virsh nodedev-reattach $VIRSH_GPU_AUDIO
#virsh nodedev-reattach $VIRSH_GPU_USB
#virsh nodedev-reattach $VIRSH_GPU_SERIAL_BUS
#echo "0000:01:00.0" > /sys/bus/pci/drivers/nvidia/bind
# Bind EFI Framebuffer
echo "efi-framebuffer.0" > /sys/bus/platform/drivers/efi-framebuffer/bind
#echo "0000:01:00.0" > /sys/bus/pci/drivers/nvidia/bind
# Bind EFI Framebuffer
echo "efi-framebuffer.0" > /sys/bus/platform/drivers/efi-framebuffer/bind
# Bind VTconsoles
echo 1 > /sys/class/vtconsole/vtcon0/bind
#echo 1 > /sys/class/vtconsole/vtcon1/bind
# Bind VTconsoles
echo 1 > /sys/class/vtconsole/vtcon0/bind
#echo 1 > /sys/class/vtconsole/vtcon1/bind
# Start display manager
sleep 1
systemctl start display-manager.service
# Start display manager
sleep 1
systemctl start display-manager.service
# Return host to all cores
systemctl set-property --runtime -- user.slice AllowedCPUs=0-3
systemctl set-property --runtime -- system.slice AllowedCPUs=0-3
systemctl set-property --runtime -- init.scope AllowedCPUs=0-3
'';
# Return host to all cores
systemctl set-property --runtime -- user.slice AllowedCPUs=0-3
systemctl set-property --runtime -- system.slice AllowedCPUs=0-3
systemctl set-property --runtime -- init.scope AllowedCPUs=0-3
'';
text = ''
#!/usr/bin/env bash
reboot
'';*-/
mode = "0755";
};
"libvirt/vgabios/patched.rom".source = ./vbios.rom;
};
};
#!/usr/bin/env bash
reboot
'';*-/
mode = "0755";
};
"libvirt/vgabios/patched.rom".source = ./vbios.rom;
};
};
*/
};
}

View File

@ -1,6 +1,8 @@
{ config, pkgs, lib, inputs, materusFlake, ... }:
let
startHook = ''
# Debugging
# exec 19>/home/materus/startlogfile
# BASH_XTRACEFD=19
@ -10,10 +12,16 @@ let
# trap 'exec 2>&4 1>&3' 0 1 2 3
# exec 1>/home/materus/startlogfile.out 2>&1
# Make sure nothing renders on gpu to prevent "sysfs: cannot create duplicate filename" after rebinding to amdgpu
chmod 0 /dev/dri/renderD128
fuser -k /dev/dri/renderD128
# Seems to fix reset bug for 7900 XTX
echo "0" > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/d3cold_allowed"
systemctl stop mountWin10Share.service
sleep 1s
echo ''$VIRSH_GPU_VIDEO > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/driver/unbind"
echo ''$VIRSH_GPU_AUDIO > "/sys/bus/pci/devices/''${VIRSH_GPU_AUDIO}/driver/unbind"
@ -23,6 +31,11 @@ let
echo "1" > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/resource2_resize"
systemctl set-property --runtime -- user.slice AllowedCPUs=12-15,28-31
systemctl set-property --runtime -- system.slice AllowedCPUs=12-15,28-31
systemctl set-property --runtime -- init.scope AllowedCPUs=12-15,28-31
'';
stopHook = ''
@ -37,15 +50,17 @@ let
sleep 1s
echo ''$VIRSH_GPU_VIDEO > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/driver/unbind"
echo ''$VIRSH_GPU_AUDIO > "/sys/bus/pci/devices/''${VIRSH_GPU_AUDIO}/driver/unbind"
sleep 1s
echo "15" > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/resource0_resize"
echo "8" > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/resource2_resize"
echo "1" > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/d3cold_allowed"
echo ''$VIRSH_GPU_VIDEO > /sys/bus/pci/drivers/amdgpu/bind
echo ''$VIRSH_GPU_AUDIO > /sys/bus/pci/drivers/snd_hda_intel/bind
@ -53,6 +68,12 @@ let
systemctl start mountWin10Share.service
systemctl set-property --runtime -- user.slice AllowedCPUs=0-31
systemctl set-property --runtime -- system.slice AllowedCPUs=0-31
systemctl set-property --runtime -- init.scope AllowedCPUs=0-31
'';
in
{
@ -70,7 +91,7 @@ in
VIRSH_GPU_AUDIO="0000:03:00.1"
VIRSH_USB1="0000:10:00.0"
if [ ''$1 = "win10" ]; then
if [ ''$1 = "win10" ] || [ ''$1 = "win11" ]; then
if [ ''$2 = "prepare" ] && [ ''$3 = "begin" ]; then
${startHook}
fi
@ -87,7 +108,7 @@ in
systemd.services.mountWin10Share = {
wantedBy = [ "multi-user.target" ];
path = [ config.virtualisation.libvirtd.qemu.package pkgs.util-linux pkgs.kmod pkgs.coreutils ];
path = [ config.virtualisation.libvirtd.qemu.package pkgs.util-linux pkgs.kmod pkgs.coreutils pkgs.psmisc ];
serviceConfig.Type = "oneshot";
serviceConfig.RemainAfterExit = true;
script = ''

View File

@ -41,7 +41,7 @@
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = false;
networking.nameservers = [ "127.0.0.1" ];
networking.nameservers = [ "9.9.9.9" "1.1.1.1" "8.8.8.8" ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

View File

@ -16,7 +16,7 @@ in
config.nixpkgs.config = lib.mkIf cfg.enable{
allowUnfree = lib.mkDefault true;
joypixels.acceptLicense = lib.mkDefault true;
firefox.enablePlasmaBrowserIntegration = lib.mkDefault true;
firefox.enablePlasmaBrowserIntegration = lib.mkDefault config.services.xserver.desktopManager.plasma5.enable;
};
config.nixpkgs.overlays = lib.mkIf cfg.enableOverlays [inputs.emacs-overlay.overlay];
}

View File

@ -31,7 +31,7 @@ with materusPkgs.lib;
tdesktop
mpv
ani-cli
(pkgs.obsidian.override {electron = pkgs.electron;})
(pkgs.obsidian)
spotify
thunderbird
keepassxc

View File

@ -4,11 +4,12 @@ let
in
{
options.materus.profile.editor.code.enable = materusPkgs.lib.mkBoolOpt config.materus.profile.enableDesktop "Enable VSCodium with materus cfg";
options.materus.profile.editor.code.fhs.enable = materusPkgs.lib.mkBoolOpt false "Use fhs vscodium";
options.materus.profile.editor.code.fhs.packages = lib.mkOption { default = (ps: []);};
config = lib.mkIf cfg.enable {
programs.vscode = {
enable = lib.mkDefault true;
package = lib.mkDefault pkgs.vscodium;
package = lib.mkDefault (if (cfg.fhs.enable) then (pkgs.vscodium.fhsWithPackages cfg.fhs.packages) else pkgs.vscodium);
mutableExtensionsDir = lib.mkDefault true;
};
materus.profile.fonts.enable = lib.mkDefault true;

View File

@ -1,10 +1,30 @@
{ config, pkgs, lib, materusPkgs, inputs, ... }:
let
optHip = pkgs.stdenv.mkDerivation rec {
pname = "optHip";
version = pkgs.hip.version;
dontFixup = true;
dontBuild = true;
dontPatchELF = true;
dontUnpack = true;
sourceRoot = ".";
buildInputs = [
pkgs.hip
];
installPhase = ''
mkdir -p $out/opt/rocm
ln -s ${pkgs.hip} $out/opt/rocm/hip
'';
};
steamPkg = pkgs.steam.override {
extraPkgs = pkgs: [
config.materus.profile.packages.firefox
optHip #for blender
pkgs.steamcmd
pkgs.nss_latest
pkgs.libstrangle