mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-01 07:03:08 +02:00
feat: gaming - gamemode + stream
This commit is contained in:
100
flake.lock
generated
100
flake.lock
generated
@@ -206,6 +206,24 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts_3": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1704982712,
|
||||
"narHash": "sha256-2Ptt+9h8dczgle2Oo6z5ni5rt/uLMG47UFTR1ry/wgg=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "07f6395285469419cf9d078f59b5b49993198c00",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems_2"
|
||||
@@ -531,6 +549,25 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-gaming": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts_3",
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1705886383,
|
||||
"narHash": "sha256-AXP+WRbsyCYdT0AQNHEBvblMed64oV2siReHwK+BmRk=",
|
||||
"owner": "fufexan",
|
||||
"repo": "nix-gaming",
|
||||
"rev": "620f74d52371e5fbbd8c6d6dae3b3b36de26d1f7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "fufexan",
|
||||
"repo": "nix-gaming",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixlib": {
|
||||
"locked": {
|
||||
"lastModified": 1693701915,
|
||||
@@ -585,7 +622,7 @@
|
||||
},
|
||||
"nixos-licheepi4a": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"thead-kernel": "thead-kernel"
|
||||
},
|
||||
"locked": {
|
||||
@@ -606,7 +643,7 @@
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"mesa-panfork": "mesa-panfork",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
"pre-commit-hooks": "pre-commit-hooks"
|
||||
},
|
||||
"locked": {
|
||||
@@ -625,16 +662,16 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1691280485,
|
||||
"narHash": "sha256-/8Ct9092OC1TTNzHgbcE9ejQdS2QxZYGqrWXEwUxdtQ=",
|
||||
"owner": "nixos",
|
||||
"lastModified": 1705697961,
|
||||
"narHash": "sha256-XepT3WS516evSFYkme3GrcI3+7uwXHqtHbip+t24J7E=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "240472b7e47a641e9e7675f58b64d3626ca7824d",
|
||||
"rev": "e5d1c87f5813afde2dda384ac807c57a105721cc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-23.05-small",
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
@@ -655,6 +692,24 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"dir": "lib",
|
||||
"lastModified": 1703961334,
|
||||
"narHash": "sha256-M1mV/Cq+pgjk0rt6VxoyyD+O8cOUiai8t9Q6Yyq4noY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "b0d36bd0a420ecee3bc916c91886caca87c894e9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"dir": "lib",
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1678872516,
|
||||
@@ -720,6 +775,22 @@
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1691280485,
|
||||
"narHash": "sha256-/8Ct9092OC1TTNzHgbcE9ejQdS2QxZYGqrWXEwUxdtQ=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "240472b7e47a641e9e7675f58b64d3626ca7824d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-23.05-small",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1691486536,
|
||||
"narHash": "sha256-W2jYTn6rNiJEpjXkOiZxNltgxxwgeZE5cQ967NgsrHU=",
|
||||
@@ -735,7 +806,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"nixpkgs_4": {
|
||||
"locked": {
|
||||
"lastModified": 1705677747,
|
||||
"narHash": "sha256-eyM3okYtMgYDgmYukoUzrmuoY4xl4FUujnsv/P6I/zI=",
|
||||
@@ -751,7 +822,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_4": {
|
||||
"nixpkgs_5": {
|
||||
"locked": {
|
||||
"lastModified": 1701436327,
|
||||
"narHash": "sha256-tRHbnoNI8SIM5O5xuxOmtSLnswEByzmnQcGGyNRjxsE=",
|
||||
@@ -765,7 +836,7 @@
|
||||
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.%2A.tar.gz"
|
||||
}
|
||||
},
|
||||
"nixpkgs_5": {
|
||||
"nixpkgs_6": {
|
||||
"locked": {
|
||||
"lastModified": 1702921762,
|
||||
"narHash": "sha256-O/rP7gulApQAB47u6szEd8Pn8Biw0d84j5iuP2tcxzY=",
|
||||
@@ -783,7 +854,7 @@
|
||||
},
|
||||
"nuenv": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_4",
|
||||
"nixpkgs": "nixpkgs_5",
|
||||
"rust-overlay": "rust-overlay_2"
|
||||
},
|
||||
"locked": {
|
||||
@@ -802,7 +873,7 @@
|
||||
},
|
||||
"nur-ryan4yin": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_5"
|
||||
"nixpkgs": "nixpkgs_6"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1705366605,
|
||||
@@ -934,11 +1005,12 @@
|
||||
"lanzaboote": "lanzaboote",
|
||||
"mysecrets": "mysecrets",
|
||||
"nix-darwin": "nix-darwin",
|
||||
"nix-gaming": "nix-gaming",
|
||||
"nixos-generators": "nixos-generators",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixos-licheepi4a": "nixos-licheepi4a",
|
||||
"nixos-rk3588": "nixos-rk3588",
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
"nixpkgs": "nixpkgs_4",
|
||||
"nixpkgs-darwin": "nixpkgs-darwin",
|
||||
"nixpkgs-stable": "nixpkgs-stable_2",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
|
||||
@@ -79,11 +79,13 @@
|
||||
extra-substituters = [
|
||||
"https://anyrun.cachix.org"
|
||||
"https://hyprland.cachix.org"
|
||||
"https://nix-gaming.cachix.org"
|
||||
# "https://nixpkgs-wayland.cachix.org"
|
||||
];
|
||||
extra-trusted-public-keys = [
|
||||
"anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s="
|
||||
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
|
||||
"nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4="
|
||||
# "nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
|
||||
];
|
||||
};
|
||||
@@ -152,6 +154,8 @@
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
nix-gaming.url = "github:fufexan/nix-gaming";
|
||||
|
||||
# add git hooks to format nix code before commit
|
||||
pre-commit-hooks = {
|
||||
url = "github:cachix/pre-commit-hooks.nix";
|
||||
|
||||
12
home/linux/desktop/base/games.nix
Normal file
12
home/linux/desktop/base/games.nix
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
pkgs,
|
||||
nix-gaming,
|
||||
...
|
||||
}: {
|
||||
home.packages = with pkgs; [
|
||||
# nix-gaming.packages.${pkgs.system}.osu-lazer-bin
|
||||
gamescope # SteamOS session compositing window manager
|
||||
prismlauncher # A free, open source launcher for Minecraft
|
||||
winetricks # A script to install DLLs needed to work around problems in Wine
|
||||
];
|
||||
}
|
||||
@@ -6,7 +6,11 @@ input {
|
||||
kb_model=
|
||||
kb_options=
|
||||
kb_rules=
|
||||
|
||||
# mouse focus will not switch to the hovered window unless the mouse crosses a window boundary
|
||||
follow_mouse=1
|
||||
mouse_refocus=false
|
||||
|
||||
natural_scroll=0
|
||||
touchpad {
|
||||
natural_scroll = 1
|
||||
|
||||
@@ -14,4 +14,17 @@
|
||||
};
|
||||
openFirewall = true;
|
||||
};
|
||||
|
||||
# Network discovery, mDNS
|
||||
# With this enabled, you can access your machine at <hostname>.local
|
||||
# it's more convenient than using the IP address.
|
||||
services.avahi = {
|
||||
enable = true;
|
||||
nssmdns4 = true;
|
||||
publish = {
|
||||
enable = true;
|
||||
domain = true;
|
||||
userServices = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
3
modules/nixos/desktop/game/default.nix
Normal file
3
modules/nixos/desktop/game/default.nix
Normal file
@@ -0,0 +1,3 @@
|
||||
{mylib, ...}: {
|
||||
imports = mylib.scanPaths ./.;
|
||||
}
|
||||
48
modules/nixos/desktop/game/gamemode.nix
Normal file
48
modules/nixos/desktop/game/gamemode.nix
Normal file
@@ -0,0 +1,48 @@
|
||||
# https://github.com/fufexan/dotfiles/blob/483680e121b73db8ed24173ac9adbcc718cbbc6e/system/programs/gamemode.nix
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
nix-gaming,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
programs = lib.makeBinPath [
|
||||
config.programs.hyprland.package
|
||||
pkgs.coreutils
|
||||
pkgs.power-profiles-daemon
|
||||
];
|
||||
|
||||
startscript = pkgs.writeShellScript "gamemode-start" ''
|
||||
export PATH=$PATH:${programs}
|
||||
export HYPRLAND_INSTANCE_SIGNATURE=$(ls -1 /tmp/hypr | tail -1)
|
||||
hyprctl --batch 'keyword decoration:blur 0 ; keyword animations:enabled 0 ; keyword misc:vfr 0'
|
||||
powerprofilesctl set performance
|
||||
'';
|
||||
|
||||
endscript = pkgs.writeShellScript "gamemode-end" ''
|
||||
export PATH=$PATH:${programs}
|
||||
export HYPRLAND_INSTANCE_SIGNATURE=$(ls -1 /tmp/hypr | tail -1)
|
||||
hyprctl --batch 'keyword decoration:blur 1 ; keyword animations:enabled 1 ; keyword misc:vfr 1'
|
||||
powerprofilesctl set power-saver
|
||||
'';
|
||||
in {
|
||||
programs.gamemode = {
|
||||
enable = true;
|
||||
settings = {
|
||||
general = {
|
||||
softrealtime = "auto";
|
||||
renice = 15;
|
||||
};
|
||||
custom = {
|
||||
start = startscript.outPath;
|
||||
end = endscript.outPath;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# see https://github.com/fufexan/nix-gaming/#pipewire-low-latency
|
||||
services.pipewire.lowLatency.enable = true;
|
||||
imports = [
|
||||
nix-gaming.nixosModules.pipewireLowLatency
|
||||
];
|
||||
}
|
||||
30
modules/nixos/desktop/game/steam.nix
Normal file
30
modules/nixos/desktop/game/steam.nix
Normal file
@@ -0,0 +1,30 @@
|
||||
# https://github.com/fufexan/dotfiles/blob/483680e/system/programs/steam.nix
|
||||
{pkgs, ...}: {
|
||||
# https://wiki.archlinux.org/title/steam
|
||||
programs.steam = {
|
||||
# steam will be installed into ~/.local/share/Steam
|
||||
# the games will be installed into ~/.local/share/Steam/steamapps/common
|
||||
enable = true;
|
||||
|
||||
# fix gamescope inside steam
|
||||
package = pkgs.steam.override {
|
||||
extraPkgs = pkgs:
|
||||
with pkgs; [
|
||||
keyutils
|
||||
libkrb5
|
||||
libpng
|
||||
libpulseaudio
|
||||
libvorbis
|
||||
stdenv.cc.cc.lib
|
||||
xorg.libXcursor
|
||||
xorg.libXi
|
||||
xorg.libXinerama
|
||||
xorg.libXScrnSaver
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
fonts.packages = with pkgs; [
|
||||
wqy_zenhei # Need by steam for Chinese
|
||||
];
|
||||
}
|
||||
@@ -12,10 +12,10 @@
|
||||
enable = true;
|
||||
# https://guix.gnu.org/en/manual/en/html_node/Invoking-guix-gc.html
|
||||
extraArgs = [
|
||||
"--delete-generations=1m"
|
||||
"--free-space=10G"
|
||||
"--optimize"
|
||||
];
|
||||
"--delete-generations=1m"
|
||||
"--free-space=10G"
|
||||
"--optimize"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
# gpg agent with pinentry
|
||||
programs.gnupg.agent = {
|
||||
enable = true;
|
||||
pinentryFlavor = "curses";
|
||||
pinentryFlavor = "curses";
|
||||
enableSSHSupport = false;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user