Enable optimized builds for steam deck.

This commit is contained in:
Tom Alexander
2025-03-24 19:54:09 -04:00
parent 44a49d7ac7
commit 3ecb2fc790
8 changed files with 211 additions and 98 deletions

View File

@@ -54,23 +54,41 @@ in
};
nixpkgs.overlays = [
(final: prev: {
_2ship2harkinian = pkgs.buildEnv {
name = prev._2ship2harkinian.name;
paths = [
(config.lib.nixGL.wrap prev._2ship2harkinian)
];
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/2s2h.desktop
'';
};
})
(
final: prev:
let
optimizeWithFlags =
pkg: flags:
pkg.overrideAttrs (old: {
NIX_CFLAGS_COMPILE = [ (old.NIX_CFLAGS_COMPILE or "") ] ++ flags;
});
original_package =
if config.me.optimizations.enable then
(optimizeWithFlags prev._2ship2harkinian [
"-march=znver2"
"-mtune=znver2"
])
else
prev._2ship2harkinian;
in
{
_2ship2harkinian = pkgs.buildEnv {
name = prev._2ship2harkinian.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/2s2h.desktop
'';
};
}
)
];
})
]