Further additions to flake (#4489)

* Create a mkderivation wrapper lambda.

.

.

* Removed execName

* Call new wrappers instead of duplicated mkDerivation.

* Removed finalAttrs

* Use more semi-colons

* Used clang and the build environment instead of the standard gcc.

* Replaced "git" with current nightly version.

* Automatically pass the required environment variables into the development shell instead of requiring them as part of cmake command.

* Change to an if statement because ! hurts the brain.

* Added perf to devshell package list.

* Added Nix formatter.

.

* Collision with the ++ operator in the environment variable.

* Nix Format.
This commit is contained in:
Connor Garey 2026-05-29 20:36:33 +01:00 committed by GitHub
parent 02010acd42
commit 4ce43a6a88
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 43 deletions

View File

@ -57,7 +57,7 @@ nix-shell shell.nix
#### Nix Flake Development Shell
```bash
nix develop
cmake -S . -B build/ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cmake -S . -B build/
ln -s ./build/compile_commands.json .
```

View File

@ -14,6 +14,8 @@
pkgsLinux = nixpkgs.legacyPackages.x86_64-linux;
in
{
formatter.x86_64-linux = pkgsLinux.nixpkgs-fmt;
devShells.x86_64-linux.default = pkgsLinux.mkShell.override { stdenv = pkgsLinux.clangStdenv; } {
packages = with pkgsLinux; [
clang-tools
@ -24,6 +26,7 @@
renderdoc
gef
strace
perf
openal
zlib.dev
@ -67,11 +70,14 @@
shellHook = ''
echo "Entering shadPS4 development shell!"
'';
CMAKE_C_COMPILER = "clang";
CMAKE_CXX_COMPILER = "clang++";
CMAKE_EXPORT_COMPILE_COMMANDS = "ON";
};
linux =
let
execName = "shadps4";
nativeInputs = with pkgsLinux; [
cmake
ninja
@ -114,49 +120,23 @@
libressl
];
defaultFlags = [
"-DCMAKE_INSTALL_PREFIX=$out"
];
build = { debugSymbols ? true, buildFlags }: pkgsLinux.clangStdenv.mkDerivation {
pname = "shadps4";
version = "15.1";
system = "x86_64-linux";
src = ./.;
dontStrip = if debugSymbols then true else false;
nativeBuildInputs = nativeInputs;
buildInputs = buildInputs;
cmakeFlags = buildFlags;
};
in
{
debug = pkgsLinux.stdenv.mkDerivation {
pname = "${execName}";
version = "git";
system = "x86_64-linux";
src = ./.;
dontStrip = true;
nativeBuildInputs = nativeInputs;
buildInputs = buildInputs;
cmakeFlags = [
"-DCMAKE_BUILD_TYPE=Debug"
] ++ [defaultFlags];
};
release = pkgsLinux.stdenv.mkDerivation {
pname = "${execName}";
version = "git";
system = "x86_64-linux";
src = ./.;
nativeBuildInputs = nativeInputs;
buildInputs = buildInputs;
cmakeFlags = [
"-DCMAKE_BUILD_TYPE=Release"
] ++ [defaultFlags];
};
releaseWithDebugInfo = pkgsLinux.stdenv.mkDerivation {
pname = "${execName}";
version = "git";
system = "x86_64-linux";
src = ./.;
dontStrip = true;
nativeBuildInputs = nativeInputs;
buildInputs = buildInputs;
cmakeFlags = [
"-DCMAKE_BUILD_TYPE=RelWithDebInfo"
] ++ [defaultFlags];
};
debug = build { buildFlags = [ "-DCMAKE_BUILD_TYPE=Debug" ]; };
release = build { debugSymbols = false; buildFlags = [ "-DCMAKE_BUILD_TYPE=Release" ]; };
releaseWithDebugInfo = build { buildFlags = [ "-DCMAKE_BUILD_TYPE=RelWithDebInfo" ]; };
};
};
}