Rename to play.nix

This commit is contained in:
Chris Toph 2025-06-30 01:05:20 -04:00
parent b9ec00c18c
commit 38beb52fe5
10 changed files with 38 additions and 38 deletions

View file

@ -1,5 +1,5 @@
{ {
description = "Wayming - Gaming setup for Wayland with configurable options and working defaults"; description = "Play - Gaming setup for Wayland with configurable options and working defaults";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
@ -27,10 +27,10 @@
overlays = [ self.overlays.default ]; overlays = [ self.overlays.default ];
}; };
# Extend lib with wayming utilities # Extend lib with play utilities
lib = nixpkgs.lib.extend ( lib = nixpkgs.lib.extend (
final: prev: { final: prev: {
wayming = import ./lib { lib = final; }; play = import ./lib { lib = final; };
} }
); );
@ -46,11 +46,11 @@
} }
) )
// { // {
homeManagerModules.wayming = import ./modules/home-manager.nix; homeManagerModules.play = import ./modules/home-manager.nix;
nixosModules.wayming = import ./modules/nixos.nix; nixosModules.play = import ./modules/nixos.nix;
# Default module (home-manager) # Default module (home-manager)
homeManagerModules.default = self.homeManagerModules.wayming; homeManagerModules.default = self.homeManagerModules.play;
# Overlay for packages # Overlay for packages
overlays.default = final: prev: { overlays.default = final: prev: {

View file

@ -26,27 +26,27 @@
getMonitorDefaults = monitors: { getMonitorDefaults = monitors: {
WIDTH = WIDTH =
let let
pm = lib.wayming.getPrimaryMonitor monitors; pm = lib.play.getPrimaryMonitor monitors;
in in
if pm != null then pm.width else 1920; if pm != null then pm.width else 1920;
HEIGHT = HEIGHT =
let let
pm = lib.wayming.getPrimaryMonitor monitors; pm = lib.play.getPrimaryMonitor monitors;
in in
if pm != null then pm.height else 1080; if pm != null then pm.height else 1080;
REFRESH_RATE = REFRESH_RATE =
let let
pm = lib.wayming.getPrimaryMonitor monitors; pm = lib.play.getPrimaryMonitor monitors;
in in
if pm != null then pm.refreshRate else 60; if pm != null then pm.refreshRate else 60;
VRR = VRR =
let let
pm = lib.wayming.getPrimaryMonitor monitors; pm = lib.play.getPrimaryMonitor monitors;
in in
if pm != null then pm.vrr else false; if pm != null then pm.vrr else false;
HDR = HDR =
let let
pm = lib.wayming.getPrimaryMonitor monitors; pm = lib.play.getPrimaryMonitor monitors;
in in
if pm != null then pm.hdr else false; if pm != null then pm.hdr else false;
}; };

View file

@ -7,13 +7,13 @@
}: }:
let let
cfg = config.wayming.gamescoperun; cfg = config.play.gamescoperun;
# Use shared lib functions # Use shared lib functions
inherit (lib.wayming) toCliArgs toEnvCommands getMonitorDefaults; inherit (lib.play) toCliArgs toEnvCommands getMonitorDefaults;
# Get monitor defaults # Get monitor defaults
monitorDefaults = getMonitorDefaults config.wayming.monitors; monitorDefaults = getMonitorDefaults config.play.monitors;
inherit (monitorDefaults) inherit (monitorDefaults)
WIDTH WIDTH
HEIGHT HEIGHT
@ -132,7 +132,7 @@ let
in in
{ {
options.wayming.gamescoperun = { options.play.gamescoperun = {
enable = lib.mkEnableOption "gamescoperun, a wrapper for gamescope"; enable = lib.mkEnableOption "gamescoperun, a wrapper for gamescope";
useGit = lib.mkOption { useGit = lib.mkOption {
@ -195,12 +195,12 @@ in
# Assertion to ensure monitors are configured if gamescoperun is enabled # Assertion to ensure monitors are configured if gamescoperun is enabled
assertions = [ assertions = [
{ {
assertion = cfg.enable -> (lib.length config.wayming.monitors > 0); assertion = cfg.enable -> (lib.length config.play.monitors > 0);
message = "wayming.gamescoperun requires at least one monitor to be configured in wayming.monitors"; message = "play.gamescoperun requires at least one monitor to be configured in play.monitors";
} }
{ {
assertion = cfg.enable -> (lib.length (lib.filter (m: m.primary) config.wayming.monitors) == 1); assertion = cfg.enable -> (lib.length (lib.filter (m: m.primary) config.play.monitors) == 1);
message = "wayming.gamescoperun requires exactly one primary monitor to be configured"; message = "play.gamescoperun requires exactly one primary monitor to be configured";
} }
]; ];
}; };

View file

@ -1,6 +1,6 @@
{ lib, config, ... }: { lib, config, ... }:
{ {
options.wayming.monitors = lib.mkOption { options.play.monitors = lib.mkOption {
type = lib.types.listOf ( type = lib.types.listOf (
lib.types.submodule { lib.types.submodule {
options = { options = {
@ -64,8 +64,8 @@
assertions = [ assertions = [
{ {
assertion = assertion =
((lib.length config.wayming.monitors) != 0) ((lib.length config.play.monitors) != 0)
-> ((lib.length (lib.filter (m: m.primary) config.wayming.monitors)) == 1); -> ((lib.length (lib.filter (m: m.primary) config.play.monitors)) == 1);
message = "Exactly one monitor must be set to primary."; message = "Exactly one monitor must be set to primary.";
} }
]; ];

View file

@ -6,10 +6,10 @@
}: }:
let let
cfg = config.wayming.wrappers; cfg = config.play.wrappers;
# Use shared lib function # Use shared lib function
inherit (lib.wayming) toCliArgs; inherit (lib.play) toCliArgs;
# Function to create a wrapper for an application # Function to create a wrapper for an application
mkWrapper = mkWrapper =
@ -36,14 +36,14 @@ let
${envExports} ${envExports}
# Execute with gamescoperun # Execute with gamescoperun
exec ${lib.getExe config.wayming.gamescoperun.package} ${extraArgs} ${lib.getExe originalPackage} $argv exec ${lib.getExe config.play.gamescoperun.package} ${extraArgs} ${lib.getExe originalPackage} $argv
''; '';
in in
wrapperScript; wrapperScript;
in in
{ {
options.wayming.wrappers = lib.mkOption { options.play.wrappers = lib.mkOption {
type = lib.types.attrsOf ( type = lib.types.attrsOf (
lib.types.submodule ( lib.types.submodule (
{ name, ... }: { name, ... }:
@ -96,7 +96,7 @@ in
wrappedPackage = lib.mkOption { wrappedPackage = lib.mkOption {
type = lib.types.package; type = lib.types.package;
readOnly = true; readOnly = true;
default = mkWrapper name config.wayming.wrappers.${name}; default = mkWrapper name config.play.wrappers.${name};
description = "The configured wrapper package for this application"; description = "The configured wrapper package for this application";
}; };
}; };
@ -113,6 +113,6 @@ in
); );
# Ensure gamescoperun is enabled if any wrappers are enabled # Ensure gamescoperun is enabled if any wrappers are enabled
wayming.gamescoperun.enable = lib.mkIf (lib.length (lib.attrNames cfg) > 0) true; play.gamescoperun.enable = lib.mkIf (lib.length (lib.attrNames cfg) > 0) true;
}; };
} }

View file

@ -6,10 +6,10 @@
}: }:
let let
cfg = config.wayming.amd; cfg = config.play.amd;
in in
{ {
options.wayming.amd = { options.play.amd = {
enable = lib.mkEnableOption "AMD GPU configuration with LACT (Linux AMD Control Tool)"; enable = lib.mkEnableOption "AMD GPU configuration with LACT (Linux AMD Control Tool)";
}; };

View file

@ -6,7 +6,7 @@
}: }:
let let
cfg = config.wayming.ananicy; cfg = config.play.ananicy;
# Default extra rules for gaming processes # Default extra rules for gaming processes
defaultExtraRules = [ defaultExtraRules = [
@ -20,7 +20,7 @@ let
finalExtraRules = defaultExtraRules ++ cfg.extraRules; finalExtraRules = defaultExtraRules ++ cfg.extraRules;
in in
{ {
options.wayming.ananicy = { options.play.ananicy = {
enable = lib.mkEnableOption "ananicy process scheduler optimization"; enable = lib.mkEnableOption "ananicy process scheduler optimization";
extraRules = lib.mkOption { extraRules = lib.mkOption {

View file

@ -6,10 +6,10 @@
}: }:
let let
cfg = config.wayming.gamemode; cfg = config.play.gamemode;
in in
{ {
options.wayming.gamemode = { options.play.gamemode = {
enable = lib.mkEnableOption "gamemode configuration for gaming optimization"; enable = lib.mkEnableOption "gamemode configuration for gaming optimization";
settings = lib.mkOption { settings = lib.mkOption {

View file

@ -6,7 +6,7 @@
}: }:
let let
cfg = config.wayming.lutris; cfg = config.play.lutris;
# Default extra packages # Default extra packages
defaultExtraPkgs = with pkgs; [ defaultExtraPkgs = with pkgs; [
@ -22,7 +22,7 @@ let
}; };
in in
{ {
options.wayming.lutris = { options.play.lutris = {
enable = lib.mkEnableOption "Install Lutris game manager"; enable = lib.mkEnableOption "Install Lutris game manager";
extraPkgs = lib.mkOption { extraPkgs = lib.mkOption {

View file

@ -6,7 +6,7 @@
}: }:
let let
cfg = config.wayming.steam; cfg = config.play.steam;
# Default compatibility packages # Default compatibility packages
defaultCompatPackages = with pkgs; [ defaultCompatPackages = with pkgs; [
@ -23,7 +23,7 @@ let
}; };
in in
{ {
options.wayming.steam = { options.play.steam = {
enable = lib.mkEnableOption "Steam with gaming optimizations"; enable = lib.mkEnableOption "Steam with gaming optimizations";
extraCompatPackages = lib.mkOption { extraCompatPackages = lib.mkOption {