prismlauncher: add module
This commit is contained in:
parent
6f64dee491
commit
04e5203db6
4 changed files with 192 additions and 0 deletions
3
tests/modules/programs/prismlauncher/default.nix
Normal file
3
tests/modules/programs/prismlauncher/default.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
prismlauncher-settings = ./settings.nix;
|
||||
}
|
||||
65
tests/modules/programs/prismlauncher/settings.nix
Normal file
65
tests/modules/programs/prismlauncher/settings.nix
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
configPath = ".local/share/PrismLauncher/prismlauncher.cfg";
|
||||
|
||||
preexistingConfig = pkgs.writeText "preexisting.cfg" ''
|
||||
[General]
|
||||
ApplicationTheme=system
|
||||
MaxMemAlloc=8192
|
||||
MinMemAlloc=512
|
||||
'';
|
||||
|
||||
expectedConfig = pkgs.writeText "expected.cfg" ''
|
||||
[General]
|
||||
ApplicationTheme=dark
|
||||
MaxMemAlloc=8192
|
||||
MinMemAlloc=512
|
||||
ConsoleMaxLines=100000
|
||||
ShowConsole=true
|
||||
'';
|
||||
|
||||
activationScript = pkgs.writeScript "activation" config.home.activation.prismlauncherConfigActivation.data;
|
||||
in
|
||||
|
||||
{
|
||||
programs.prismlauncher = {
|
||||
enable = true;
|
||||
package = config.lib.test.mkStubPackage { };
|
||||
|
||||
settings = {
|
||||
ApplicationTheme = "dark";
|
||||
ShowConsole = true;
|
||||
ConsoleMaxLines = 100000;
|
||||
};
|
||||
};
|
||||
|
||||
home.homeDirectory = lib.mkForce "/@TMPDIR@/hm-user";
|
||||
|
||||
nmt.script = ''
|
||||
export HOME=$TMPDIR/hm-user
|
||||
|
||||
# write preexisting config
|
||||
mkdir -p $HOME/.local/share/PrismLauncher
|
||||
cat ${preexistingConfig} > $HOME/${configPath}
|
||||
|
||||
# run the activation script
|
||||
substitute ${activationScript} $TMPDIR/activate --subst-var TMPDIR
|
||||
chmod +x $TMPDIR/activate
|
||||
$TMPDIR/activate
|
||||
|
||||
# validate the merged config
|
||||
assertFileExists "$HOME/${configPath}"
|
||||
assertFileContent "$HOME/${configPath}" "${expectedConfig}"
|
||||
|
||||
# test idempotence
|
||||
$TMPDIR/activate
|
||||
assertFileExists "$HOME/${configPath}"
|
||||
assertFileContent "$HOME/${configPath}" "${expectedConfig}"
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue