project-plus: home-manager module init

This commit is contained in:
ooks-io 2025-01-11 20:18:38 +11:00
parent 1898815955
commit f59c08deb5
4 changed files with 144 additions and 0 deletions

View file

@ -11,6 +11,7 @@ in {
./wine.nix
./bottles.nix
./emulation.nix
./project-plus
];
config = mkIf (elem "gaming" profiles) {
ooknet.binds = {

View file

@ -2,6 +2,7 @@
lib,
osConfig,
pkgs,
self',
...
}: let
inherit (lib) mkIf elem;
@ -14,6 +15,14 @@ in {
(pkgs)
ryujinx
;
inherit
(self'.packages)
wii-u-gc-adapter
;
};
ooknet.gaming.project-plus = {
enable = true;
netplay.nickname = "ooks";
};
};
}

View file

@ -0,0 +1,5 @@
{
imports = [
./options.nix
];
}

View file

@ -0,0 +1,129 @@
{
lib,
self',
config,
...
}: let
inherit (lib) mkOption mkEnableOption mkIf;
inherit (lib.types) package str path attrsOf anything bool int;
cfg = config.ooknet.gaming.project-plus;
in {
options.ooknet.gaming.project-plus = {
enable = mkEnableOption "Enable Project Plus";
package = mkOption {
type = package;
default = self'.packages.project-plus.override {
inherit (cfg) userDir;
};
};
userDir = mkOption {
type = str;
default = "${config.xdg.configHome}/project-plus";
description = ''
Location of the Dolphin User directory, this is the path that the wrapped package
will use for User configuration. defaults to "\$\{config.xdg.configHome}/project-plus"
'';
};
launcherSource = mkOption {
type = path;
default = "${self'.packages.fpp-launcher}/Launcher";
description = ''
Location of the faster-project-plus launcher files.
'';
};
sdCardSource = mkOption {
type = path;
default = "${self'.packages.fpp-sd}/sd.raw";
description = ''
Location of the faster-project-plus sd card
'';
};
userSource = mkOption {
type = path;
default = "${self'.packages.fpp-config}/Binaries/User";
};
netplay = {
nickname = mkOption {
type = str;
default = "Player";
description = "Netplay nickname displayed to other players";
};
disableMusic = mkOption {
type = bool;
default = true;
description = "Whether to disable music during netplay";
};
buffer = mkOption {
type = int;
default = 4;
description = "Default netplay buffer";
};
};
gamesDir = mkOption {
type = str;
default = "./Games";
description = ''
Location of the directory that stores all game isos, this is where you should store
your brawl iso. Defaults to "./Brawl" (The . is relative to the User dolphin directory)
'';
};
extraSettings = mkOption {
type = attrsOf anything;
default = {};
description = ''
Additional settings for Dolphin.ini
'';
};
};
config = mkIf cfg.enable {
home.packages = [cfg.package];
xdg.configFile = {
"project-plus/Config/Dolphin.ini" = {
text = lib.generators.toINI {} {
# default settings to ensure project-plus works OOTB.
General = {
IsoPaths = 2;
IsoPath0 = "${cfg.userDir}/Games";
IsoPath1 = "${cfg.userDir}/Launcher";
WiiSDCardPath = "${cfg.userDir}/Wii/sd.raw";
};
Core = {
DefaultISO = "${cfg.userDir}/Games/brawl.iso";
};
Netplay =
{
SelectedHostGame = "Project+ Netplay Launcher.dol";
BufferSize = cfg.netplay.buffer;
Nickname = cfg.netplay.nickname;
MusicOff = cfg.netplay.disableMusic;
ListenPort = "0x0a42";
HostPort = "0x0a42";
ConnectPort = "0x0a42";
HostCode = 00000000;
TraversalChoice = "traversal";
}
// cfg.extraSettings;
};
};
# Copy dolphin GameSettings configuration from faster-project-plus config
# This includes various Gecko Code files to make for a better Netplay experience
"project-plus/GameSettings" = {
source = "${cfg.userSource}/GameSettings";
recursive = true;
};
"project-plus/Launcher" = {
source = "${cfg.launcherSource}";
recursive = true;
};
# Cant get this to work, does the sd card need to be writable for dolphin to use it?
# for now sd card will need to be manually placed in the SD directory
# "project-plus/Wii/sd.raw" = {
# source = cfg.sdCardSource;
# };
};
};
}