Code Monkey home page Code Monkey logo

nix-gaming's Introduction

๐ŸŽฎ nix-gaming

Gaming related stuff for Nix and NixOS.

See an overview of the flake outputs by running nix flake show github:fufexan/nix-gaming.

๐Ÿ—ƒ๏ธ What's in here?

Package Description
faf-client Forged Alliance Forever client (multiple packages)
osu-lazer-bin osu! lazer, extracted from the official AppImage
osu-stable osu! stable version
rocket-league Rocket League from Epic Games
star-citizen Star Citizen
technic-launcher Technic Launcher
wine-discord-ipc-bridge Wine-Discord RPC Bridge
wine Multiple Wine packages
winestreamproxy Wine-Discord RPC (broken)
proton-ge Custom build of Proton with the most recent bleeding-edge Proton Experimental WINE
northstar-proton Proton build based on TKG's proton-tkg build system to run the Northstar client on Linux and SteamDeck
viper Launcher+Updater for Titanfall2 Northstar Client
  • legendaryBuilder is a function that installs games with legendary-gl. You are expected to log in before using it, with legendary auth. The function takes an attrset containing at least the attrset games which includes the games you want installed. Optionally, you can set an opts attrset that will set the options you set inside for all games listed. You can find a usage example in example.nix.

Install & Run

It's recommended to set up Cachix so you don't have to build packages (most useful for wine).

# configuration.nix
{
  nix.settings = {
    substituters = ["https://nix-gaming.cachix.org"];
    trusted-public-keys = ["nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4="];
  };
}

Now, rebuild your configuration and continue reading for install instructions.

If you're not using flakes, go here.

โ„๏ธ Flakes

Add these packages to your home.packages or environment.systemPackages by adding nix-gaming as an input:

# flake.nix
{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    home-manager.url = "github:nix-community/home-manager";

    nix-gaming.url = "github:fufexan/nix-gaming";
  };

  outputs = {self, nixpkgs, ...}@inputs: {
    # set up for NixOS
    nixosConfigurations.HOSTNAME = nixpkgs.lib.nixosSystem {
      specialArgs = {inherit inputs;};
      modules = [
        ./configuration.nix
        # ...
      ];
    };

    # or for Home Manager
    homeConfigurations.HOSTNAME = inputs.home-manager.lib.homeManagerConfiguration {
      pkgs = import nixpkgs {
        system = "x86_64-linux";
        config.allowUnfree = true;
      };

      extraSpecialArgs = {inherit inputs;};

      modules = [
        ./home.nix
        # ...
      ];
    }
  };
}

Then, add the package(s):

{pkgs, inputs, ...}: {
  environment.systemPackages = [ # or home.packages
    inputs.nix-gaming.packages.${pkgs.system}.<package> # installs a package
  ];
}

If you want to install packages to your profile instead, do it like this

  nix profile install github:fufexan/nix-gaming#<package>

Everything is available as an overlay if you prefer that, though your results may greatly differ from the packages.

Nix Stable

To install packages to environment.systemPackages, add this in configuration.nix:

{pkgs, ...}: let
  nix-gaming = import (builtins.fetchTarball "https://github.com/fufexan/nix-gaming/archive/master.tar.gz");
in {
  # install packages
  environment.systemPackages = [ # or home.packages
    nix-gaming.packages.${pkgs.hostPlatform.system}.<package>
  ];
}

PipeWire low latency

PipeWire is a new audio backend that replaces ALSA, PulseAudio and JACK. It is as low latency as JACK and as easy to use as Pulse.

This module extends the PipeWire module from Nixpkgs and makes it easy to enable the low latency settings in a few lines.

Flakes

Assuming you've followed the Install/Flakes instructions, all you need to do is add the module to your configuration like this:

{inputs, ...}: {
  imports = [
    inputs.nix-gaming.nixosModules.pipewireLowLatency
  ];
}

Now you can skip to Usage.

Stable

Assuming you've followed the Install/Nix Stable instructions, all you need to do is add the module to your configuration like this:

