From dd317260281bbae71e1cbc3bb7cb3b41441eb664 Mon Sep 17 00:00:00 2001 From: Danilo Reyes Date: Thu, 13 Jun 2024 22:53:44 -0600 Subject: [PATCH] nix-gaming flake --- flake.lock | 84 ++++++++++++++++++++++++++++++++++---- flake.nix | 1 + modules/apps/gaming.nix | 4 +- modules/services/sound.nix | 18 ++++---- 4 files changed, 87 insertions(+), 20 deletions(-) diff --git a/flake.lock b/flake.lock index ee416bb..73f1191 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,23 @@ { "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1717285511, + "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -21,22 +39,53 @@ "type": "github" } }, - "nixpkgs": { + "nix-gaming": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + }, "locked": { - "lastModified": 1717144377, - "narHash": "sha256-F/TKWETwB5RaR8owkPPi+SPJh83AQsm6KrQAlJ8v/uA=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "805a384895c696f802a9bf5bf4720f37385df547", + "lastModified": 1718328127, + "narHash": "sha256-2ldscRIlStuv/fRmifXbvjlMpyVuy8Z9zhiDBRM6oe0=", + "owner": "fufexan", + "repo": "nix-gaming", + "rev": "2c9a664875b410d12282fed9043f4703b6fdb029", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixos-24.05", + "owner": "fufexan", + "repo": "nix-gaming", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1717774105, + "narHash": "sha256-HV97wqUQv9wvptiHCb3Y0/YH0lJ60uZ8FYfEOIzYEqI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d226935fd75012939397c83f6c385e4d6d832288", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1717284937, + "narHash": "sha256-lIbdfCsf8LMFloheeE6N31+BMIeixqyQWbSr2vk79EQ=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" + } + }, "nixpkgs-master": { "locked": { "lastModified": 1717264137, @@ -69,10 +118,27 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1717144377, + "narHash": "sha256-F/TKWETwB5RaR8owkPPi+SPJh83AQsm6KrQAlJ8v/uA=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "805a384895c696f802a9bf5bf4720f37385df547", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "home-manager": "home-manager", - "nixpkgs": "nixpkgs", + "nix-gaming": "nix-gaming", + "nixpkgs": "nixpkgs_2", "nixpkgs-master": "nixpkgs-master", "nixpkgs-unstable": "nixpkgs-unstable" } diff --git a/flake.nix b/flake.nix index 37b7504..74cfe43 100644 --- a/flake.nix +++ b/flake.nix @@ -6,6 +6,7 @@ nixpkgs-master.url = "github:nixos/nixpkgs?ref=master"; home-manager.url = "github:nix-community/home-manager/release-24.05"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; + nix-gaming.url = "github:fufexan/nix-gaming"; }; outputs = { self, nixpkgs, nixpkgs-unstable, nixpkgs-master, home-manager, ... diff --git a/modules/apps/gaming.nix b/modules/apps/gaming.nix index 29796de..0fae952 100644 --- a/modules/apps/gaming.nix +++ b/modules/apps/gaming.nix @@ -1,4 +1,5 @@ -{ config, lib, pkgs, ... }: { +{ config, lib, pkgs, inputs, ... }: { + imports = [ inputs.nix-gaming.nixosModules.platformOptimizations ]; options.my.apps.gaming.enable = lib.mkEnableOption "enable"; config = lib.mkIf config.my.apps.gaming.enable { programs = { @@ -8,6 +9,7 @@ gamescopeSession.enable = true; remotePlay.openFirewall = true; dedicatedServer.openFirewall = true; + platformOptimizations.enable = true; }; }; users.users.jawz.packages = diff --git a/modules/services/sound.nix b/modules/services/sound.nix index cc7bcb1..362a955 100644 --- a/modules/services/sound.nix +++ b/modules/services/sound.nix @@ -1,22 +1,20 @@ -{ config, lib, ... }: { - imports = [ - # nixGaming.nixosModules.pipewireLowLatency - ]; +{ config, lib, inputs, ... }: { + imports = [ inputs.nix-gaming.nixosModules.pipewireLowLatency ]; options.my.services.sound.enable = lib.mkEnableOption "enable"; config = lib.mkIf config.my.services.sound.enable { hardware.pulseaudio.enable = false; - security.rtkit.enable = true; + security.rtkit.enable = true; # make pipewire realtime-capable sound.enable = false; services.pipewire = { enable = true; alsa.enable = true; alsa.support32Bit = true; pulse.enable = true; - # lowLatency = { - # enable = true; - # quantum = 64; - # rate = 48000; - # }; + lowLatency = { + enable = true; + quantum = 64; + rate = 48000; + }; }; }; }