shadPS4/flake.nix
Connor Garey 969955b8a0
Addition of Nix flake development shell (#4184)
* Initial devshell creation.

* cmake has a check for clang and therefore override the stdenv.

* Packages from old shell were renamed.

* fixed xcb-util, added libglvnd

* Added sdl3 dependencies provided by the website given on cmake configuration.

* Lock file.

* Nix format.

* Added instructions for entering nix development shell.

.

* Added libuuid

* Added copyright text to flake.nix

* Added flake.lock to REUSE.toml as is a JSON file without comment support.

* Updated instructions to refer to new build name.

* Compiling however not yet correctly linking with debug derivation.

* Hitting installPhase

* Added nix result symlink.

* correctly installs in place

* Added a wrapper to load vulkan and ligl into environment.

* Ensure that the name is applicable to the current project.

.

* Added mesa to LD_LIBRARY_PATH

* game now launching with added X11 libraries.

* Cleanup

Formatting.

Pulled cmakeFlags to top and added releaseWithDebugInfo

Removed LD_LIBRARY_PATH from devshell.

.

* Added options for the different Nix build modes.

* Debug / release mode flag cannot be bundled into one.
2026-03-30 23:35:57 +03:00

161 lines
3.7 KiB
Nix

## SPDX-FileCopyrightText: Copyright 2026 shadPS4 Emulator Project
## SPDX-License-Identifier: GPL-2.0-or-later
{
description = "shadPS4 Nix Flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
outputs =
{ self, nixpkgs }:
let
pkgsLinux = nixpkgs.legacyPackages.x86_64-linux;
in
{
devShells.x86_64-linux.default = pkgsLinux.mkShell.override { stdenv = pkgsLinux.clangStdenv; } {
packages = with pkgsLinux; [
clang-tools
cmake
pkg-config
vulkan-tools
renderdoc
gef
strace
openal
zlib.dev
libedit.dev
vulkan-headers
vulkan-utility-libraries
ffmpeg.dev
fmt.dev
glslang.dev
wayland.dev
stb
libpng.dev
libuuid
sdl3.dev
alsa-lib
hidapi
ibus.dev
jack2.dev
libdecor.dev
libthai.dev
fribidi.dev
libxcb.dev
libGL.dev
libpulseaudio.dev
libusb1.dev
libx11.dev
libxcursor.dev
libxext
libxfixes.dev
libxi.dev
libxinerama.dev
libxkbcommon
libxrandr.dev
libxrender.dev
libxtst
pipewire.dev
libxscrnsaver
sndio
];
shellHook = ''
echo "Entering shadPS4 development shell!"
'';
};
linux =
let
execName = "shadps4";
nativeInputs = with pkgsLinux; [
cmake
ninja
pkg-config
magic-enum
fmt
eudev
];
buildInputs = with pkgsLinux; [
boost
cli11
openal
nlohmann_json
vulkan-loader
vulkan-headers
vulkan-memory-allocator
toml11
zlib
zydis
pugixml
ffmpeg
libpulseaudio
pipewire
vulkan-loader
wayland
wayland-scanner
libX11
libxrandr
libxext
libxcursor
libxi
libxscrnsaver
libxtst
libxcb
libdecor
libxkbcommon
libGL
libuuid
];
defaultFlags = [
"-DCMAKE_INSTALL_PREFIX=$out"
];
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=Release"
] ++ [defaultFlags];
};
};
};
}