Enable optimized builds for steam deck.
This commit is contained in:
parent
44a49d7ac7
commit
3ecb2fc790
nix/steam_deck/configuration
@ -8,6 +8,7 @@
|
||||
{
|
||||
imports = [
|
||||
./roles/2ship2harkinian
|
||||
./roles/global_options
|
||||
./roles/graphics
|
||||
./roles/pcsx2
|
||||
./roles/rpcs3
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
config = {
|
||||
me.graphical = true;
|
||||
me.optimizations.enable = true;
|
||||
me.pcsx2.enable = true;
|
||||
me.rpcs3.enable = true;
|
||||
me.ship2harkinian.enable = true;
|
||||
|
@ -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
|
||||
'';
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
})
|
||||
]
|
||||
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
options.me = {
|
||||
optimizations.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = "Whether we want to enable CPU optimizations (will trigger a rebuild from source).";
|
||||
};
|
||||
};
|
||||
}
|
@ -70,23 +70,41 @@ in
|
||||
};
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
pcsx2 = pkgs.buildEnv {
|
||||
name = prev.pcsx2.name;
|
||||
paths = [
|
||||
(config.lib.nixGL.wrap prev.pcsx2)
|
||||
];
|
||||
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/PCSX2.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.pcsx2 [
|
||||
"-march=znver2"
|
||||
"-mtune=znver2"
|
||||
])
|
||||
else
|
||||
prev.pcsx2;
|
||||
in
|
||||
{
|
||||
pcsx2 = pkgs.buildEnv {
|
||||
name = prev.pcsx2.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/PCSX2.desktop
|
||||
'';
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
})
|
||||
]
|
||||
|
@ -70,23 +70,41 @@ in
|
||||
};
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
rpcs3 = pkgs.buildEnv {
|
||||
name = prev.rpcs3.name;
|
||||
paths = [
|
||||
(config.lib.nixGL.wrap prev.rpcs3)
|
||||
];
|
||||
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/PCSX2.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.rpcs3 [
|
||||
"-march=znver2"
|
||||
"-mtune=znver2"
|
||||
])
|
||||
else
|
||||
prev.rpcs3;
|
||||
in
|
||||
{
|
||||
rpcs3 = pkgs.buildEnv {
|
||||
name = prev.rpcs3.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/rpcs3.desktop
|
||||
'';
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
})
|
||||
]
|
||||
|
@ -54,23 +54,43 @@ in
|
||||
};
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
shipwright = pkgs.buildEnv {
|
||||
name = prev.shipwright.name;
|
||||
paths = [
|
||||
(config.lib.nixGL.wrap prev.shipwright)
|
||||
];
|
||||
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/soh.desktop
|
||||
'';
|
||||
};
|
||||
})
|
||||
(
|
||||
final: prev:
|
||||
let
|
||||
optimizeWithFlags =
|
||||
pkg: flags:
|
||||
pkg.overrideAttrs (old: {
|
||||
NIX_CFLAGS_COMPILE = [ (old.NIX_CFLAGS_COMPILE or "") ] ++ flags;
|
||||
});
|
||||
original_package = prev.shipwright;
|
||||
# Optimization is broken for shipwright, fails to build "The following attributes are overlapping"
|
||||
# original_package =
|
||||
# if !config.me.optimizations.enable then
|
||||
# (optimizeWithFlags prev.shipwright [
|
||||
# "-march=znver2"
|
||||
# "-mtune=znver2"
|
||||
# ])
|
||||
# else
|
||||
# prev.shipwright;
|
||||
in
|
||||
{
|
||||
shipwright = pkgs.buildEnv {
|
||||
name = prev.shipwright.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/soh.desktop
|
||||
'';
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
})
|
||||
]
|
||||
|
@ -52,38 +52,56 @@ in
|
||||
};
|
||||
|
||||
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"
|
||||
(
|
||||
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.sm64ex [
|
||||
"-march=znver2"
|
||||
"-mtune=znver2"
|
||||
])
|
||||
else
|
||||
prev.sm64ex;
|
||||
in
|
||||
{
|
||||
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 original_package)
|
||||
];
|
||||
icon = "sm64ex";
|
||||
type = "Application";
|
||||
exec = "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
|
||||
'';
|
||||
};
|
||||
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
|
||||
'';
|
||||
};
|
||||
})
|
||||
}
|
||||
)
|
||||
];
|
||||
})
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user