2025-02-13 20:54:51 -05:00
{
config ,
lib ,
pkgs ,
. . .
} :
{
imports = [ ] ;
options . me = {
sm64ex . enable = lib . mkOption {
type = lib . types . bool ;
default = false ;
example = true ;
description = " W h e t h e r w e w a n t t o i n s t a l l s m 6 4 e x . " ;
} ;
} ;
config = lib . mkIf config . me . sm64ex . enable (
lib . mkMerge [
( lib . mkIf config . me . graphical {
allowedUnfree = [ " s m 6 4 e x " ] ;
home . packages = with pkgs ; [
2025-02-15 19:31:16 -05:00
sm64ex
2025-02-13 20:54:51 -05:00
] ;
# nixpkgs.overlays = [
# (final: prev: {
# sm4ex = prev.sm64ex.override {
# baseRom.name = "SuperMario64.z64";
# };
# })
# ];
2025-02-15 10:57:18 -05:00
home . file . " . l o c a l / s h a r e / s m 6 4 e x / s m 6 4 c o n f i g . t x t " = {
source = ./files/sm64config.txt ;
} ;
2025-02-13 20:54:51 -05:00
home . persistence . " / h o m e / d e c k / . p e r s i s t " = {
2025-02-15 10:57:18 -05:00
files = [
" . l o c a l / s h a r e / s m 6 4 e x / s m 6 4 _ s a v e _ f i l e . b i n "
2025-02-13 20:54:51 -05:00
] ;
} ;
2025-02-15 19:31:16 -05:00
nixpkgs . overlays = [
( final : prev : {
sm64ex =
let
desktop_item = pkgs . makeDesktopItem {
name = " s m 6 4 e x " ;
desktopName = " S u p e r M a r i o 6 4 " ;
comment = " A P C P o r t o f S u p e r M a r i o 6 4 . " ;
categories = [
" G a m e "
] ;
icon = " s m 6 4 e x " ;
type = " A p p l i c a t i o n " ;
exec = " s m 6 4 e x " ;
} ;
in
pkgs . buildEnv {
name = prev . sm64ex . name ;
paths = [
( config . lib . nixGL . wrap prev . sm64ex )
] ;
extraOutputsToInstall = [
" m a n "
" d o c "
" i n f o "
] ;
# 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 } / s h a r e / a p p l i c a t i o n s / " * - t $ out/share/applications /
install - m 444 - D " ${ ./files/icon.png } " $ out/share/pixmaps/sm64ex.png
'' ;
} ;
} )
] ;
2025-02-13 20:54:51 -05:00
} )
]
) ;
}