97 lines
2.6 KiB
Nix
Raw Normal View History

2025-03-29 20:45:36 -04:00
# MANUAL: mkdir -p ~/.persist/.local/share/ares/saves ~/.persist/.local/share/ares/screenshots
{
config,
lib,
pkgs,
...
}:
let
steam_ares = pkgs.writeScriptBin "steam_ares" ''
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.libglvnd}/lib"
exec ${pkgs.ares}/bin/ares "''${@}"
'';
in
{
imports = [ ];
options.me = {
ares.enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether we want to install ares.";
};
};
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
];
home.persistence."/home/deck/.persist" = {
directories = [
{
directory = ".local/share/ares/saves";
method = "symlink";
}
{
directory = ".local/share/ares/screenshots";
method = "symlink";
}
];
};
home.file.".local/share/ares/settings.bml" = {
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
"-march=znver2"
"-mtune=znver2"
])
else
prev.ares;
in
{
ares = pkgs.buildEnv {
name = prev.ares.name;
paths = [
(config.lib.nixGL.wrap original_package)
];
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 = ''
chmod 0555 $out/share/applications/ares.desktop
'';
};
}
)
];
})
]
);
}