From 5ecb90226588fd50fb8b6838e4f623c95437f661 Mon Sep 17 00:00:00 2001 From: Joinemm Date: Fri, 12 Apr 2024 18:03:53 +0300 Subject: [PATCH] add nix-gaming --- flake.lock | 60 +++++++++++++++++++++++++++++++++++++++++++++- flake.nix | 5 ++++ modules/gaming.nix | 57 +++++++++++++++++++++++++++++-------------- modules/gui.nix | 3 +++ modules/nix.nix | 6 +++-- 5 files changed, 110 insertions(+), 21 deletions(-) diff --git a/flake.lock b/flake.lock index 3134353..3af0892 100644 --- a/flake.lock +++ b/flake.lock @@ -94,6 +94,24 @@ } }, "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1712014858, + "narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9126214d0a59633752a136528f5f3b9aa8565b7d", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { "inputs": { "nixpkgs-lib": [ "nixvim", @@ -231,6 +249,27 @@ "type": "github" } }, + "nix-gaming": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1712884330, + "narHash": "sha256-xYTrM82HEy1E1tGysT3CfNLgTKym9TUMciOPJrPkPaA=", + "owner": "fufexan", + "repo": "nix-gaming", + "rev": "e3f09d077b360802d5b744befd2a0803fb9aae18", + "type": "github" + }, + "original": { + "owner": "fufexan", + "repo": "nix-gaming", + "type": "github" + } + }, "nix-index-database": { "inputs": { "nixpkgs": [ @@ -282,11 +321,29 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1711703276, + "narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d8fe5e6c92d0d190646fb9f1056741a229980089", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixvim": { "inputs": { "devshell": "devshell", "flake-compat": "flake-compat", - "flake-parts": "flake-parts", + "flake-parts": "flake-parts_2", "home-manager": [ "home-manager" ], @@ -343,6 +400,7 @@ "bin": "bin", "disko": "disko", "home-manager": "home-manager", + "nix-gaming": "nix-gaming", "nix-index-database": "nix-index-database", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", diff --git a/flake.nix b/flake.nix index 7ea0446..5de4f82 100644 --- a/flake.nix +++ b/flake.nix @@ -38,6 +38,11 @@ url = "github:joinemm/bin"; inputs.nixpkgs.follows = "nixpkgs"; }; + + nix-gaming = { + url = "github:fufexan/nix-gaming"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = inputs @ { diff --git a/modules/gaming.nix b/modules/gaming.nix index 6644dcb..0e546da 100644 --- a/modules/gaming.nix +++ b/modules/gaming.nix @@ -1,27 +1,42 @@ -{pkgs, ...}: { +{ + pkgs, + inputs, + ... +}: { + imports = [ + inputs.nix-gaming.nixosModules.platformOptimizations + ]; + programs = { - steam.enable = true; + steam = { + enable = true; + platformOptimizations.enable = true; + extraCompatPackages = with pkgs; [ + proton-ge-bin + ]; + }; + gamemode.enable = true; + # for minecraft java.enable = true; }; - hardware.opengl = { - enable = true; - driSupport = true; - driSupport32Bit = true; - }; + hardware = { + opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; - # better for steam proton games - systemd.extraConfig = "DefaultLimitNOFILE=1048576"; + # Add opengl/vulkan support + extraPackages = with pkgs; [ + libva + ]; + }; - # Add opengl/vulkan support - hardware.opengl.extraPackages = with pkgs; [ - libva - ]; - - # Xbox wireless controller driver - hardware.xone.enable = true; + # Xbox wireless controller driver + xone.enable = true; + }; environment.systemPackages = with pkgs; [ # vulkan @@ -29,8 +44,14 @@ vulkan-loader vulkan-validation-layers vulkan-extension-layer - # open source minecraft launcher - prismlauncher + + prismlauncher # open source minecraft launcher protontricks + mangohud ]; + + environment.sessionVariables = { + MANGOHUD = "1"; + MANGOHUD_DLSYM = "1"; + }; } diff --git a/modules/gui.nix b/modules/gui.nix index 1192b33..2384088 100644 --- a/modules/gui.nix +++ b/modules/gui.nix @@ -35,6 +35,9 @@ autoRepeatDelay = 300; autoRepeatInterval = 25; + # I don't need xterm + excludePackages = [pkgs.xterm]; + # use startx as a display manager displayManager.startx.enable = true; libinput = { diff --git a/modules/nix.nix b/modules/nix.nix index dcdbc67..2f29ef0 100644 --- a/modules/nix.nix +++ b/modules/nix.nix @@ -10,12 +10,14 @@ nix = { settings = { substituters = [ - "https://cache.vedenemo.dev" "https://numtide.cachix.org" + "https://nix-gaming.cachix.org" + "https://cache.vedenemo.dev" ]; trusted-public-keys = [ - "cache.vedenemo.dev:8NhplARANhClUSWJyLVk4WMyy1Wb4rhmWW2u8AejH9E=" "numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ik6cQjb41X0iXVXeHigGmycPPE=" + "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" + "cache.vedenemo.dev:8NhplARANhClUSWJyLVk4WMyy1Wb4rhmWW2u8AejH9E=" ]; trusted-users = ["root" "@wheel"];