{pkgs, ...}: let
  nix-gaming = /* ... */;
in {
  imports = [
    nix-gaming.nixosModules.pipewireLowLatency
  ];
}

Usage

Import the module in your configuration and enable it along with PipeWire:

{
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;

    lowLatency = {
      # enable this module
      enable = true;
      # defaults (no need to be set unless modified)
      quantum = 64;
      rate = 48000;
    };
  };

  # make pipewire realtime-capable
  security.rtkit.enable = true;
}

If you get no sound, you may want to increase quantum.

You can calculate the theoretical latency by dividing quantum by rate (48/48000 is exactly 1ms).

Steam Compatibility Tools

nix-gaming provides a batch of compatibility tools for Steam that you may want to use. Additionally, it also provides a steamCompat module that will extend programs.steam with an extraCompatPackages = [] option that you may use to automatically append your favorite compatibility tools to Steam's compat tools path.

Flakes

Assuming you've followed the Install/Flakes instructions, all you need to do is add the module to your configuration like this:

{inputs, ...}: {
  imports = [
    inputs.nix-gaming.nixosModules.steamCompat
  ];
}

Now you can skip to Usage.

Stable

Assuming you've followed the Install/Nix Stable instructions, all you need to do is add the module to your configuration like this:

{pkgs, ...}: let
  nix-gaming = /* ... */;
in {
  imports = [
    nix-gaming.nixosModules.steamCompat
  ];
}

Usage

{
  programs.steam = {
    # enable steam as usual
    enable = true;

    # add extra compatibility tools to your STEAM_EXTRA_COMPAT_TOOLS_PATHS using the newly added `extraCompatPackages` option
    extraCompatPackages = [
      # add the packages that you would like to have in Steam's extra compatibility packages list
      # pkgs.luxtorpeda
      # inputs.nix-gaming.packages.${pkgs.system}.proton-ge
      # etc.
    ];
  };
}

โš™ Game overrides

Wine-based game derivations were written with versatility in mind.

These arguments can be modified in order to get the desired results.

{
  wine      ? wine-ge,          # controls the wine package used to run wine games
  wineFlags ? "",               # which flags to run wine with (literal)
  pname     ? "game-name",      # name of the script and package
  location  ? "$HOME/${pname}", # where to install the game/wine prefix
  tricks    ? [],               # which wine tricks to install

  preCommands  ? "",            # run commands before the game is started
  postCommands ? "",            # run commands after the game is closed
}:

osu-stable wine-discord-ipc-bridge wine overriding

Sometimes you want to override wine for various reasons. Here's how to do it:

{
  environment.systemPackages = let
    gamePkgs = inputs.nix-gaming.packages.${pkgs.hostPlatform.system};
  in [ # or home.packages
    gamePkgs.osu-stable.override rec {
      wine = <your-wine>;
      wine-discord-ipc-bridge = gamePkgs.wine-discord-ipc-bridge.override {inherit wine;}; # or override this one as well
    };
  ];
}

๐Ÿ“ Tips

In order to get the most performance out of your machine, you could use the following tweaks:

  • custom/gaming kernel: linux_xanmod is the recommended one for games, since it provides many patches that aid wine and other games. It also provides a better desktop experience due to its preemptive build and tickless scheduler.
  • gamemode: lets you achieve lower nice values and higher realtime privileges at game start. It can either detect games or be started with gamemode-run.

๐Ÿ‘ฅ Credits & Resources

Thank you: boppyt - gonX - InfinityGhost - LavaDesu - openglfreak - yusdacra and to all the contributors and users of this repo!

nix-gaming's People

Contributors

fufexan avatar kskarthik5 avatar notashelf avatar chayleaf avatar shardion avatar pedrohlc avatar dixslyf avatar lovingmelody avatar thiagokokada avatar sefidel avatar darkkirb avatar 2epik4u avatar amarshall avatar infinityghost avatar lavadesu avatar ludovicopiero avatar lunnova avatar keksbg avatar skver0 avatar jamesbt365 avatar nferhat avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.