summary refs log tree commit diff
path: root/host
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-01-13 14:20:21 +0100
committerRory& <root@rory.gay>2025-01-13 14:20:31 +0100
commitf1f4a97a0740018a4c6aa222fc659161ac3f4729 (patch)
treed317f78e59c032d6b86c22235044045defd3331f /host
parentUpdate synapse, change some monitoring stuff, remove no-aaaa resolvconf optio... (diff)
downloadRory-Open-Architecture-f1f4a97a0740018a4c6aa222fc659161ac3f4729.tar.xz
Add arci
Diffstat (limited to 'host')
-rw-r--r--host/Arc/configuration.nix257
-rw-r--r--host/Arc/hacks/drm-amd-3437.patch13
-rw-r--r--host/Arc/hooks/post-rebuild.sh7
-rw-r--r--host/Arc/hooks/pre-rebuild.sh7
-rw-r--r--host/Arc/nginx/discord.localhost.nix36
-rw-r--r--host/Arc/optional/gui/wayland.nix37
-rw-r--r--host/Arc/optional/gui/x11.nix36
-rw-r--r--host/Arc/optional/hardware-specific/amd.nix42
-rw-r--r--host/Arc/optional/hardware-specific/nvidia.nix40
-rw-r--r--host/Rory-desktop/configuration.nix6
-rwxr-xr-xhost/Rory-desktop/ollama.nix2
-rw-r--r--host/Rory-desktop/optional/hardware-specific/amd.nix2
-rwxr-xr-xhost/Rory-desktop/postgres.nix11
-rw-r--r--host/Rory-desktop/printing.nix2
-rw-r--r--host/Rory-nginx/services/redpanda/systemd-services.nix8
15 files changed, 497 insertions, 9 deletions
diff --git a/host/Arc/configuration.nix b/host/Arc/configuration.nix
new file mode 100644

