From c3f12a320c7e7262bc00999b5d62f6f257b8eb67 Mon Sep 17 00:00:00 2001 From: Rory& Date: Sun, 9 Jun 2024 12:28:09 +0200 Subject: Bunch of changes --- host/Rory-desktop/configuration.nix | 108 ++++++--------------- host/Rory-desktop/ollama.nix | 20 ++++ .../optional/hardware-specific/amd.nix | 44 +++++++++ .../optional/hardware-specific/nvidia.nix | 40 ++++++++ host/Rory-desktop/printing.nix | 51 ++++++++++ .../services/nginx/localhost/matrix-rory-gay.nix | 7 +- host/Rory-nginx/services/ollama.nix | 2 +- 7 files changed, 192 insertions(+), 80 deletions(-) create mode 100755 host/Rory-desktop/ollama.nix create mode 100644 host/Rory-desktop/optional/hardware-specific/amd.nix create mode 100644 host/Rory-desktop/optional/hardware-specific/nvidia.nix create mode 100644 host/Rory-desktop/printing.nix (limited to 'host') diff --git a/host/Rory-desktop/configuration.nix b/host/Rory-desktop/configuration.nix index da3d8e3..9f8da16 100644 --- a/host/Rory-desktop/configuration.nix +++ b/host/Rory-desktop/configuration.nix @@ -3,25 +3,31 @@ { imports = [ + # base imports ../../modules/base-client.nix ../../modules/packages/vim.nix # ../../modules/environments/home.nix ../../modules/software-templates/profilers.nix ./postgres.nix - ./mariadb.nix ./nginx.nix + + # hardware-specific imports + ./optional/hardware-specific/amd.nix + + ./printing.nix + ./ollama.nix ]; - boot = { - kernelPackages = pkgs.linuxPackages_latest; - loader = { - grub = { - enable = true; - device = "nodev"; # nodev for EFI only - # EFI - efiSupport = true; - efiInstallAsRemovable = true; - }; + boot = { + kernelPackages = pkgs.linuxPackages_latest; + loader = { + grub = { + enable = true; + device = "nodev"; # nodev for EFI only + # EFI + efiSupport = true; + efiInstallAsRemovable = true; + }; }; #readOnlyNixStore = false; }; @@ -65,14 +71,15 @@ xserver = { enable = true; updateDbusEnvironment = true; - videoDrivers = ["nvidia"]; + #videoDrivers = ["amdgpu"]; #"nvidia" #desktopManager.gnome.enable = true; libinput.enable = true; layout = "us"; windowManager.i3.enable = true; windowManager.i3.extraSessionCommands = '' # output from arandr: - xrandr --output DP-0 --off --output DP-1 --off --output DP-2 --off --output DP-3 --off --output HDMI-0 --primary --mode 3840x2160 --pos 0x0 --rotate normal --output DP-4 --off --output DP-5 --mode 1920x1080 --pos 3840x1080 --rotate normal + #xrandr --output DP-1 --mode 1920x1080 --pos 3840x1080 --rotate normal --output HDMI-1 --mode 3840x2160 --pos 0x0 --rotate normal --output HDMI-2 --off --output DP-2 --off + xrandr --output HDMI-1 --mode 3840x2160 --pos 0x0 --rotate normal --primary --output DP-1 --mode 1920x1080 --pos 3840x1080 --rotate normal --output HDMI-2 --off --output DP-2 --off ${pkgs.polybarFull}/bin/polybar & ${pkgs.dunst}/bin/dunst & ${pkgs.feh}/bin/feh --no-fehbg --bg-fill ${../../modules/users/Rory/wallpaper.webp} @@ -121,13 +128,13 @@ users.users = { Rory = { isNormalUser = true; - extraGroups = [ "wheel" "lp" "scanner" ]; + extraGroups = [ "wheel" ]; packages = with pkgs; [ #gimp-with-plugins #xterm - gnomeExtensions.vitals - gnomeExtensions.runcat + #gnomeExtensions.vitals + #gnomeExtensions.runcat ]; initialPassword = "password"; }; @@ -143,15 +150,15 @@ youtube-music # - IDEs - jetbrains-toolbox + #jetbrains-toolbox jetbrains.rider - jetbrains.webstorm - jetbrains.clion + #jetbrains.webstorm + #jetbrains.clion github-copilot-intellij-agent - dbeaver - insomnia + dbeaver-bin + #insomnia vscode # - Utilities @@ -169,10 +176,6 @@ steam-run steam-acf - #printing/scanning - xsane - gnome.simple-scan - # extra packages dmenu @@ -184,7 +187,7 @@ #yuzu-early-access wineWowPackages.unstableFull winetricks - fragments + #fragments peek unrar-wrapper @@ -193,9 +196,10 @@ (callPackage ../../modules/packages/nheko-git.nix { inherit nhekoSrc; inherit mtxclientSrc; voipSupport = false; }) #(callPackage ../../modules/packages/mc/server/modpack/curseforge/techopolis-2/5.4.nix { }) - vesktop + #vesktop + virt-viewer - (dwarf-fortress-packages.dwarf-fortress-full.override { enableStoneSense = true; enableFPS = true; theme = dwarf-fortress-packages.themes.spacefox; }) + # (dwarf-fortress-packages.dwarf-fortress-full.override { enableStoneSense = true; enableFPS = true; theme = dwarf-fortress-packages.themes.spacefox; }) ]; programs.steam.enable = true; @@ -271,51 +275,8 @@ }; hardware = { - opengl = { - enable = true; - driSupport = true; - driSupport32Bit = true; - }; - - nvidia = { - modesetting.enable = true; - powerManagement.enable = false; - powerManagement.finegrained = false; - open = true; - nvidiaSettings = true; - nvidiaPersistenced = true; - package = config.boot.kernelPackages.nvidiaPackages.stable; - }; - - sane.enable = true; - sane.extraBackends = [ pkgs.hplipWithPlugin pkgs.sane-airscan ]; pulseaudio.enable = false; }; - programs.system-config-printer.enable = true; - services = { - gvfs.enable = true; - saned.enable = true; - system-config-printer.enable = true; - ipp-usb.enable = true; - printing = { - enable = true; - browsing = true; - drivers = with pkgs; [ hplip ]; - }; - avahi = { - enable = true; - nssmdns = true; - reflector = true; - publish = { - workstation = true; - userServices = true; - hinfo = true; - enable = true; - domain = true; - addresses = true; - }; - }; - }; programs.dconf.enable = true; environment.etc."resolv.conf".text = '' nameserver 8.8.8.8 @@ -324,20 +285,15 @@ nameserver 1.0.0.1 ''; - #networking.wireguard.interfaces = { # wg-KP-Ran = { #}; # }; - - virtualisation.libvirtd.enable = true; programs.virt-manager.enable = true; - - system.stateVersion = "22.11"; # DO NOT EDIT! } diff --git a/host/Rory-desktop/ollama.nix b/host/Rory-desktop/ollama.nix new file mode 100755 index 0000000..1770ede --- /dev/null +++ b/host/Rory-desktop/ollama.nix @@ -0,0 +1,20 @@ +{ config, pkgs, lib, ... }: + +{ +# systemd.tmpfiles.rules = [ "d /data/ollama 0750 ostgres postgres" ]; + + services.ollama = { + enable = true; + home = "/data/ollama/home"; + models = "/data/ollama/home/models"; + environmentVariables = { + OLLAMA_LLM_LIBRARY = "rocm"; + }; + writablePaths = [ "/data/ollama/home" ]; + #listenAddress = "0.0.0.0:11434"; + host = "0.0.0.0"; + port = 11434; + sandbox = false; + acceleration = "rocm"; + }; +} diff --git a/host/Rory-desktop/optional/hardware-specific/amd.nix b/host/Rory-desktop/optional/hardware-specific/amd.nix new file mode 100644 index 0000000..d44766a --- /dev/null +++ b/host/Rory-desktop/optional/hardware-specific/amd.nix @@ -0,0 +1,44 @@ +{ config, pkgs, lib, nhekoSrc, mtxclientSrc, ... }: + +{ + imports = + [ ]; + +boot.initrd.kernelModules = [ "amdgpu" ]; + + services = { + xserver = { + windowManager.i3.extraSessionCommands = '' + xrandr --output HDMI-1 --mode 3840x2160 --pos 0x0 --rotate normal --primary --output DP-1 --mode 1920x1080 --pos 3840x1080 --rotate normal --output HDMI-2 --off --output DP-2 --off + ''; + wacom.enable = true; + }; + picom.backend = "glx"; + }; + + environment.systemPackages = with pkgs; [ + rocmPackages.rocm-smi # useful to have + ]; + + hardware = { + opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + extraPackages = with pkgs; [ + rocmPackages.clr.icd + amdvlk + ]; + extraPackages32 = with pkgs; [ + driversi686Linux.amdvlk + ]; + }; + }; + + systemd.tmpfiles.rules = [ + "L+ /opt/rocm/hip - - - - ${pkgs.rocmPackages.clr}" + ]; + + system.stateVersion = "22.11"; # DO NOT EDIT! +} + diff --git a/host/Rory-desktop/optional/hardware-specific/nvidia.nix b/host/Rory-desktop/optional/hardware-specific/nvidia.nix new file mode 100644 index 0000000..7278d84 --- /dev/null +++ b/host/Rory-desktop/optional/hardware-specific/nvidia.nix @@ -0,0 +1,40 @@ +{ config, pkgs, lib, nhekoSrc, mtxclientSrc, ... }: + +{ + imports = + [ + + ]; + + + services = { + xserver = { + videoDrivers = ["nvidia"]; + #windowManager.i3.extraSessionCommands = '' + # todo: restore + #''; + }; + picom.backend = "glx"; + }; + + hardware = { + opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; + + nvidia = { + modesetting.enable = true; + powerManagement.enable = false; + powerManagement.finegrained = false; + open = true; + nvidiaSettings = true; + nvidiaPersistenced = true; + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + }; + + system.stateVersion = "22.11"; # DO NOT EDIT! +} + diff --git a/host/Rory-desktop/printing.nix b/host/Rory-desktop/printing.nix new file mode 100644 index 0000000..fd33aaa --- /dev/null +++ b/host/Rory-desktop/printing.nix @@ -0,0 +1,51 @@ +{ config, pkgs, lib, ... }: + +{ + imports = [ ]; + + users.users = { + Rory = { + extraGroups = [ "lp" "scanner" ]; + }; + }; + + environment.systemPackages = with pkgs; [ + xsane + gnome.simple-scan + ]; + + hardware = { + sane.enable = true; + sane.extraBackends = [ pkgs.hplipWithPlugin pkgs.sane-airscan ]; + }; + + programs.system-config-printer.enable = true; + + services = { + gvfs.enable = true; + saned.enable = true; + system-config-printer.enable = true; + ipp-usb.enable = true; + printing = { + enable = true; + browsing = true; + drivers = with pkgs; [ hplip ]; + }; + avahi = { + enable = true; + nssmdns = true; + reflector = true; + publish = { + workstation = true; + userServices = true; + hinfo = true; + enable = true; + domain = true; + addresses = true; + }; + }; + }; + + system.stateVersion = "22.11"; # DO NOT EDIT! +} + diff --git a/host/Rory-nginx/services/nginx/localhost/matrix-rory-gay.nix b/host/Rory-nginx/services/nginx/localhost/matrix-rory-gay.nix index 0ab8e9a..3e48d0f 100644 --- a/host/Rory-nginx/services/nginx/localhost/matrix-rory-gay.nix +++ b/host/Rory-nginx/services/nginx/localhost/matrix-rory-gay.nix @@ -26,9 +26,10 @@ locations."~ ^/_matrix/client/(r0|v3)/sync$" = { proxyPass = "http://generic_workers_upstream$request_uri"; extraConfig = '' - proxy_read_timeout 3600; - proxy_connect_timeout 3600; - proxy_send_timeout 3600; + # We want to wait for 15 minutes here... + proxy_read_timeout 54000; + proxy_connect_timeout 54000; + proxy_send_timeout 54000; ''; }; locations."~ ^/_matrix/client/(api/v1|r0|v3)/events$" = { diff --git a/host/Rory-nginx/services/ollama.nix b/host/Rory-nginx/services/ollama.nix index 8151fe3..8480968 100755 --- a/host/Rory-nginx/services/ollama.nix +++ b/host/Rory-nginx/services/ollama.nix @@ -8,7 +8,7 @@ home = "/data/ollama/home"; models = "/data/ollama/home/models"; environmentVariables = { - OLLAMA_LLM_LIBRARY = "cpu"; + OLLAMA_LLM_LIBRARY = "cpu_avx2"; }; writablePaths = [ "/data/ollama/home" ]; listenAddress = "0.0.0.0:11434"; -- cgit 1.4.1