Tom Alexander 345c62a477
Add wrappers for 2ship2harkinian and sm64ex also.
Set the steam launcher to run /home/deck/.nix-profile/bin/steam_<GAME> to have it work inside steam gaming mode.
2025-02-15 20:50:34 -05:00

92 lines
2.4 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
steam_sm64ex = pkgs.writeScriptBin "steam_sm64ex" ''
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.libglvnd}/lib"
exec ${pkgs.sm64ex}/bin/sm64ex
'';
in
{
imports = [ ];
options.me = {
sm64ex.enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether we want to install sm64ex.";
};
};
config = lib.mkIf config.me.sm64ex.enable (
lib.mkMerge [
(lib.mkIf config.me.graphical {
allowedUnfree = [ "sm64ex" ];
home.packages = with pkgs; [
sm64ex
steam_sm64ex
];
# nixpkgs.overlays = [
# (final: prev: {
# sm4ex = prev.sm64ex.override {
# baseRom.name = "SuperMario64.z64";
# };
# })
# ];
home.file.".local/share/sm64ex/sm64config.txt" = {
source = ./files/sm64config.txt;
};
home.persistence."/home/deck/.persist" = {
files = [
".local/share/sm64ex/sm64_save_file.bin"
];
};
nixpkgs.overlays = [
(final: prev: {
sm64ex =
let
desktop_item = pkgs.makeDesktopItem {
name = "sm64ex";
desktopName = "Super Mario 64";
comment = "A PC Port of Super Mario 64.";
categories = [
"Game"
];
icon = "sm64ex";
type = "Application";
exec = "sm64ex";
};
in
pkgs.buildEnv {
name = prev.sm64ex.name;
paths = [
(config.lib.nixGL.wrap prev.sm64ex)
];
extraOutputsToInstall = [
"man"
"doc"
"info"
];
# We have to use 555 instead of the normal 444 here because the .desktop file ends up inside $HOME on steam deck and desktop files must be either not in $HOME or must be executable, otherwise KDE Plasma refuses to execute them.
postBuild = ''
install -m 555 -D "${desktop_item}/share/applications/"* -t $out/share/applications/
install -m 444 -D "${./files/icon.png}" $out/share/pixmaps/sm64ex.png
'';
};
})
];
})
]
);
}