From 3b4fe6f60c15016ec9ef6b363fada04cafbffc38 Mon Sep 17 00:00:00 2001 From: Kasey Date: Sun, 29 Nov 2026 09:52:38 -0600 Subject: [PATCH] Add configuration --- alchemy-viewer/alchemy.nix | 170 +++++++++ configuration.nix | 259 ++++++++++++++ disks.nix | 74 ++++ ea-bullshit.nix | 10 + flake.nix | 37 ++ gpu-screen-recorder/gsr.nix | 105 ++++++ gpu-screen-recorder/notif.nix | 60 ++++ .../remove-gnome-postinstall.patch | 14 + gpu-screen-recorder/ui.nix | 105 ++++++ hardware-configuration.nix | 36 ++ home.nix | 98 +++++ nfs.nix | 53 +++ nvidia.nix | 36 ++ patented-gigabyte-bullshit.nix | 35 ++ umbriel.nix | 334 ++++++++++++++++++ unity.nix | 62 ++++ 16 files changed, 1488 insertions(+) create mode 100755 alchemy-viewer/alchemy.nix create mode 100755 configuration.nix create mode 100755 disks.nix create mode 100755 ea-bullshit.nix create mode 100755 flake.nix create mode 100755 gpu-screen-recorder/gsr.nix create mode 100755 gpu-screen-recorder/notif.nix create mode 100755 gpu-screen-recorder/remove-gnome-postinstall.patch create mode 100755 gpu-screen-recorder/ui.nix create mode 100755 hardware-configuration.nix create mode 100755 home.nix create mode 100755 nfs.nix create mode 100755 nvidia.nix create mode 100755 patented-gigabyte-bullshit.nix create mode 100755 umbriel.nix create mode 100755 unity.nix diff --git a/alchemy-viewer/alchemy.nix b/alchemy-viewer/alchemy.nix new file mode 100755 index 0000000..44369c2 --- /dev/null +++ b/alchemy-viewer/alchemy.nix @@ -0,0 +1,170 @@ +{ + lib, + stdenv, + fetchurl, + makeDesktopItem, + makeWrapper, + patchelf, + zstd, + pkgs, + extraPkgs ? [], +}: let + pname = "alchemy"; + version = "7.1.9.2516"; + appname = "Alchemy Viewer"; + + desktopItem = makeDesktopItem { + name = pname; + exec = pname; + icon = pname; + desktopName = appname; + genericName = "Third-party Second Life Viewer"; + categories = ["Game" "Network" "Chat" "Simulation"]; + startupWMClass = pname; + }; + + bundledFonts = with pkgs; [ + dejavu_fonts + liberation_ttf + noto-fonts + noto-fonts-cjk-sans + noto-fonts-color-emoji + corefonts + roboto + ]; + + commonLibs = with pkgs; [ + fontconfig + freetype + harfbuzz + fribidi + libjpeg + libpng + libxml2 + alsa-lib + libpulseaudio + SDL2 + mesa + vulkan-loader + wayland + libxkbcommon + libx11 + libxrandr + libxinerama + libxcomposite + libxdamage + libxext + freealut + libdecor + libxcursor + cef-binary + systemd + dbus + libglvnd + ]; +in + stdenv.mkDerivation rec { + inherit pname version; + + src = fetchurl { + url = "https://github.com/AlchemyViewer/Alchemy/releases/download/${version}-beta/Alchemy_Beta_${builtins.replaceStrings ["."] ["_"] version}_x86_64.tar.zst"; + hash = "sha256-FjqDU7HskfQkZlgLhT/gMdl9YHRnaNlwvxBUYdLlock="; + }; + + nativeBuildInputs = [makeWrapper patchelf zstd]; + buildInputs = commonLibs ++ extraPkgs ++ bundledFonts; + + unpackPhase = '' + zstd -d --stdout ${src} | tar xf - + mv $(find . -maxdepth 1 -type d -name 'Alchemy_Beta_*' | head -n1) source + export sourceRoot="$PWD/source" + ''; + + installPhase = '' + runHook preInstall + + cd "$sourceRoot" + mkdir -p $TMPDIR/alchemy-staging + cp -r . $TMPDIR/alchemy-staging/ + cd $TMPDIR/alchemy-staging + + # Remove sandbox and unnecessary files (sandbox warnings are expected on NixOS) + find . -name '*sandbox*' -delete + find . -name 'libcef_dll_wrapper.*' -delete + + # Fontconfig: point to Nix store fonts, not /usr/share/fonts + mkdir -p etc/fonts + + cat > etc/fonts/fonts.conf < + + + ${lib.concatMapStrings (pkg: '' + ${pkg}/share/fonts/truetype + ${pkg}/share/fonts/opentype + ${pkg}/share/fonts + '') + bundledFonts} + + true + true + hintslight + rgb + lcddefault + + + EOF + + # Symlink bundled font packages + mkdir -p fonts + for fontPkg in ${lib.escapeShellArgs bundledFonts}; do + find "$fontPkg" \( -name '*.ttf' -o -name '*.otf' -o -name '*.ttc' \) -exec ln -sf {} fonts/ \; + done + + # Symlink libraries + mkdir -p lib + ln -sf ${stdenv.cc.cc.lib}/lib/libstdc++.so.6 lib/ + ln -sf ${pkgs.cef-binary}/Release/libcef.so lib/ + ln -sf ${pkgs.cef-binary}/Release/libcef.so lib/libcef.so.1 + + # Install to output + mkdir -p "$out/opt/${pname}" "$out/bin" + cp -r . "$out/opt/${pname}/" + + # Patch ELF binaries (errors for static binaries are expected) + find "$out/opt/${pname}" -type f -exec sh -c ' + if file -b "$1" | grep -q "ELF.*executable"; then + patchelf \ + --set-interpreter "$(cat ${stdenv.cc}/nix-support/dynamic-linker)" \ + --set-rpath "$out/opt/${pname}/lib:${lib.makeLibraryPath buildInputs}" \ + "$1" || true + fi + ' _ {} \; + + # Wrap binary for runtime + makeWrapper "$out/opt/${pname}/${pname}" "$out/bin/${pname}" \ + --set FONTCONFIG_FILE "$out/opt/${pname}/etc/fonts/fonts.conf" \ + --set QT_XKB_CONFIG_ROOT "${pkgs.xkeyboard_config}/share/X11/xkb" \ + --set QTWEBENGINE_DISABLE_SANDBOX 1 \ + --set CEF_ENABLE_SANDBOX 0 \ + --set NIXOS_OZONE_WL 1 \ + --prefix XDG_DATA_DIRS : "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}" \ + --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath buildInputs}:$out/opt/${pname}/lib" + + # Desktop integration + mkdir -p "$out/share/applications" "$out/share/pixmaps" + cp "${desktopItem}/share/applications/"* "$out/share/applications/" + ln -s "$out/opt/${pname}/${pname}_icon.png" "$out/share/pixmaps/${pname}.png" + + runHook postInstall + ''; + + meta = with lib; { + description = "Third-party client for Second Life"; + homepage = "https://github.com/AlchemyViewer/Alchemy"; + license = licenses.lgpl21Only; + platforms = platforms.linux; + maintainers = ["Vixenin"]; + mainProgram = pname; + }; + } diff --git a/configuration.nix b/configuration.nix new file mode 100755 index 0000000..159ebe2 --- /dev/null +++ b/configuration.nix @@ -0,0 +1,259 @@ +{ + config, + pkgs, + inputs, + ... +}: { + imports = [ + inputs.luciole.nixosModules.default + inputs.umbriel.nixosModules.default + ./hardware-configuration.nix + ./nvidia.nix + ./disks.nix + ./patented-gigabyte-bullshit.nix + ./ea-bullshit.nix + ./home.nix + #./nfs.nix + ]; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.kernelPackages = pkgs.linuxPackages_latest; + + hardware.logitech.wireless.enable = true; + programs.solaar.enable = true; + + networking.hostName = "singularity"; + networking.wireless.enable = true; + networking.networkmanager.enable = true; + + programs.tack.enable = true; + + time.timeZone = "America/Chicago"; + + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + + hardware.graphics.enable = true; + hardware.graphics.enable32Bit = true; + + services.xserver.xkb = { + layout = "us"; + variant = ""; + }; + + users.users."kasey" = { + isNormalUser = true; + extraGroups = ["networkmanager" "wheel"]; + }; + + environment.systemPackages = with pkgs; [ + wget + wayland + neovim + jq + htop + btop + git + wl-clipboard + fish + libadwaita + brightnessctl + tldr + mpd + mpc + rmpc + pciutils + ntfs3g + xdg-utils + ffmpeg-full + discord + kdePackages.kdenlive + prismlauncher + telegram-desktop + mangohud + goverlay + fastfetch + xonotic + heroic + kdePackages.kcalc + kdePackages.ark + kdePackages.gwenview + kdiff3 + wayland-utils + umu-launcher + nheko + davinci-resolve + yt-dlp + handbrake + bc + firefox + wivrn + xrizer + wayvr + gsettings-desktop-schemas + dotnet-sdk_8 + dotnetCorePackages.aspnetcore_8_0-bin + ocl-icd + cudaPackages.cuda_opencl + blender + python3 + avahi + krita + libnotify + alcom + gale + unityhub + protonplus + _86box-with-roms + inkscape + mangojuice + daggerfall-unity-unfree + searxng + openarena + gimp + gpu-screen-recorder-notification + gpu-screen-recorder-ui + mpv + kdePackages.filelight + libxtst + gparted + imagemagick + aria2 + unrar + pywal16 + audacity + godotPackages.godot-mono + godotPackages.export-templates-bin + godotPackages.export-templates-mono-bin + keepassxc + avidemux + alchemy + extract-xiso + qbittorrent + filezilla + starship + libstrangle + fluxer-canary-bin + alcom + easyeffects + kitty + pulseaudio + fuzzel + adw-gtk3 + kdePackages.breeze + kdePackages.breeze-icons + nwg-look + qt6Packages.qt6ct + ]; + + fonts.packages = with pkgs; [ + noto-fonts + noto-fonts-cjk-sans + noto-fonts-color-emoji + liberation_ttf + dejavu_fonts + nerd-fonts.iosevka + ]; + + services.tuned = { + enable = true; + ppdSupport = true; + }; + + services.upower.enable = true; + security.rtkit.enable = true; + security.polkit.enable = true; + services.locate.enable = true; + services.locate.package = pkgs.mlocate; + services.flatpak.enable = true; + services.gvfs.enable = true; + + programs.gpu-screen-recorder = { + enable = true; + ui.enable = true; # For overlay + }; + + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + zramSwap = { + enable = true; + }; + + services.displayManager.noctalia-greeter.enable = true; + services.displayManager.noctalia-greeter.passwordlessSyncUsers = ["kasey"]; + programs.noctalia.enable = true; + programs.umbriel.enable = true; + programs.luciole.enable = true; + + services.gnome.gnome-keyring.enable = true; + + environment.variables = { + ELECTRON_OZONE_PLATFORM_HINT = "wayland"; + PROTON_USE_WAYLAND = "1"; + PROTON_USE_NTSYNC = "1"; + PROTON_WAYLAND_MONITOR = "HDMI-A-1"; + PRESSURE_VESSEL_IMPORT_OPENXR_1_RUNTIMES = "1"; + PROTON_DXVK_LOWLATENCY = "1"; + EDITOR = "nvim"; + PROTON_DLSS_UPGRADE = "1"; + PROTON_PRIORITY_HIGH = "1"; + PROTON_ENABLE_NVAPI = "1"; + PROTON_HIDE_NVIDIA_GPU = "1"; + LOW_LATENCY_LAYER = "1"; + LOW_LATENCY_LAYER_REFLEX = "1"; + STEAMDECK = "0"; + STRANGLE_VSYNC = "1"; + VR_OVERRIDE = "/run/host/usr/lib64/xrizer/runtime"; + GTK_THEME = "adw-gtk3"; + QT_QPA_PLATFORMTHEME = "qt6ct"; + }; + + programs.dconf.enable = true; + + programs.virt-manager.enable = true; + users.groups.libvirtd.members = ["kasey"]; + virtualisation.libvirtd.enable = true; + virtualisation.spiceUSBRedirection.enable = true; + + services.avahi.enable = true; + services.wivrn = { + enable = true; + highPriority = true; + openFirewall = true; + autoStart = true; + }; + + programs.steam.enable = true; + programs.steam.protontricks.enable = true; + programs.gamemode.enable = true; + programs.steam.extraCompatPackages = with pkgs; [ + proton-ge-bin + ]; + + programs.appimage.enable = true; + programs.appimage.binfmt = true; + + nixpkgs.config.permittedInsecurePackages = [ + "olm-3.2.16" + ]; + nixpkgs.config.allowUnfree = true; + + system.stateVersion = "26.11"; # Do not change this you fucking moron. +} diff --git a/disks.nix b/disks.nix new file mode 100755 index 0000000..c8f2101 --- /dev/null +++ b/disks.nix @@ -0,0 +1,74 @@ +{ + boot.supportedFilesystems = ["ntfs"]; + fileSystems."/data" = { + device = "/dev/disk/by-uuid/3A3D8FEC792D505F"; + fsType = "ntfs"; + options = ["defaults"]; + }; + + fileSystems."/games" = { + device = "/dev/disk/by-uuid/c7972e91-4e74-4bac-90da-968e8f4c1868"; + fsType = "btrfs"; + options = ["subvol=@games"]; + }; + + fileSystems."/home/kasey/Desktop" = { + device = "/data/Desktop"; + fsType = "none"; + options = ["bind"]; + }; + + fileSystems."/home/kasey/Documents" = { + device = "/data/Documents"; + fsType = "none"; + options = ["bind"]; + }; + + fileSystems."/home/kasey/Downloads" = { + device = "/data/Downloads"; + fsType = "none"; + options = ["bind"]; + }; + + fileSystems."/home/kasey/Pictures" = { + device = "/data/Pictures"; + fsType = "none"; + options = ["bind"]; + }; + + fileSystems."/home/kasey/Music" = { + device = "/data/Music"; + fsType = "none"; + options = ["bind"]; + }; + + fileSystems."/home/kasey/.local/share/PrismLauncher" = { + device = "/data/Games/PrismLauncher"; + fsType = "none"; + options = ["bind"]; + }; + + fileSystems."/home/kasey/Videos" = { + device = "/data/Videos"; + fsType = "none"; + options = ["bind"]; + }; + + fileSystems."/home/kasey/.local/share/Steam/steamapps" = { + device = "/data/Games/Steam/steamapps"; + fsType = "none"; + options = ["bind"]; + }; + + fileSystems."/home/kasey/.local/share/Steam/steamapps/compatdata" = { + device = "/games/Games/Steam/steamapps/compatdata"; + fsType = "none"; + options = ["bind"]; + }; + + fileSystems."/home/kasey/.local/share/Steam/compatibilitytools.d" = { + device = "/games/Games/Steam/compatibilitytools.d"; + fsType = "none"; + options = ["bind"]; + }; +} diff --git a/ea-bullshit.nix b/ea-bullshit.nix new file mode 100755 index 0000000..9c4b2c3 --- /dev/null +++ b/ea-bullshit.nix @@ -0,0 +1,10 @@ +{ + config, + pkgs, + inputs, + ... +}: { + networking.hosts = { + "127.0.0.1" = ["winter15.gosredirector.ea.com"]; + }; +} diff --git a/flake.nix b/flake.nix new file mode 100755 index 0000000..98225e6 --- /dev/null +++ b/flake.nix @@ -0,0 +1,37 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + luciole.url = "github:noctalia-dev/luciole"; + umbriel.url = "github:noctalia-dev/umbriel"; + alejandra.url = "github:kamadorueda/alejandra/4.1.0"; + alejandra.inputs.nixpkgs.follows = "nixpkgs"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = inputs @ { + nixpkgs, + alejandra, + home-manager, + ... + }: { + nixosConfigurations.singularity = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = {inherit inputs;}; + modules = [ + { + environment.systemPackages = [alejandra.defaultPackage.x86_64-linux]; + } + inputs.home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = {inherit inputs;}; + } + ./configuration.nix + ]; + }; + }; +} diff --git a/gpu-screen-recorder/gsr.nix b/gpu-screen-recorder/gsr.nix new file mode 100755 index 0000000..8795e89 --- /dev/null +++ b/gpu-screen-recorder/gsr.nix @@ -0,0 +1,105 @@ +{ + stdenv, + lib, + fetchgit, + makeWrapper, + meson, + ninja, + addDriverRunpath, + pkg-config, + libxcomposite, + libpulseaudio, + dbus, + ffmpeg, + wayland, + wayland-scanner, + vulkan-headers, + pipewire, + libdrm, + libva, + libglvnd, + libxdamage, + libxi, + libxrandr, + libxfixes, + libjpeg_turbo, + wrapperDir ? "/run/wrappers/bin", + gitUpdater, +}: +stdenv.mkDerivation rec { + pname = "gpu-screen-recorder"; + version = "5.12.4"; + + src = fetchgit { + url = "https://repo.dec05eba.com/${pname}"; + tag = version; + hash = "sha256-VceAqiWeDJEAqx96Y4WHUTsPLeb4HvkNbl4fmMi296g="; + }; + + nativeBuildInputs = [ + pkg-config + makeWrapper + meson + ninja + ]; + + buildInputs = [ + libxcomposite + libpulseaudio + dbus + ffmpeg + pipewire + wayland + wayland-scanner + vulkan-headers + libdrm + libva + libxdamage + libxi + libxrandr + libxfixes + ]; + + mesonFlags = [ + # Install the upstream systemd unit + (lib.mesonBool "systemd" true) + # Enable Wayland support + (lib.mesonBool "portal" true) + # Handle by the module + (lib.mesonBool "capabilities" true) + (lib.mesonBool "nvidia_suspend_fix" true) + ]; + + postPatch = '' + substituteInPlace src/capture/v4l2.c \ + --replace-fail "libturbojpeg.so.0" "${lib.getLib libjpeg_turbo}/lib/libturbojpeg.so.0" + ''; + + postInstall = '' + mkdir $out/bin/.wrapped + mv $out/bin/gpu-screen-recorder $out/bin/.wrapped/ + makeWrapper "$out/bin/.wrapped/gpu-screen-recorder" "$out/bin/gpu-screen-recorder" \ + --prefix LD_LIBRARY_PATH : "${ + lib.makeLibraryPath [ + libglvnd + addDriverRunpath.driverLink + ] + }" \ + --prefix PATH : "${wrapperDir}" \ + --suffix PATH : "$out/bin" + ''; + + passthru.updateScript = gitUpdater {}; + + meta = { + description = "Screen recorder that has minimal impact on system performance by recording a window using the GPU only"; + homepage = "https://git.dec05eba.com/gpu-screen-recorder/about/"; + license = lib.licenses.gpl3Only; + mainProgram = "gpu-screen-recorder"; + maintainers = with lib.maintainers; [ + babbaj + js6pak + ]; + platforms = ["x86_64-linux"]; + }; +} diff --git a/gpu-screen-recorder/notif.nix b/gpu-screen-recorder/notif.nix new file mode 100755 index 0000000..ede2d0f --- /dev/null +++ b/gpu-screen-recorder/notif.nix @@ -0,0 +1,60 @@ +{ + lib, + stdenv, + fetchgit, + pkg-config, + meson, + ninja, + libx11, + libxrender, + libxrandr, + libxext, + libglvnd, + wayland, + wayland-scanner, + gitUpdater, +}: +stdenv.mkDerivation (finalAttrs: { + pname = "gpu-screen-recorder-notification"; + version = "1.1.1"; + + src = fetchgit { + url = "https://repo.dec05eba.com/gpu-screen-recorder-notification"; + tag = finalAttrs.version; + hash = "sha256-WMuHiXNdGPMLlf6DZJGNC/PJgnycRAvRhnW8m104/t0="; + }; + + postPatch = '' + substituteInPlace depends/mglpp/depends/mgl/src/gl.c \ + --replace-fail "libGL.so.1" "${lib.getLib libglvnd}/lib/libGL.so.1" \ + --replace-fail "libGLX.so.0" "${lib.getLib libglvnd}/lib/libGLX.so.0" \ + --replace-fail "libEGL.so.1" "${lib.getLib libglvnd}/lib/libEGL.so.1" + ''; + + nativeBuildInputs = [ + pkg-config + meson + ninja + ]; + + buildInputs = [ + libx11 + libxrender + libxrandr + libxext + libglvnd + wayland + wayland-scanner + ]; + + passthru.updateScript = gitUpdater {}; + + meta = { + description = "Notification in the style of ShadowPlay"; + homepage = "https://git.dec05eba.com/gpu-screen-recorder-notification/about/"; + license = lib.licenses.gpl3Only; + mainProgram = "gsr-notify"; + maintainers = with lib.maintainers; [js6pak]; + platforms = lib.platforms.linux; + }; +}) diff --git a/gpu-screen-recorder/remove-gnome-postinstall.patch b/gpu-screen-recorder/remove-gnome-postinstall.patch new file mode 100755 index 0000000..dd0d5ac --- /dev/null +++ b/gpu-screen-recorder/remove-gnome-postinstall.patch @@ -0,0 +1,14 @@ +diff --git a/meson.build b/meson.build +index cf16e81..7c3629d 100644 +--- a/meson.build ++++ b/meson.build +@@ -147,9 +147,6 @@ install_subdir('translations', install_dir : gsr_ui_resources_path) + if get_option('desktop-files') == true + install_data(files('gpu-screen-recorder.desktop'), install_dir : join_paths(prefix, datadir, 'applications')) + install_subdir('icons/hicolor', install_dir : icons_path) +- +- gnome = import('gnome') +- gnome.post_install(update_desktop_database : true) + endif + + if get_option('systemd') == true \ No newline at end of file diff --git a/gpu-screen-recorder/ui.nix b/gpu-screen-recorder/ui.nix new file mode 100755 index 0000000..59a04e2 --- /dev/null +++ b/gpu-screen-recorder/ui.nix @@ -0,0 +1,105 @@ +{ + lib, + stdenv, + fetchgit, + pkg-config, + meson, + ninja, + makeWrapper, + gpu-screen-recorder, + gpu-screen-recorder-notification, + libx11, + libxrender, + libxrandr, + libxcomposite, + libxi, + libxcursor, + libglvnd, + libpulseaudio, + libdrm, + dbus, + wayland, + wayland-scanner, + wrapperDir ? "/run/wrappers/bin", + gitUpdater, +}: +stdenv.mkDerivation (finalAttrs: { + pname = "gpu-screen-recorder-ui"; + version = "1.10.8"; + + src = fetchgit { + url = "https://repo.dec05eba.com/gpu-screen-recorder-ui"; + tag = finalAttrs.version; + hash = "sha256-x7MBTUWDKCzClq4ukgtFazOD/RLkX5lgmm9slN5BjVk="; + }; + + patches = [ + ./remove-gnome-postinstall.patch + ]; + + postPatch = '' + substituteInPlace depends/mglpp/depends/mgl/src/gl.c \ + --replace-fail "libGL.so.1" "${lib.getLib libglvnd}/lib/libGL.so.1" \ + --replace-fail "libGLX.so.0" "${lib.getLib libglvnd}/lib/libGLX.so.0" \ + --replace-fail "libEGL.so.1" "${lib.getLib libglvnd}/lib/libEGL.so.1" + + substituteInPlace extra/gpu-screen-recorder-ui.service \ + --replace-fail "ExecStart=gsr-ui" "ExecStart=$out/bin/gsr-ui" + + substituteInPlace gpu-screen-recorder.desktop \ + --replace-fail "Exec=gsr-ui" "Exec=$out/bin/gsr-ui" + ''; + + nativeBuildInputs = [ + pkg-config + meson + ninja + makeWrapper + ]; + + buildInputs = [ + libx11 + libxrender + libxrandr + libxcomposite + libxi + libxcursor + libglvnd + libpulseaudio + libdrm + dbus + wayland + wayland-scanner + ]; + + mesonFlags = [ + # Handled by the module + (lib.mesonBool "capabilities" true) + ]; + + postInstall = let + gpu-screen-recorder-wrapped = gpu-screen-recorder.override { + inherit wrapperDir; + }; + in '' + wrapProgram "$out/bin/gsr-ui" \ + --prefix PATH : "${wrapperDir}" \ + --suffix PATH : "${ + lib.makeBinPath [ + gpu-screen-recorder-wrapped + gpu-screen-recorder-notification + ] + }" + ''; + + passthru.updateScript = gitUpdater {}; + + meta = { + description = "Fullscreen overlay UI for GPU Screen Recorder in the style of ShadowPlay"; + homepage = "https://git.dec05eba.com/gpu-screen-recorder-ui/about/"; + license = lib.licenses.gpl3Only; + mainProgram = "gsr-ui"; + maintainers = with lib.maintainers; [js6pak]; + platforms = lib.platforms.linux; + }; +}) diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100755 index 0000000..27f0dbd --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,36 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "uas" "usbhid" "sd_mod" "rtsx_pci_sdmmc"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/0c84303e-0537-4746-b7a2-656cea2690c6"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/F18A-074E"; + fsType = "vfat"; + options = ["fmask=0077" "dmask=0077"]; + }; + + swapDevices = []; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.npu.enable = true; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/home.nix b/home.nix new file mode 100755 index 0000000..178f5d1 --- /dev/null +++ b/home.nix @@ -0,0 +1,98 @@ +{ + config, + pkgs, + inputs, + ... +}: { + home-manager.users.kasey = { + pkgs, + inputs, + ... + }: let + # Define a unityhub that includes fonts. + unityhub = pkgs.unityhub.override {extraPkgs = pkgs: [pkgs.corefonts pkgs.ipafont];}; + in { + imports = [ + inputs.umbriel.homeModules.default + ./umbriel.nix + ]; + + home.packages = [ + unityhub + (pkgs.stdenvNoCC.mkDerivation rec { + pname = "unity"; + version = "2022.3.22f1"; + dontFixup = true; + + unitySrc = pkgs.fetchurl { + url = "https://download.unity3d.com/download_unity/887be4894c44/LinuxEditorInstaller/Unity-2022.3.22f1.tar.xz"; + hash = "sha256-eE//d2kFHA9p7bA52NCUMeeuQASmSh20QDcJ3biKpQY="; + }; + androidSupportSrc = pkgs.fetchurl { + url = "https://download.unity3d.com/download_unity/887be4894c44/MacEditorTargetInstaller/UnitySetup-Android-Support-for-Editor-2022.3.22f1.pkg"; + hash = "sha256-Vqk8HgnFsUzjLvjIhIdJTLFHpyE6UDhwR7hN7/Jjpak="; + }; + windowsSupportSrc = pkgs.fetchurl { + url = "https://download.unity3d.com/download_unity/887be4894c44/MacEditorTargetInstaller/UnitySetup-Windows-Mono-Support-for-Editor-2022.3.22f1.pkg"; + hash = "sha256-iBGBpsg3IwooTqQSC/y14qq5QLuQEOvftQ07iGXCBZ0="; + }; + + nativeBuildInputs = [pkgs.cpio pkgs.xarMinimal]; + buildInputs = [unityhub.fhsEnv]; + + unpackPhase = '' + mkdir android + xar -C android -xf "${androidSupportSrc}" + mkdir windows + xar -C windows -xf "${windowsSupportSrc}" + ''; + + installPhase = '' + # This Editor/version/Editor path helps Unity Hub recognize the version of the editor. + mkdir -p "$out/bin" "$out/Editor/${version}/Editor/Data/PlaybackEngines/AndroidPlayer" "$out/Editor/${version}/Editor/Data/PlaybackEngines/WindowsStandaloneSupport" + + tar -C "$out/Editor/${version}" -xf "${unitySrc}" + gzip -d < android/TargetSupport.pkg.tmp/Payload | cpio -iD "$out/Editor/${version}/Editor/Data/PlaybackEngines/AndroidPlayer" + gzip -d < windows/TargetSupport.pkg.tmp/Payload | cpio -iD "$out/Editor/${version}/Editor/Data/PlaybackEngines/WindowsStandaloneSupport" + + # Create unity wrapper script + cat > "$out/bin/unity" <<-EOF + #!/bin/sh + exec -a "$out/Editor/${version}/Editor/Unity" "${unityhub.fhsEnv}/bin/unityhub-fhs-env" "$out/Editor/${version}/Editor/Unity" "\$@" + EOF + chmod a+x "$out/bin/unity" + + # Fix font fallback + cat > "$out/Editor/${version}/Editor/Data/Resources/fontsettings.txt" <<-EOF + English|default=Inter, IPAPGothic, Verdana, Tahoma + English|Inter-Regular=Inter, IPAPGothic, Verdana, Tahoma + English|Inter-SemiBold=Inter, IPAPGothic, Verdana, Tahoma + English|Inter-Small=Inter, IPAPGothic, Verdana, Tahoma + English|Inter-Italic=Inter, IPAPGothic, Verdana, Tahoma + English|Inter-SemiBoldItalic=Inter, IPAPGothic, Verdana, Tahoma + EOF + ''; + }) + ]; + home.stateVersion = "26.11"; + xdg.userDirs.enable = true; + xdg.mimeApps = { + enable = true; + defaultApplications = { + "x-scheme-handler/tg" = "org.telegram.desktop.desktop"; + "x-scheme-handler/tonsite" = "org.telegram.desktop.desktop"; + }; + }; + services.xembed-sni-proxy.enable = true; + services.mpd.enable = true; + services.mpd-mpris.enable = true; + }; + + nix.optimise.automatic = true; + + nixpkgs.overlays = [ + (final: prev: { + alchemy = prev.callPackage ./alchemy-viewer/alchemy.nix {}; + }) + ]; +} diff --git a/nfs.nix b/nfs.nix new file mode 100755 index 0000000..5eaee20 --- /dev/null +++ b/nfs.nix @@ -0,0 +1,53 @@ +{ + fileSystems."/mnt/nfs" = { + device = "/nfs"; + options = ["bind"]; + fsType = "none"; + }; + + services.nfs.server.enable = true; + services.nfs.server.exports = '' + /nfs 10.1.1.0/22(rw,fsid=0,no_subtree_check) + ''; + services.nfs.server.lockdPort = 4001; + services.nfs.server.mountdPort = 4002; + services.nfs.server.statdPort = 4003; + + services.samba = { + enable = true; + securityType = "user"; + openFirewall = true; + settings = { + global = { + "workgroup" = "WORKGROUP"; + "server string" = "singularity-smb"; + "netbios name" = "singularity-smb"; + "security" = "user"; + #"use sendfile" = "yes"; + #"max protocol" = "smb2"; + # note: localhost is the ipv6 localhost ::1 + "hosts allow" = "10.1.1. 127.0.0.1 localhost"; + "hosts deny" = "0.0.0.0/0"; + "guest account" = "nobody"; + "map to guest" = "bad user"; + }; + "public" = { + "path" = "/games"; + "browseable" = "yes"; + "read only" = "no"; + "guest ok" = "no"; + "create mask" = "0644"; + "directory mask" = "0755"; + "force user" = "kasey"; + }; + }; + }; + + services.samba-wsdd = { + enable = true; + openFirewall = true; + }; + + networking.firewall.allowedTCPPorts = [111 2049 4000 4001 4002 20048]; + networking.firewall.allowedUDPPorts = [111 2049 4000 4001 4002 20048]; +} diff --git a/nvidia.nix b/nvidia.nix new file mode 100755 index 0000000..a676c83 --- /dev/null +++ b/nvidia.nix @@ -0,0 +1,36 @@ +{ + config, + pkgs, + inputs, + ... +}: { + services.xserver.videoDrivers = [ + "nvidia" + ]; + + hardware.nvidia = { + modesetting.enable = true; + powerManagement.enable = true; + dynamicBoost.enable = true; + open = true; + nvidiaSettings = true; + package = config.boot.kernelPackages.nvidiaPackages.latest; + }; + + hardware.graphics.extraPackages = with pkgs; [ + nvidia-vaapi-driver + ]; + + nix.settings = { + substituters = [ + "https://cache.nixos-cuda.org" + ]; + trusted-public-keys = [ + "cache.nixos-cuda.org:74DUi4Ye579gUqzH4ziL9IyiJBlDpMRn9MBN8oNan9M=" + ]; + }; + + nixpkgs.config.cudaSupport = true; + + environment.variables.LIBVA_DRIVER_NAME = "nvidia"; +} diff --git a/patented-gigabyte-bullshit.nix b/patented-gigabyte-bullshit.nix new file mode 100755 index 0000000..5250423 --- /dev/null +++ b/patented-gigabyte-bullshit.nix @@ -0,0 +1,35 @@ +{ + config, + pkgs, + inputs, + ... +}: { + hardware.firmware = [ + (pkgs.writeTextDir "lib/firmware/hda-jack-retask.fw" '' + [codec] + 0x10ec0245 0x14589205 0 + + [pincfg] + 0x12 0x90a60130 + 0x13 0x40000000 + 0x14 0x411111f0 + 0x17 0x90170120 + 0x18 0x411111f0 + 0x19 0x411111f0 + 0x1a 0x411111f0 + 0x1b 0x411111f0 + 0x1d 0x4069ba6d + 0x1e 0x411111f0 + 0x21 0x04211110 + '') + ]; + + boot.extraModprobeConfig = '' + options snd-hda-intel patch=hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw + ''; + + boot.blacklistedKernelModules = [ + "thunderbolt" + "intel_wmi_thunderbolt" + ]; +} diff --git a/umbriel.nix b/umbriel.nix new file mode 100755 index 0000000..144e848 --- /dev/null +++ b/umbriel.nix @@ -0,0 +1,334 @@ +{inputs, ...}: { + programs.umbriel = { + enable = true; + settings = { + include = { + optional.files = [ + "noctalia.toml" + ]; + }; + + output.eDP-1 = { + enabled = true; + scale = 1.333; + hdr = "on"; + position = [0 0]; + bit_depth = 10; + sdr_transfer = "gamma22"; # Or "srgb" for piecewise SDR decoding in HDR. + direct_scanout = true; + tearing = true; + }; + + output.HDMI-A-1 = { + mode = "1920x1080@144.02"; + position = [1922 0]; + direct_scanout = true; + tearing = true; + focus_at_startup = true; + }; + + general = { + autostart = ["noctalia" "wl-paste --watch cliphist store"]; + xwayland_native_resolution = true; + show_cheatsheet = false; + }; + events.lid_close = "umbriel msg output-disable:eDP-1"; + events.lid_open = "umbriel msg output-enable:eDP-1"; + animation = { + curve = "spring:1,2000"; + dialogs.dim = 0.3; + windows_opacity.enabled = true; + windows_opacity.curve = "spring:1,900"; + }; + appearance = { + drag_opacity = 1.0; + corner_radius = 8; + }; + appearance.blur = { + radius = 12; + passes = 3; + noise = 0.04; + brightness = 0.9; + contrast = 1.1; + saturation = 1.2; + }; + input = { + keyboard.numlock_toggle = true; + keyboard.repeat_rate = 50; + keyboard.repeat_delay = 300; + mouse.natural_scroll = false; + mouse.sensitivity = -0.3; + mouse.accel_profile = "flat"; + touchpad.natural_scroll = true; + touchpad.sensitivity = -0.1; + touchpad.scroll_factor = 0.15; + cursor = { + theme = "breeze_cursors"; + }; + }; + layout.mode = "scrolling"; + layout.client_maximize = "column"; + layout.scrolling.default_extent_fraction = 0.5; + layout.scrolling.center_focused = "on_overflow"; + workspaces.back_and_forth = true; + + layer_rule = [ + { + match.namespace = "^noctalia-(bar-[^\"]+|notification|dock|panel|attached-panel|osd|desktop-widget-[^\"]*)$"; + blur = true; + blur_ignore_alpha = 0.1; + blur_popups = true; + } + { + match.namespace = "^noctalia-(notification|dock|panel|attached-panel|osd)$"; + blur_optimized = false; + } + { + match.namespace = "^noctalia-window-switcher$"; + blur = true; + blur_optimized = false; + } + ]; + + window_rule = [ + { + blur = true; + blur_optimized = false; + blur_ignore_alpha = 0.01; + } + { + match.app_id = "^dev.noctalia.Noctalia$"; + default_floating = true; + default_floating_size_px = { + width = 1020; + height = 900; + }; + default_maximize_to_edges = false; + } + { + match.app_id = "^dev.noctalia.UmbrielSharePicker$"; + default_floating = true; + default_floating_size_px = { + width = 800; + height = 600; + }; + } + { + match.title = "^(Picture-in-Picture|Picture in picture)$"; + default_floating = true; + default_maximize = false; + default_position = { + x = 20; + y = 20; + anchor = "bottom_right"; + }; + default_maximize_to_edges = false; + } + { + match.title = "^notificationtoasts_.+_desktop"; + default_position = { + x = 0; + y = 0; + anchor = "bottom_right"; + }; + default_focused = false; + default_pinned = true; + } + { + match.app_id = "^steam_app_.*$"; + confine_pointer = true; + } + { + match.app_id = "^org.kde.kcalc$"; + default_floating = true; + default_floating_size = { + width = 0.25; + height = 0.5; + }; + default_maximize_to_edges = false; + } + { + match.app_id = "^app.fluxer.FluxerDesktopCanary$"; + border_width = 0; + shadow = false; + blur_ignore_alpha = 0.01; + } + { + match.is_focused = false; + opacity = 0.6; + blur = true; + blur_optimized = false; + blur_ignore_alpha = 0.01; + } + { + match.content_type = "game"; + tearing = true; + default_fullscreen = true; + } + ]; + + keybinds = { + "Mod+Return" = { + action = "spawn kitty"; + repeat = false; + }; + "Mod+Space" = "spawn noctalia msg panel-toggle launcher"; + "Mod+Q" = { + action = "window-close"; + repeat = false; + }; + "Mod+Escape" = { + action = "spawn noctalia msg dpms-off"; + repeat = false; + }; + "Mod+Shift+Escape" = { + action = "spawn noctalia msg panel-toggle session"; + repeat = false; + }; + "Mod+Shift+L" = { + action = "spawn noctalia msg session lock"; + allow_when_inhibited = true; + repeat = false; + }; + + "XF86AudioRaiseVolume" = { + action = "spawn noctalia msg volume-up"; + allow_when_locked = true; + }; + "XF86AudioLowerVolume" = { + action = "spawn noctalia msg volume-down"; + allow_when_locked = true; + }; + "XF86AudioMute" = { + action = "spawn noctalia msg volume-mute"; + allow_when_locked = true; + repeat = false; + }; + "XF86AudioPlay" = { + action = "spawn noctalia msg media toggle"; + allow_when_locked = true; + repeat = false; + }; + "XF86AudioNext" = { + action = "spawn noctalia msg media next"; + allow_when_locked = true; + }; + "XF86AudioPrev" = { + action = "spawn noctalia msg media previous"; + allow_when_locked = true; + }; + "XF86MonBrightnessUp" = { + action = "spawn noctalia msg brightness-up"; + allow_when_locked = true; + }; + "XF86MonBrightnessDown" = { + action = "spawn noctalia msg brightness-down"; + allow_when_locked = true; + }; + + "Mod+H" = "window-focus-left"; + "Mod+J" = "window-focus-down"; + "Mod+K" = "window-focus-up"; + "Mod+L" = "window-focus-right"; + + "Mod+F" = { + action = "window-toggle-maximize"; + repeat = false; + }; + "Mod+Shift+F" = { + action = "window-toggle-fullscreen"; + repeat = false; + }; + "Mod+WheelUp" = { + action = "window-focus-left"; + cooldown_ms = 50; + }; + "Mod+WheelDown" = { + action = "window-focus-right"; + cooldown_ms = 50; + }; + "Mod+G" = { + action = "overview-toggle"; + repeat = false; + }; + + "Mod+1" = "workspace-switch 1"; + "Mod+2" = "workspace-switch 2"; + "Mod+3" = "workspace-switch 3"; + "Mod+4" = "workspace-switch 4"; + "Mod+5" = "workspace-switch 5"; + "Mod+6" = "workspace-switch 6"; + "Mod+7" = "workspace-switch 7"; + "Mod+8" = "workspace-switch 8"; + "Mod+9" = "workspace-switch 9"; + "Mod+Shift+1" = "window-move-to-workspace 1"; + "Mod+Shift+2" = "window-move-to-workspace 2"; + "Mod+Shift+3" = "window-move-to-workspace 3"; + "Mod+Shift+4" = "window-move-to-workspace 4"; + "Mod+Shift+5" = "window-move-to-workspace 5"; + "Mod+Shift+6" = "window-move-to-workspace 6"; + "Mod+Shift+7" = "window-move-to-workspace 7"; + "Mod+Shift+8" = "window-move-to-workspace 8"; + "Mod+Shift+9" = "window-move-to-workspace 9"; + + "Mod+Shift+H" = "window-cycle-primary-extent"; + + # Screenshot display cursor is on + "Print" = { + action = "spawn noctalia msg screenshot-fullscreen --format webp --quality 90 pick"; + repeat = false; + }; + # Screenshot region + "Mod+Print" = { + action = "spawn noctalia msg screenshot-region --format webp --quality 90"; + repeat = false; + }; + # Screenshot active window + "Alt+Print" = { + action = "spawn noctalia msg screenshot-window --format webp --quality 90"; + repeat = false; + }; + + # Binds for laptop built in keyboard (which doesn't have print screen) + # Screenshot display cursor is on + "Mod+Shift+S" = { + action = "spawn noctalia msg screenshot-fullscreen pick --format webp --quality 90"; + repeat = false; + }; + # Screenshot active window + "Mod+Alt+Shift+S" = { + action = "spawn noctalia msg screenshot-window --format webp --quality 90"; + repeat = false; + }; + # Screenshot region + "Ctrl+Mod+Shift+S" = { + action = "spawn noctalia msg screenshot-region --format webp --quality 90"; + repeat = false; + }; + + "Alt+Tab" = { + action = "spawn noctalia msg window-switcher"; + repeat = false; + }; + + "Alt+A" = { + action = "spawn /home/kasey/.scripts/audioswitch"; + repeat = false; + }; + "Alt+D" = { + action = "spawn /home/kasey/.scripts/define"; + repeat = false; + }; + "Alt+M" = { + action = "spawn /home/kasey/.scripts/mpdmenu"; + repeat = false; + }; + + "Mod+C" = { + action = "spawn noctalia msg panel-toggle clipboard"; + repeat = false; + }; + }; + }; + }; +} diff --git a/unity.nix b/unity.nix new file mode 100755 index 0000000..f2197a3 --- /dev/null +++ b/unity.nix @@ -0,0 +1,62 @@ +{pkgs, ...}: let + # Define a unityhub that includes fonts. + unityhub = pkgs.unityhub.override {extraPkgs = pkgs: [pkgs.corefonts pkgs.ipafont];}; +in { + home.packages = [ + unityhub + (pkgs.stdenvNoCC.mkDerivation rec { + pname = "unity"; + version = "2022.3.22f1"; + dontFixup = true; + + unitySrc = pkgs.fetchurl { + url = "https://download.unity3d.com/download_unity/887be4894c44/LinuxEditorInstaller/Unity-2022.3.22f1.tar.xz"; + hash = "sha256-eE//d2kFHA9p7bA52NCUMeeuQASmSh20QDcJ3biKpQY="; + }; + androidSupportSrc = pkgs.fetchurl { + url = "https://download.unity3d.com/download_unity/887be4894c44/MacEditorTargetInstaller/UnitySetup-Android-Support-for-Editor-2022.3.22f1.pkg"; + hash = "sha256-Vqk8HgnFsUzjLvjIhIdJTLFHpyE6UDhwR7hN7/Jjpak="; + }; + windowsSupportSrc = pkgs.fetchurl { + url = "https://download.unity3d.com/download_unity/887be4894c44/MacEditorTargetInstaller/UnitySetup-Windows-Mono-Support-for-Editor-2022.3.22f1.pkg"; + hash = "sha256-iBGBpsg3IwooTqQSC/y14qq5QLuQEOvftQ07iGXCBZ0="; + }; + + nativeBuildInputs = [pkgs.cpio pkgs.xarMinimal]; + buildInputs = [unityhub.fhsEnv]; + + unpackPhase = '' + mkdir android + xar -C android -xf "${androidSupportSrc}" + mkdir windows + xar -C windows -xf "${windowsSupportSrc}" + ''; + + installPhase = '' + # This Editor/version/Editor path helps Unity Hub recognize the version of the editor. + mkdir -p "$out/bin" "$out/Editor/${version}/Editor/Data/PlaybackEngines/AndroidPlayer" "$out/Editor/${version}/Editor/Data/PlaybackEngines/WindowsStandaloneSupport" + + tar -C "$out/Editor/${version}" -xf "${unitySrc}" + gzip -d < android/TargetSupport.pkg.tmp/Payload | cpio -iD "$out/Editor/${version}/Editor/Data/PlaybackEngines/AndroidPlayer" + gzip -d < windows/TargetSupport.pkg.tmp/Payload | cpio -iD "$out/Editor/${version}/Editor/Data/PlaybackEngines/WindowsStandaloneSupport" + + # Create unity wrapper script + cat > "$out/bin/unity" <<-EOF + #!/bin/sh + exec -a "$out/Editor/${version}/Editor/Unity" "${unityhub.fhsEnv}/bin/unityhub-fhs-env" "$out/Editor/${version}/Editor/Unity" "\$@" + EOF + chmod a+x "$out/bin/unity" + + # Fix font fallback + cat > "$out/Editor/${version}/Editor/Data/Resources/fontsettings.txt" <<-EOF + English|default=Inter, IPAPGothic, Verdana, Tahoma + English|Inter-Regular=Inter, IPAPGothic, Verdana, Tahoma + English|Inter-SemiBold=Inter, IPAPGothic, Verdana, Tahoma + English|Inter-Small=Inter, IPAPGothic, Verdana, Tahoma + English|Inter-Italic=Inter, IPAPGothic, Verdana, Tahoma + English|Inter-SemiBoldItalic=Inter, IPAPGothic, Verdana, Tahoma + EOF + ''; + }) + ]; +}