create single function to optimize for system

This commit is contained in:
Simon Gardling 2025-04-07 14:33:34 -04:00
parent b764d2de45
commit 3653e06c7d
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D
2 changed files with 14 additions and 10 deletions

View File

@ -135,7 +135,7 @@
{
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style;
nixosConfigurations.${hostname} = nixpkgs.lib.nixosSystem {
specialArgs = {
specialArgs = rec {
inherit
username
hostname
@ -160,6 +160,14 @@
# stdenv = pkgs.clang19Stdenv;
}
);
optimizePackage =
pkg:
optimizeWithFlags pkg [
"-O3"
"-march=znver2"
"-mtune=znver2"
];
};
modules =
[

View File

@ -3,7 +3,7 @@
service_configs,
config,
inputs,
optimizeWithFlags,
optimizePackage,
...
}:
{
@ -22,17 +22,13 @@
port = service_configs.ports.llama_cpp;
host = "0.0.0.0";
package = (
optimizeWithFlags
(inputs.llamacpp.packages.${pkgs.system}.default.overrideAttrs (old: {
optimizePackage (
inputs.llamacpp.packages.${pkgs.system}.default.overrideAttrs (old: {
cmakeFlags = old.cmakeFlags ++ [
"-DGGML_AVX2=ON"
];
}))
[
"-O3"
"-march=znver2"
"-mtune=znver2"
]
})
)
);
extraFlags = [
"--flash-attn"