2025-03-29 20:45:36 -04:00
{
config ,
lib ,
pkgs ,
. . .
} :
let
steam_ares = pkgs . writeScriptBin " s t e a m _ a r e s " ''
export LD_LIBRARY_PATH = " $ L D _ L I B R A R Y _ P A T H : ${ pkgs . libglvnd } / l i b "
exec $ { pkgs . ares } /bin/ares " ' ' ${ @ } "
'' ;
in
{
imports = [ ] ;
options . me = {
ares . 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 a r e s . " ;
} ;
} ;
config = lib . mkIf config . me . ares . enable (
lib . mkMerge [
( lib . mkIf config . me . graphical {
nixGL . vulkan . enable = true ;
home . packages = with pkgs ; [
ares
steam_ares
] ;
2025-03-30 17:26:05 -04:00
me . persist . directories = [
" . l o c a l / s h a r e / a r e s / s a v e s "
" . l o c a l / s h a r e / a r e s / s c r e e n s h o t s "
] ;
2025-03-29 20:45:36 -04:00
home . file . " . l o c a l / s h a r e / a r e s / s e t t i n g s . b m l " = {
source = ./files/settings.bml ;
} ;
nixpkgs . overlays = [
(
final : prev :
let
optimizeWithFlags =
pkg : flags :
pkg . overrideAttrs ( old : {
env . NIX_CFLAGS_COMPILE =
( old . env . NIX_CFLAGS_COMPILE or " " ) + ( lib . strings . concatStringsSep " " flags ) ;
} ) ;
original_package =
if config . me . optimizations . enable then
( optimizeWithFlags prev . ares [
2025-03-30 15:57:01 -04:00
# Verified working with ps
2025-03-29 20:45:36 -04:00
" - m a r c h = z n v e r 2 "
" - m t u n e = z n v e r 2 "
] )
else
prev . ares ;
in
{
ares = pkgs . buildEnv {
name = prev . ares . name ;
paths = [
( config . lib . nixGL . wrap original_package )
] ;
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 = ''
chmod 0555 $ out/share/applications/ares.desktop
'' ;
} ;
}
)
] ;
} )
]
) ;
}