summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix141
1 files changed, 87 insertions, 54 deletions
diff --git a/flake.nix b/flake.nix
index 05c8f88..ef010bc 100644
--- a/flake.nix
+++ b/flake.nix
@@ -42,6 +42,11 @@
./env/nixpkgs-patches/libavcodec_mdec.c.patch
];
});
+ notcurses = super.notcurses.overrideAttrs (oldAttrs: {
+ patches = [
+ ./subprojects/packagefiles/notcurses/duration_and_ffmpeg_fix.diff
+ ];
+ });
})
nixgl.overlays.default
];
@@ -64,9 +69,7 @@
function (import (nixpkgs.legacyPackages.${system}.applyPatches {
src = nixpkgs;
name = "nixpkgs-camu";
- patches = [
- ./env/nixpkgs-patches/289217.diff
- ];
+ patches = [ ];
}) {
inherit system;
inherit overlays;
@@ -82,7 +85,7 @@
);
in rec {
packages = forAllSupportedSystems (pkgs: {
- default = with pkgs; stdenv.mkDerivation {
+ default = with pkgs; stdenv.mkDerivation rec {
name = "camu";
version = "0.01";
src = fetchgit {
@@ -93,7 +96,7 @@
cd "$out"
${lib.getExe meson} subprojects download \
- libalabaster libnaunet stela miniaudio linmath.h notcurses stb
+ libalabaster libnaunet stela miniaudio linmath.h
cd "$out/subprojects/libalabaster-b5b7657"
${lib.getExe meson} subprojects download c89atomic
@@ -105,14 +108,25 @@
find subprojects -type d -name .git -prune -execdir rm -r {} +
'';
- sha256 = "KMenKl0wB14P/0wD0IPOMNnMQP3h2yy0zn8NBYDwngc=";
+ sha256 = "HefIlrpfaWYucuYof49yG9Jheucx87H/qGGUnOmGrB0=";
};
+ nvidia-support = false;
+ sources = [ "file" "http" "cdio" ];
+ codecs = [ "ffmpeg" ];
+ window = "wayland";
+ renderer-api = "vulkan";
mesonFlags = [
+ "-Dsources=${lib.join "," sources}"
+ "-Dcodecs=${lib.join "," codecs}"
+ "-Drenderer-api=${renderer-api}"
+ "-Dwindow=${window}"
"-Dtests=disabled"
"-Drelease-asserts=false"
];
- fixupPhase = ''
- wrapProgram $out/bin/cmv --set XDG_DATA_DIRS "${pkgs.mesa}/share:${pkgs.linuxPackages.nvidia_x11}/share"
+ fixupPhase = if nvidia-support then ''
+ wrapProgram $out/bin/cmv --set XDG_DATA_DIRS "${pkgs.mesa}/share:${pkgs.linuxPackages.nvidia_x11}/share" --set __EGL_VENDOR_LIBRARY_DIRS "${pkgs.mesa}/share/glvnd/egl_vendor.d:${pkgs.linuxPackages.nvidia_x11}/share/glvnd/egl_vendor.d"
+ '' else ''
+ wrapProgram $out/bin/cmv --set XDG_DATA_DIRS "${pkgs.mesa}/share" --set __EGL_VENDOR_LIBRARY_DIRS "${pkgs.mesa}/share/glvnd/egl_vendor.d"
'';
nativeBuildInputs = [
git
@@ -127,66 +141,69 @@
ninja
meson
cmake
- wayland-scanner.bin
((python3.override { enableOptimizations = true; }).withPackages (python-pkgs: [
python-pkgs.setuptools
python-pkgs.pip
python-pkgs.cython
]))
- ffmpeg-headless # native input for ffprobe
makeWrapper
- ] ++ lib.optionals (stdenv.hostPlatform.system == "x86_64-linux") [
- # Blu-ray
- jdk8
- ant
+ ] ++ lib.optionals (window == "wayland") [
+ wayland-scanner.bin
+ ] ++ lib.optionals (lib.elem "ffmpeg" codecs) [
+ ffmpeg-headless # Native input for ffprobe.
+ ] ++ lib.optionals (lib.elem "libdvd" codecs) [
+ jdk8 # Blu-ray
];
buildInputs = [
(curl.override { websocketSupport = true; })
jansson
libblake3
- libspng
- soxr
- libcdio
- libcdio-paranoia
- libcue
- libdvdcss
- libdvdread
- libdvdnav
libass
alsa-lib
- pipewire
libpulseaudio
- libva
- dav1d
libplacebo
xxHash
lcms
libdovi
- shaderc
- glslang.dev
- libGL
- vulkan-loader
- vulkan-headers
- vulkan-validation-layers
+ notcurses
+ ] ++ lib.optionals (window == "wayland") [
wayland
wayland-protocols
wlr-protocols
egl-wayland
+ ] ++ lib.optionals (window == "x11") [
xorg.libX11
xorg.libXext
xorg.libXrandr
xorg.libXfixes
xorg.libXcursor
libxkbcommon
+ ] ++ lib.optionals (window == "x11") [
glfw3
- # glfw3 build
- xorg.xinput
- xorg.libXinerama
- # notcurses build
- libunistring
- ncurses
- # discord
- libsodium
+ ] ++ lib.optionals (renderer-api == "vulkan") [
+ vulkan-loader
+ vulkan-headers
+ vulkan-validation-layers
+ shaderc
+ ] ++ lib.optionals (renderer-api == "gl") [
+ libGL
+ ] ++ lib.optionals (lib.elem "ffmpeg" codecs) [
+ soxr
+ dav1d
+ ] ++ lib.optionals (lib.elem "stb_image" codecs) [
+ stb
+ ] ++ lib.optionals (lib.elem "wuffs" codecs) [
+ wuffs
+ ] ++ lib.optionals (lib.elem "spng" codecs) [
+ libspng
+ ] ++ lib.optionals (lib.elem "cdio" sources) [
+ libcdio
+ libcdio-paranoia
+ libcue
+ ] ++ lib.optionals (lib.elem "libdvd" sources) [
+ libdvdcss
+ libdvdread
+ libdvdnav
];
meta = with lib; {
homepage = "https://akon.city/";
@@ -211,7 +228,7 @@
});
devShells = forAllDevSystems (pkgs: rec {
- default = with pkgs; mkShell {
+ default = with pkgs; mkShell rec {
NIX_HARDENING_ENABLE = "";
nativeBuildInputs = packages.${system}.default.nativeBuildInputs ++ [
gdb
@@ -220,15 +237,15 @@
valgrind
clang-tools
mypy
- ruff
- ty
- kdePackages.kcachegrind
- perl
+ #ruff
+ #ty
+ #kdePackages.kcachegrind
+ #perl
asciidoctor
- pandoc
- mesa-demos
- emscripten
+ #pandoc
+ #emscripten
#makemkv
+ mesa-demos
# mesa build
#buildPackages.mesa.cross_tools
#mesa.depsBuildBuild
@@ -261,8 +278,21 @@
#lollypop
#xfce.parole
];
- buildInputs = packages.${system}.default.buildInputs;
- shellHook = ''
+ buildInputs = packages.${system}.default.buildInputs ++ [
+ # glfw3 build
+ xinput
+ libXinerama
+ # notcurses build
+ libunistring
+ ncurses
+ # discord
+ libsodium
+ ];
+ nvidia-support = false;
+ shellHook = (if nvidia-support then ''
+ export XDG_DATA_DIRS="${pkgs.mesa}/share:${pkgs.linuxPackages.nvidia_x11}/share:$XDG_DATA_DIRS"
+ export __EGL_VENDOR_LIBRARY_DIRS="${pkgs.mesa}/share/glvnd/egl_vendor.d:${pkgs.linuxPackages.nvidia_x11}/share/glvnd/egl_vendor.d:$__EGL_VENDOR_LIBRARY_DIRS"
+ '' else '''') + ''
export SHELL="${pkgs.bashInteractive}/bin/bash"
# Vulkan ICDs.
export XDG_DATA_DIRS="${pkgs.mesa}/share:$XDG_DATA_DIRS"
@@ -296,7 +326,7 @@
mingw64 = with pkgs; let
gcc = pkgsCross.ucrt64.buildPackages.wrapCCWith {
- cc = (pkgsCross.ucrt64.buildPackages.gcc-unwrapped.override ({
+ cc = (pkgsCross.ucrt64.buildPackages.gcc.cc.override ({
threadsCross = { model = "win32"; package = null; };
}));
};
@@ -345,7 +375,7 @@
glslang
];
buildInputs = with pkgsCross.ucrt64; [
- (zlib.override { static = true; shared = false; })
+ zlib.static
(bzip2.override { enableStatic = true; enableShared = false; })
(soxr.overrideAttrs (oldAttrs: {
cmakeFlags = oldAttrs.cmakeFlags ++ [ "-DBUILD_STATIC_LIBS=ON" "-DBUILD_SHARED_LIBS=OFF" ];
@@ -364,8 +394,11 @@
# https://old.reddit.com/r/NixOS/comments/1c4lc1n/how_to_run_this_minimal_python_script_with/kzpao62/
shellHook = ''
export SHELL="${pkgs.bashInteractive}/bin/bash"
+ # For native compiler.
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.stdenv.cc.cc.lib}/lib"
export XDG_DATA_DIRS="${pkgs.mesa}/share:$XDG_DATA_DIRS"
+ # Using x86_64-w64-mingw32-ar (as opposed to x86_64-w64-mingw32-gcc-ar) breaks lto.
+ unset AR NM
#alias wine="${pkgs.nixgl.nixGLIntel}/bin/nixGLIntel wine"
# Silence Wine logging and enable Esync by default.
export WINEDEBUG=-all
@@ -387,7 +420,7 @@
NIX_HARDENING_ENABLE = "";
nativeBuildInputs = mingw64.nativeBuildInputs;
buildInputs = with pkgsCross.mingw32; [
- ((buildWithFlags zlib "-Os").override { static = true; shared = false; })
+ (buildWithFlags zlib.static "-Os")
((buildWithFlags bzip2 "-Os").override { enableStatic = true; enableShared = false; })
((buildWithFlags soxr "-Os").overrideAttrs (oldAttrs: {
cmakeFlags = oldAttrs.cmakeFlags ++ [ "-DBUILD_STATIC_LIBS=ON" "-DBUILD_SHARED_LIBS=OFF" ];
@@ -412,10 +445,10 @@
android = with pkgs; let
cmakeVersion = "3.22.1";
androidComposition = androidenv.composeAndroidPackages {
- cmdLineToolsVersion = "13.0";
+ cmdLineToolsVersion = "19.0";
toolsVersion = "26.1.1";
platformToolsVersion = "36.0.2";
- buildToolsVersions = [ "34.0.0" ];
+ buildToolsVersions = [ "36.1.0" ];
includeEmulator = false;
emulatorVersion = "35.2.5";
platformVersions = [ "34" ];