Skip to content

Commit 2610939

Browse files
slippi-launcher: add config options
1 parent a709d10 commit 2610939

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

flake.nix

+73
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,78 @@
9898
environment.systemPackages = [ (mkIf cfg.keyb0xx.enable (pkgs.keyb0xx.override { keyb0xxconfig = cfg.keyb0xx.config; })) ];
9999
};
100100
};
101+
homeManagerModule = { pkgs, config, ... }:
102+
let
103+
cfg = config.ssbm;
104+
in
105+
with nixpkgs.lib; {
106+
options.ssbm = {
107+
slippi-launcher = {
108+
enable = mkEnableOption "Install Slippi Launcher";
109+
# Game settings
110+
isoPath = mkOption {
111+
default = "";
112+
type = types.str;
113+
description = "The path to an NTSC Melee ISO.";
114+
};
115+
launchMeleeOnPlay = mkEnableOption "Launch Melee in Dolphin when the Play button is pressed." // { default = true; };
116+
enableJukebox = mkEnableOption "Enable in-game music via Slippi Jukebox. Incompatible with WASAPI." // { default = true; };
117+
# Replay settings
118+
rootSlpPath = mkOption {
119+
default = "${config.home.homeDirectory}/Slippi";
120+
type = types.str;
121+
description = "The folder where your SLP replays should be saved.";
122+
};
123+
useMonthlySubfolders = mkEnableOption "Save replays to monthly subfolders";
124+
spectateSlpPath = mkOption {
125+
default = "${cfg.slippi-launcher.rootSlpPath}/Spectate";
126+
type = types.nullOr types.str;
127+
description = "The folder where spectated games should be saved.";
128+
};
129+
extraSlpPaths = mkOption {
130+
default = [ ];
131+
type = types.listOf types.str;
132+
description = "Choose any additional SLP directories that should show up in the replay browser.";
133+
};
134+
# Netplay
135+
netplayDolphinPath = mkOption {
136+
default = "${pkgs.slippi-netplay}";
137+
type = types.str;
138+
description = "The path to the folder containing the Netplay Dolphin Executable";
139+
};
140+
# Playback
141+
playbackDolphinPath = mkOption {
142+
default = "${pkgs.slippi-playback}";
143+
type = types.str;
144+
description = "The path to the folder containing the Playback Dolphin Executable";
145+
};
146+
};
147+
};
148+
config = {
149+
home.packages = [ (mkIf cfg.slippi-launcher.enable pkgs.slippi-launcher) ];
150+
xdg.configFile."Slippi Launcher/Settings".source =
151+
let
152+
jsonFormat = pkgs.formats.json { };
153+
in
154+
jsonFormat.generate "slippi-config" {
155+
settings = {
156+
isoPath = cfg.slippi-launcher.isoPath;
157+
launchMeleeOnPlay = cfg.slippi-launcher.launchMeleeOnPlay;
158+
enableJukebox = cfg.slippi-launcher.enableJukebox;
159+
# Replay settings
160+
rootSlpPath = cfg.slippi-launcher.rootSlpPath;
161+
useMonthlySubfolders = cfg.slippi-launcher.useMonthlySubfolders;
162+
spectateSlpPath = cfg.slippi-launcher.spectateSlpPath;
163+
extraSlpPaths = cfg.slippi-launcher.extraSlpPaths;
164+
# Netplay
165+
netplayDolphinPath = cfg.slippi-launcher.netplayDolphinPath;
166+
# Playback
167+
playbackDolphinPath = cfg.slippi-launcher.playbackDolphinPath;
168+
# Advanced settings
169+
autoUpdateLauncher = false;
170+
};
171+
};
172+
};
173+
};
101174
};
102175
}

slippi-launcher/default.nix

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
, fetchurl
44
, makeDesktopItem
55
, copyDesktopItems
6+
, makeWrapper
67
}:
78

89
stdenvNoCC.mkDerivation rec {
@@ -16,6 +17,7 @@ stdenvNoCC.mkDerivation rec {
1617
url = "https://github.com/project-slippi/slippi-launcher/releases/download/v${version}/Slippi-Launcher-${version}-x86_64.AppImage";
1718
hash = "sha256-zYxSVbxERLtz5/9IS8PUft6ZQw6kQtSUp0/KmmA/bmM=";
1819
};
20+
1921
extraInstallCommands = ''
2022
source "${makeWrapper}/nix-support/setup-hook"
2123
wrapProgram $out/bin/slippi-launcher-${version} \

0 commit comments

Comments
 (0)