index 0000000..c8fe0fd --- /dev/null +++ b/host/Arc/configuration.nix
@@ -0,0 +1,257 @@ +args@{ + config, + pkgs, + lib, + nhekoSrc, + mtxclientSrc, + ... +}: + +{ + imports = [ + # base imports + ../../modules/base-client.nix + ../../modules/packages/vim.nix + ../../modules/users/Arci.nix + + # hardware-specific imports + ./optional/hardware-specific/nvidia.nix + + #./optional/gui/x11.nix + ./optional/gui/wayland.nix + ]; + + boot = { + kernelPackages = pkgs.linuxPackages_latest; + loader = { + grub = { + configurationLimit = 10; + enable = true; + device = "nodev"; # nodev for EFI only + # EFI + efiSupport = true; + efiInstallAsRemovable = true; + }; + }; + }; + programs.noisetorch.enable = true; + programs.gamemode.enable = true; + users.users.Rory.extraGroups = [ "gamemode" ]; + users.users.Arci.extraGroups = [ "gamemode" ]; + + environment.sessionVariables = { + ZSH_DISABLE_COMPFIX = "true"; + }; + + services.udev.extraRules = '' + #SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0664", GROUP="users" + # SDP protocol + KERNEL=="hidraw*", ATTRS{idVendor}=="1fc9", MODE="0666" + ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="1fc9", MODE="0666" + ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0d28", MODE="0666" + # Flashloader + KERNEL=="hidraw*", ATTRS{idVendor}=="15a2", MODE="0666" + # Controller + KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="18d1", MODE="0666" + SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="9400", MODE="0660", TAG+="uaccess" + ''; + + networking = { + hostName = "Arc"; + networkmanager.enable = true; + wireless.enable = false; + firewall = { + enable = false; + # allowedTCPPorts = [ ... ]; + # allowedUDPPorts = [ ... ]; + }; + + interfaces.enp34s0.ipv4.addresses = [ + { + address = "192.168.0.10"; + prefixLength = 24; + } + ]; + + defaultGateway = "192.168.0.1"; + #useDHCP = true; # Doesn't work with NetworkManager, investigate + }; + + time.timeZone = "Europe/Brussels"; + i18n.defaultLocale = "en_US.UTF-8"; + + services = { + xserver = { + displayManager.gdm.enable = true; + displayManager.lightdm.enable = false; + enable = true; + updateDbusEnvironment = true; + xkb.layout = "us"; + wacom.enable = true; + }; + libinput.enable = true; + + openssh = { + enable = true; + extraConfig = '' + MaxAuthTries 32 + ''; + settings.PermitRootLogin = "yes"; + }; + pipewire = { + enable = true; + audio.enable = true; + pulse.enable = true; + wireplumber.enable = true; + jack.enable = true; + alsa.enable = true; + }; + + desktopManager.plasma6.enable = true; + }; + + services.xserver.desktopManager.gnome.enable = false; + environment.systemPackages = with pkgs; [ + eog + mpv + libreoffice + qt6.qtwayland + + easyeffects + kitty + youtube-music + + dbeaver-bin + vscode + + # - Utilities + inkscape-with-extensions + gimp + + # - Languages + #dotnet-sdk_8 + dotnetCorePackages.sdk_9_0 + + #games + osu-lazer-bin + #steam + steam-run + steam-acf + + # extra packages + dmenu + + nemo + file-roller + firefox-bin + ungoogled-chromium #needed for Rider in order to debug WASM + + unrar-wrapper + mangohud + prismlauncher + ]; + + programs.steam = { + enable = true; + gamescopeSession.enable = true; + extraCompatPackages = with pkgs; [ + steam-play-none + proton-ge-bin + ]; + }; + virtualisation.waydroid.enable = true; + + xdg = { + portal = { + enable = true; + extraPortals = with pkgs; [ + #xdg-desktop-portal-gtk + xdg-desktop-portal-xapp + # (callPackage ../../modules/packages/xdg-desktop-portal-gtk.nix { }) + ]; + config = { + common = { + default = [ "gtk" ]; + }; + }; + xdgOpenUsePortal = true; + }; + #sounds.enable = true; + #mime.enable = true; + #menus.enable = true; + #icons.enable = true; + #autostart.enable = true; + }; + fonts = { + packages = with pkgs; [ + #(nerdfonts.override { fonts = [ "JetBrainsMono" ]; }) + nerd-fonts.jetbrains-mono + noto-fonts-monochrome-emoji + ]; + fontconfig.defaultFonts.monospace = with pkgs; [ "JetBrainsMonoNL Nerd Font,JetBrainsMonoNL NF:style=Regular" ]; + fontconfig.defaultFonts.sansSerif = with pkgs; [ "JetBrainsMonoNL Nerd Font,JetBrainsMonoNL NF:style=Regular" ]; + fontconfig.defaultFonts.serif = with pkgs; [ "JetBrainsMonoNL Nerd Font,JetBrainsMonoNL NF:style=Regular" ]; + fontconfig.defaultFonts.emoji = with pkgs; [ "freefont" ]; + enableDefaultPackages = lib.mkForce false; + enableGhostscriptFonts = lib.mkForce false; + }; + + nixpkgs = { + config = { + allowUnfree = true; + permittedInsecurePackages = [ + "electron-25.9.0" + "olm-3.2.16" + "dotnet-sdk-wrapped-7.0.410" + "dotnet-sdk-7.0.410" + ]; + }; + }; + security = { + polkit.enable = true; + sudo.wheelNeedsPassword = false; + }; + + hardware = { + pulseaudio.enable = false; + }; + + programs.dconf.enable = true; + + #networking.wireguard.interfaces = { + # wg-KP-Ran = { + + #}; + # }; + + virtualisation.libvirtd.enable = true; + programs.virt-manager.enable = true; + + monitoring = { + monitorAll = true; + localPrometheus = true; + exposePrometheus = true; + localGrafana = true; + exposeGrafana = true; + nginxHost = "monitoring.localhost"; + nginxSsl = false; + }; + networking.hosts."127.0.0.1" = builtins.attrNames config.services.nginx.virtualHosts; + + services.gvfs.enable = true; + zramSwap = { + enable = true; + memoryPercent = 200; + }; + services.pcscd.enable = true; + + virtualisation.vmVariant = { + users = { + mutableUsers = false; + users.Rory.password = "password"; + }; + networking.interfaces.enp34s0 = lib.mkForce { }; + }; + + system.stateVersion = "24.11"; # DO NOT EDIT! +} diff --git a/host/Arc/hacks/drm-amd-3437.patch b/host/Arc/hacks/drm-amd-3437.patch new file mode 100644
index 0000000..1867762 --- /dev/null +++ b/host/Arc/hacks/drm-amd-3437.patch
@@ -0,0 +1,13 @@ +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +index c556c8b653fa..272ad5e4a328 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +@@ -180,7 +180,7 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) + * When GTT is just an alternative to VRAM make sure that we + * only use it as fallback and still try to fill up VRAM first. + */ +- if (domain & abo->preferred_domains & AMDGPU_GEM_DOMAIN_VRAM) ++ if (domain & abo->preferred_domains & AMDGPU_GEM_DOMAIN_VRAM && !(adev->flags & AMD_IS_APU)) + places[c].flags |= TTM_PL_FLAG_FALLBACK; + c++; + } \ No newline at end of file diff --git a/host/Arc/hooks/post-rebuild.sh b/host/Arc/hooks/post-rebuild.sh new file mode 100644
index 0000000..30733ad --- /dev/null +++ b/host/Arc/hooks/post-rebuild.sh
@@ -0,0 +1,7 @@ +#!/usr/bin/env sh +set -x + +git restore --staged hardware-configuration.nix +git restore --staged Ran.ca +git restore --staged modules/opensuse/ +git restore --staged opensuse/ \ No newline at end of file diff --git a/host/Arc/hooks/pre-rebuild.sh b/host/Arc/hooks/pre-rebuild.sh new file mode 100644
index 0000000..d4ec9d3 --- /dev/null +++ b/host/Arc/hooks/pre-rebuild.sh
@@ -0,0 +1,7 @@ +#!/usr/bin/env sh +set -x + +git add -f hardware-configuration.nix +git add -f Ran.ca +git add -f modules/opensuse/ +git add -f opensuse/ \ No newline at end of file diff --git a/host/Arc/nginx/discord.localhost.nix b/host/Arc/nginx/discord.localhost.nix new file mode 100644
index 0000000..b40e13c --- /dev/null +++ b/host/Arc/nginx/discord.localhost.nix
@@ -0,0 +1,36 @@ +{ pkgs, ... }: + +{ + root = "/www/discord"; + addSSL = true; + enableACME = false; + + # We don't care about certificates around here... + sslCertificate = "${pkgs.path}/nixos/tests/common/acme/server/acme.test.cert.pem"; + sslCertificateKey = "${pkgs.path}/nixos/tests/common/acme/server/acme.test.key.pem"; + + extraConfig = '' + autoindex on; + more_set_headers 'Access-Control-Allow-Origin: *'; + more_set_headers 'Access-Control-Allow-Methods: GET, POST, OPTIONS'; + more_set_headers 'Access-Control-Allow-Headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; + more_set_headers 'Access-Control-Expose-Headers: Content-Length,Content-Range'; + more_set_headers 'Access-Control-Allow-Credentials: true'; + ''; + + locations = { + "/" = { + index = "index.html"; + extraConfig = '' + more_set_headers 'Access-Control-Allow-Origin: *'; + more_set_headers 'Access-Control-Allow-Methods: *'; + more_set_headers 'Access-Control-Allow-Headers: *'; + more_set_headers 'Access-Control-Expose-Headers: *'; + more_set_headers 'Access-Control-Max-Age' 1728000; + + # default to /index.html if file not found + try_files $uri $uri/ /index.html; + ''; + }; + }; +} diff --git a/host/Arc/optional/gui/wayland.nix b/host/Arc/optional/gui/wayland.nix new file mode 100644
index 0000000..eac6391 --- /dev/null +++ b/host/Arc/optional/gui/wayland.nix
@@ -0,0 +1,37 @@ +{ + pkgs, + ... +}: + +{ + programs.sway = { + enable = true; + + wrapperFeatures.gtk = true; + extraSessionCommands = '' + # -- Wayland fixes + # SDL: + export SDL_VIDEODRIVER=wayland + # QT (needs qt5.qtwayland in systemPackages): + export QT_QPA_PLATFORM=wayland-egl + export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" + # Fix for some Java AWT applications (e.g. Android Studio), + # use this if they aren't displayed properly: + export _JAVA_AWT_WM_NONREPARENTING=1 + ''; + + extraPackages = with pkgs; [ + swaybg + #swayidle + #swaylock + waybar + wl-clipboard + grim + slurp + easyeffects + keepassxc + ]; + }; + + xdg.portal.wlr.enable = true; +} diff --git a/host/Arc/optional/gui/x11.nix b/host/Arc/optional/gui/x11.nix new file mode 100644
index 0000000..9070298 --- /dev/null +++ b/host/Arc/optional/gui/x11.nix
@@ -0,0 +1,36 @@ +{ + config, + pkgs, + lib, + nhekoSrc, + mtxclientSrc, + ... +}: + +{ + imports = [ ]; + + services = { + xserver = { + windowManager.i3.enable = true; + windowManager.i3.extraSessionCommands = '' + # output from arandr: + #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.picom}/bin/picom --config ~/.config/picom.conf & + ${pkgs.feh}/bin/feh --no-fehbg --bg-fill ${../../../../modules/users/Rory/wallpaper.webp} + ''; + windowManager.i3.extraPackages = with pkgs; [ + easyeffects + keepassxc + ]; + }; + + picom.enable = false; + #picom.vSync = false; + #picom.backend = "glx"; + }; + +} diff --git a/host/Arc/optional/hardware-specific/amd.nix b/host/Arc/optional/hardware-specific/amd.nix new file mode 100644
index 0000000..e4758a6 --- /dev/null +++ b/host/Arc/optional/hardware-specific/amd.nix
@@ -0,0 +1,42 @@ +{ + 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 = { + graphics = { + enable = true; + enable32Bit = true; + extraPackages = with pkgs; [ + rocmPackages.clr.icd + #amdvlk + ]; + #extraPackages32 = with pkgs; [ driversi686Linux.amdvlk ]; + }; + }; + + systemd.tmpfiles.rules = [ "L+ /opt/rocm/hip - - - - ${pkgs.rocmPackages.clr}" ]; +} diff --git a/host/Arc/optional/hardware-specific/nvidia.nix b/host/Arc/optional/hardware-specific/nvidia.nix new file mode 100644
index 0000000..1f98541 --- /dev/null +++ b/host/Arc/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 = { + graphics = { + enable = true; + }; + + nvidia = { + modesetting.enable = true; + powerManagement.enable = false; + powerManagement.finegrained = false; + open = true; + nvidiaSettings = true; + nvidiaPersistenced = true; + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + }; +} diff --git a/host/Rory-desktop/configuration.nix b/host/Rory-desktop/configuration.nix
index 13d49d7..95c9775 100644 --- a/host/Rory-desktop/configuration.nix +++ b/host/Rory-desktop/configuration.nix
@@ -27,7 +27,7 @@ args@{ ./optional/gui/wayland.nix ./printing.nix - #./ollama.nix + ./ollama.nix ]; boot = { @@ -307,5 +307,9 @@ args@{ networking.interfaces.enp34s0 = lib.mkForce { }; }; + services.rabbitmq = { + enable = true; + }; + system.stateVersion = "22.11"; # DO NOT EDIT! } diff --git a/host/Rory-desktop/ollama.nix b/host/Rory-desktop/ollama.nix
index 94ec8cc..b1b0a7a 100755 --- a/host/Rory-desktop/ollama.nix +++ b/host/Rory-desktop/ollama.nix
@@ -26,6 +26,7 @@ models = "/data/ollama/home/models"; environmentVariables = { OLLAMA_LLM_LIBRARY = "rocm"; + HCC_AMDGPU_TARGET = "gfx1102"; }; # writablePaths = [ "/data/ollama/home" ]; #listenAddress = "0.0.0.0:11434"; @@ -34,6 +35,7 @@ user = "ollama"; group = "ollama"; acceleration = "rocm"; + rocmOverrideGfx = "11.0.2"; }; #services.nextjs-ollama-llm-ui = { diff --git a/host/Rory-desktop/optional/hardware-specific/amd.nix b/host/Rory-desktop/optional/hardware-specific/amd.nix
index 509ff14..e4758a6 100644 --- a/host/Rory-desktop/optional/hardware-specific/amd.nix +++ b/host/Rory-desktop/optional/hardware-specific/amd.nix
@@ -39,6 +39,4 @@ }; systemd.tmpfiles.rules = [ "L+ /opt/rocm/hip - - - - ${pkgs.rocmPackages.clr}" ]; - - system.stateVersion = "22.11"; # DO NOT EDIT! } diff --git a/host/Rory-desktop/postgres.nix b/host/Rory-desktop/postgres.nix
index 60fd8d6..c201b04 100755 --- a/host/Rory-desktop/postgres.nix +++ b/host/Rory-desktop/postgres.nix
@@ -28,10 +28,17 @@ # ''; #dataDir = "/mnt/postgres/data"; settings = { - "max_connections" = "100"; - "shared_buffers" = "128MB"; + "max_connections" = "1000"; + "shared_buffers" = "512MB"; "max_wal_size" = "1GB"; "min_wal_size" = "80MB"; + + shared_preload_libraries = "pg_stat_statements"; + track_io_timing = "on"; + track_functions = "pl"; + "pg_stat_statements.max" = "10000"; # additional + "pg_stat_statements.track" = "all"; # additional + }; }; diff --git a/host/Rory-desktop/printing.nix b/host/Rory-desktop/printing.nix
index 351b59f..4f86347 100644 --- a/host/Rory-desktop/printing.nix +++ b/host/Rory-desktop/printing.nix
@@ -51,6 +51,4 @@ }; }; }; - - system.stateVersion = "22.11"; # DO NOT EDIT! } diff --git a/host/Rory-nginx/services/redpanda/systemd-services.nix b/host/Rory-nginx/services/redpanda/systemd-services.nix
index bb13e53..6178b22 100644 --- a/host/Rory-nginx/services/redpanda/systemd-services.nix +++ b/host/Rory-nginx/services/redpanda/systemd-services.nix
@@ -26,18 +26,22 @@ { mapping = '' root = this - if this.loaded == "loaded" { + if this.load == "loaded" { root.loaded_value = 1.0 } else { root.loaded_value = 0.0 } if this.active == "active" { root.active_value = 1.0 + } else if this.active == "activating" { + root.active_value = 0.5 } else { root.active_value = 0.0 } if this.sub == "active" { root.sub_value = 1.0 + } else if this.sub == "auto-restart" { + root.sub_value = 0.5 } else { root.sub_value = 0.0 } @@ -49,7 +53,7 @@ type = "gauge"; value = "\${!json(\"loaded_value\")}"; labels = { - field = "loaded"; + field = "load"; service = "\${!json(\"unit\")}"; description = "\${!json(\"description\")}"; };