2023-05-18 12:07:07 +02:00
{ config , pkgs , lib , inputs , materusFlake , materusPkgs , . . . }:
let
grml-config = pkgs . fetchFromGitHub {
owner = " g r m l " ;
repo = " g r m l - e t c - c o r e " ;
rev = " a 2 c d a 8 5 d 3 d 5 6 f d 5 f 5 a 7 b 9 5 4 a 4 4 4 f d 1 5 1 3 1 8 c 4 6 8 0 " ;
sha256 = " 0 a p 8 l m q i 4 5 y j y j a z d m 1 v 6 4 f z 1 r f q h k h f p d p 2 z 1 7 a g 6 h s 5 w i 6 i 6 7 y " ;
} ;
in
{
virtualisation . lxc . enable = true ;
virtualisation . lxc . lxcfs . enable = true ;
virtualisation . lxd . enable = true ;
#virtualisation.lxd.recommendedSysctlSettings = true;
programs . corectrl . enable = true ;
programs . corectrl . gpuOverclock . enable = true ;
programs . corectrl . gpuOverclock . ppfeaturemask = " 0 x f f f f f f f f " ;
programs . gamemode . enable = true ;
services . xserver . displayManager . startx . enable = true ;
services . teamviewer . enable = true ;
2023-07-03 21:49:46 +02:00
2023-05-18 12:07:07 +02:00
systemd . tmpfiles . rules = [
2023-05-30 17:27:46 +02:00
" L + / o p t / r o c m / h i p - - - - ${ pkgs . hip } "
2023-05-18 12:07:07 +02:00
] ;
2023-05-30 17:27:46 +02:00
services . flatpak . enable = true ;
2023-05-18 12:07:07 +02:00
services . gvfs . enable = true ;
time . timeZone = " E u r o p e / W a r s a w " ;
i18n . defaultLocale = " p l _ P L . U T F - 8 " ;
console = {
font = " l a t 2 - 1 6 " ;
# keyMap = "pl";
useXkbConfig = true ; # use xkbOptions in tty.
} ;
services . xserver . layout = " p l " ;
services . xserver . enable = true ;
services . xserver . videoDrivers = [ " a m d g p u " ] ;
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 = " g s t r e a m e r " ;
services . xserver . desktopManager . plasma5 . useQtScaling = true ;
services . xserver . desktopManager . plasma5 . runUsingSystemd = true ;
2023-05-30 17:27:46 +02:00
environment . plasma5 . excludePackages = with pkgs ; [ libsForQt5 . kwallet libsForQt5 . kwalletmanager libsForQt5 . kwallet-pam ] ;
2023-05-18 12:07:07 +02:00
services . xserver . config = pkgs . lib . mkAfter ''
2023-05-30 17:27:46 +02:00
Section " O u t p u t C l a s s "
Identifier " a m d - o p t i o n s "
Option " T e a r F r e e " " T r u e "
Option " S W C u r s o r " " T r u e "
Option " V a r i a b l e R e f r e s h " " t r u e "
Option " A s y n c F l i p S e c o n d a r i e s " " t r u e "
2023-06-03 13:15:01 +02:00
MatchDriver " a m d g p u "
2023-05-30 17:27:46 +02:00
EndSection
2023-05-18 12:07:07 +02:00
2023-05-30 17:27:46 +02:00
'' ;
2023-05-18 12:07:07 +02:00
services . xserver . displayManager . defaultSession = " p l a s m a w a y l a n d " ;
services . xserver . displayManager . autoLogin . user = " m a t e r u s " ;
services . printing . enable = true ;
sound . enable = true ;
security . rtkit . enable = true ;
services . pipewire = {
enable = true ;
audio . enable = true ;
alsa . enable = true ;
alsa . support32Bit = true ;
pulse . enable = true ;
systemWide = true ;
# If you want to use JACK applications, uncomment this
jack . enable = true ;
} ;
hardware . pulseaudio . enable = false ;
services . xserver . libinput . enable = true ;
virtualisation . waydroid . enable = true ;
virtualisation . podman = {
enable = true ;
#enableNvidia = true;
dockerCompat = true ;
dockerSocket . enable = true ;
} ;
2023-07-03 21:52:23 +02:00
2023-07-03 21:49:46 +02:00
2023-05-18 12:07:07 +02:00
users . users . materus = {
isNormalUser = true ;
2023-07-03 21:52:23 +02:00
extraGroups = [ " a u d i o " " v i d e o " " r e n d e r " " p i p e w i r e " " w h e e l " " n e t w o r k m a n a g e r " " i n p u t " " k v m " " l i b v i r t - q e m u " " l i b v i r t " " l i b v i r t d " " p o d m a n " " l x d " ] ; # Enable ‘ sudo’ for the user.
2023-05-18 12:07:07 +02:00
shell = pkgs . bashInteractive ;
description = " M a t e u s z S ł o d k o w i c z " ;
# packages = with pkgs; [
# firefox
# thunderbird
# ];
} ;
environment . variables = {
KWIN_DRM_NO_AMS = " 1 " ;
2023-05-30 17:27:46 +02:00
DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1 = " 1 " ;
VK_ICD_FILENAMES = " / r u n / o p e n g l - d r i v e r / s h a r e / v u l k a n / i c d . d / r a d e o n _ i c d . x 8 6 _ 6 4 . j s o n : / r u n / o p e n g l - d r i v e r - 3 2 / s h a r e / v u l k a n / i c d . d / r a d e o n _ i c d . i 6 8 6 . j s o n " ;
AMD_VULKAN_ICD = " R A D V " ;
2023-05-18 12:07:07 +02:00
RADV_PERFTEST = " g p l , r t , s a m " ;
} ;
environment . sessionVariables = rec {
XDG_CACHE_HOME = " \$ { H O M E } / . c a c h e " ;
XDG_CONFIG_HOME = " \$ { H O M E } / . c o n f i g " ;
XDG_BIN_HOME = " \$ { H O M E } / . l o c a l / b i n " ;
XDG_DATA_HOME = " \$ { H O M E } / . l o c a l / s h a r e " ;
#SSH_ASKPASS_REQUIRE = "prefer";
MOZ_USE_XINPUT2 = " 1 " ;
PATH = [
" \$ { X D G _ B I N _ H O M E } "
] ;
} ;
environment . shellInit = ''
if ! [ - z " $ D I S P L A Y " ] ; then xhost + si:localuser:root & > /dev/null ; fi ;
if ! [ - z " $ D I S P L A Y " ] ; then xhost + si:localuser:$USER & > /dev/null ; fi ;
'' ;
i18n . inputMethod . enabled = " f c i t x 5 " ;
i18n . inputMethod . fcitx5 . addons = [ pkgs . fcitx5-configtool pkgs . fcitx5-lua pkgs . fcitx5-mozc pkgs . libsForQt5 . fcitx5-qt ] ;
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
services . pcscd . enable = true ;
services . samba-wsdd . enable = true ;
2023-07-03 21:49:46 +02:00
services . samba = {
enable = true ;
package = pkgs . sambaFull ;
} ;
2023-05-30 17:27:46 +02:00
2023-05-18 12:07:07 +02:00
programs . gnupg . agent = {
enable = true ;
enableSSHSupport = false ;
enableBrowserSocket = true ;
pinentryFlavor = " g t k 2 " ;
} ;
programs . ssh . startAgent = true ;
services . openssh . enable = true ;
environment . enableAllTerminfo = true ;
environment . pathsToLink = [ " / s h a r e / z s h " " / s h a r e / b a s h - c o m p l e t i o n " " / s h a r e / f i s h " ] ;
environment . shells = with pkgs ; [ zsh bashInteractive fish ] ;
programs = {
fish . enable = true ;
zsh = {
enable = true ;
interactiveShellInit = ''
if [ [ '' ${ __MATERUS_HM_ZSH : -0 } = = 0 ] ] ; t h e n
source $ { grml-config } /etc/zsh/zshrc
fi
'' ;
promptInit = ''
'' ;
} ;
java . enable = true ;
2023-06-10 21:35:01 +02:00
java . package = pkgs . graalvm17-ce ;
java . binfmt = true ;
2023-05-18 12:07:07 +02:00
command-not-found . enable = false ;
dconf . enable = true ;
} ;
2023-05-18 22:56:33 +02:00
2023-05-18 12:07:07 +02:00
2023-05-30 17:27:46 +02:00
/* c o n t a i n e r s . t e s t = {
config = { config , pkgs , . . . }: { environment . systemPackages = with pkgs ; [ wayfire ] ; } ;
autoStart = false ;
2023-06-03 13:15:01 +02:00
} ; * /
2023-05-30 17:27:46 +02:00
2023-05-18 12:07:07 +02:00
environment . systemPackages = with pkgs ; [
firefox
gamescope
2023-06-03 13:15:01 +02:00
#(pkgs.lutris.override { extraLibraries = pkgs: with pkgs; [ pkgs.samba pkgs.jansson pkgs.tdb pkgs.libunwind pkgs.libusb1 pkgs.gnutls pkgs.gtk3 pkgs.pango ]; })
2023-05-18 12:07:07 +02:00
materusPkgs . amdgpu-pro-libs . prefixes
2023-06-03 13:15:01 +02:00
( pkgs . bottles . override { extraPkgs = pkgs : with pkgs ; [ pkgs . libsForQt5 . breeze-qt5 pkgs . libsForQt5 . breeze-gtk pkgs . nss_latest ] ; extraLibraries = pkgs : with pkgs ; [ pkgs . samba pkgs . jansson pkgs . tdb pkgs . libunwind pkgs . libusb1 pkgs . gnutls pkgs . gtk3 pkgs . pango ] ; } )
2023-05-18 12:07:07 +02:00
glibc
glib
gtk3
gtk4
gsettings-desktop-schemas
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
patchelf
killall
util-linux
xorg . xhost
nix-top
gitFull
curl
wget
2023-06-10 21:35:01 +02:00
config . programs . java . package
2023-05-18 12:07:07 +02:00
nss_latest
aspell
aspellDicts . pl
aspellDicts . en
aspellDicts . en-computers
distrobox
p7zip
unrar
bzip2
rar
unzip
zstd
xz
zip
gzip
2023-05-30 17:27:46 +02:00
2023-05-18 12:07:07 +02:00
tree
mc
lf
htop
nmon
iftop
iptraf-ng
mprocs
tldr
bat
2023-05-30 17:27:46 +02:00
# pgcli
# litecli
2023-05-18 12:07:07 +02:00
#zenmonitor
nix-du
ark
kate
krusader
wineWowPackages . stagingFull
winetricks
protontricks
openal
gnupg
pinentry
pinentry-gnome
pinentry-curses
ncurses
monkeysphere
gparted
inkscape
gimp
2023-07-03 21:52:23 +02:00
2023-05-18 12:07:07 +02:00
bubblewrap
bindfs
pulseaudio
binutils
2023-06-08 18:24:48 +02:00
config . materus . profile . packages . firefox
2023-05-18 12:07:07 +02:00
/*
2023-05-30 17:27:46 +02:00
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
2023-05-18 12:07:07 +02:00
* /
] ;
2023-07-03 21:52:23 +02:00
system . activationScripts . libvirt-hooks . text =
2023-05-18 12:07:07 +02:00
''
2023-07-03 21:52:23 +02:00
ln - Tfs /etc/libvirt/hooks /var/lib/libvirt/hooks
2023-05-18 12:07:07 +02:00
'' ;
2023-07-03 21:52:23 +02:00
environment . etc = {
2023-05-18 12:07:07 +02:00
2023-07-03 21:52:23 +02:00
2023-05-18 12:07:07 +02:00
" l i b v i r t / h o o k s / q e m u . d / w i n 1 1 / p r e p a r e / b e g i n / s t a r t . s h " = {
2023-07-03 21:52:23 +02:00
text =
''
#!/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
# 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 " / e t c / l i b v i r t / h o o k s / k v m . c o n f "
# 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 [ " $ ( g r e p - c " frame buffer " / s y s / c l a s s / v t c o n s o l e / v t c o n " '' ${ i } " / n a m e ) " = 1 ] ; t h e n
echo 0 > /sys/class/vtconsole/vtcon " ' ' ${ i } " /bind
echo " $ D A T E U n b i n d i n g C o n s o l e ' ' ${ i } "
fi
fi
done
# Unbind EFI Framebuffer
echo " e f i - f r a m e b u f f e r . 0 " > /sys/bus/platform/drivers/efi-framebuffer/unbind
# 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
# 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
'' ;
mode = " 0 7 5 5 " ;
2023-05-18 12:07:07 +02:00
} ;
" l i b v i r t / h o o k s / q e m u . d / w i n 1 1 / r e l e a s e / e n d / s t o p . s h " = {
2023-07-03 21:52:23 +02:00
text =
''
#!/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
# Load variables we defined
source " / e t c / l i b v i r t / h o o k s / k v m . c o n f "
# 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
# 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 " e f i - f r a m e b u f f e r . 0 " > /sys/bus/platform/drivers/efi-framebuffer/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
# 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
'' ;
/* t e x t = ' '
#!/usr/bin/env bash
reboot
'' ; * - /
mode = " 0 7 5 5 " ;
} ;
" l i b v i r t / v g a b i o s / p a t c h e d . r o m " . source = ./vbios.rom ;
} ; * /
2023-05-18 12:07:07 +02:00
} ;
2023-07-03 21:52:23 +02:00
} ;
2023-05-18 12:07:07 +02:00
}