push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
{
lib,
SDL2,
autoreconfHook,
fetchFromGitHub,
freetype,
pango,
pkg-config,
stdenv,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "sdl2-pango";
version = "2.1.5";
src = fetchFromGitHub {
owner = "markuskimius";
repo = "SDL2_Pango";
rev = "v${finalAttrs.version}";
hash = "sha256-8SL5ylxi87TuKreC8m2kxlLr8rcmwYYvwkp4vQZ9dkc=";
};
nativeBuildInputs = [
SDL2
autoreconfHook
pkg-config
];
buildInputs = [
SDL2
freetype
pango
];
outputs = [
"out"
"dev"
];
strictDeps = true;
meta = {
homepage = "https://github.com/markuskimius/SDL2_Pango";
description = "Library for graphically rendering internationalized and tagged text in SDL2 using TrueType fonts";
license = lib.licenses.lgpl21Plus;
maintainers = with lib.maintainers; [ rardiol ];
teams = [ lib.teams.sdl ];
inherit (SDL2.meta) platforms;
};
})

View File

@@ -0,0 +1,80 @@
{
lib,
SDL2,
fetchurl,
pkg-config,
stdenv,
testers,
# Boolean flags
enableMmx ? stdenv.hostPlatform.isx86,
enableSdltest ? (!stdenv.hostPlatform.isDarwin),
}:
stdenv.mkDerivation (finalAttrs: {
pname = "SDL2_gfx";
version = "1.0.4";
src = fetchurl {
url = "http://www.ferzkopp.net/Software/SDL2_gfx/SDL2_gfx-${finalAttrs.version}.tar.gz";
hash = "sha256-Y+DgGt3tyd8vhbk6JI8G6KBK/6AUqDXC6jS/405XYmI=";
};
nativeBuildInputs = [
SDL2
pkg-config
];
buildInputs = [
SDL2
];
outputs = [
"out"
"dev"
];
# Missing 'sincos()' implementation fails linking projects
# like 'freeciv_sdl2'.
env.NIX_LDFLAGS = "-lm";
configureFlags = [
(lib.enableFeature enableMmx "mmx")
(lib.enableFeature enableSdltest "sdltest")
];
strictDeps = true;
enableParallelBuilding = true;
passthru = {
tests.pkg-config = testers.hasPkgConfigModules {
package = finalAttrs.finalPackage;
};
};
meta = {
homepage = "http://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx/";
description = "SDL graphics drawing primitives and support functions";
longDescription = ''
The SDL_gfx library evolved out of the SDL_gfxPrimitives code which
provided basic drawing routines such as lines, circles or polygons and
SDL_rotozoom which implemented a interpolating rotozoomer for SDL
surfaces.
The current components of the SDL_gfx library are:
- Graphic Primitives (SDL_gfxPrimitves.h)
- Rotozoomer (SDL_rotozoom.h)
- Framerate control (SDL_framerate.h)
- MMX image filters (SDL_imageFilter.h)
- Custom Blit functions (SDL_gfxBlitFunc.h)
The library is backwards compatible to the above mentioned code. Its is
written in plain C and can be used in C++ code.
'';
license = lib.licenses.zlib;
teams = [ lib.teams.sdl ];
pkgConfigModules = [ "SDL2_gfx" ];
inherit (SDL2.meta) platforms;
};
})

View File

@@ -0,0 +1,72 @@
{
lib,
SDL2,
autoreconfHook,
fetchurl,
libjpeg,
libpng,
libtiff,
libwebp,
pkg-config,
stdenv,
zlib,
# Boolean flags
enableSTB ? true,
## Darwin headless will hang when trying to run the SDL test program
enableSdltest ? (!stdenv.hostPlatform.isDarwin),
}:
stdenv.mkDerivation (finalAttrs: {
pname = "SDL2_image";
version = "2.8.8";
src = fetchurl {
url = "https://www.libsdl.org/projects/SDL_image/release/SDL2_image-${finalAttrs.version}.tar.gz";
hash = "sha256-IhO1b9r/IiDQ44yOQgy+GoPIc3QZDLqMcK8hVgl84wo=";
};
nativeBuildInputs = [
SDL2
autoreconfHook
pkg-config
];
buildInputs = [
SDL2
libtiff
libwebp
zlib
]
++ lib.optionals (!enableSTB) [
libjpeg
libpng
];
configureFlags = [
# Disable dynamically loaded dependencies
(lib.enableFeature false "jpg-shared")
(lib.enableFeature false "png-shared")
(lib.enableFeature false "tif-shared")
(lib.enableFeature false "webp-shared")
(lib.enableFeature enableSTB "stb-image")
(lib.enableFeature enableSdltest "sdltest")
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# Don't use native macOS frameworks
# Caution: do not set this as (!stdenv.hostPlatform.isDarwin) since it would be true
# outside Darwin - and ImageIO does not exist outside Darwin
(lib.enableFeature false "imageio")
];
strictDeps = true;
enableParallelBuilding = true;
meta = {
description = "SDL image library";
homepage = "https://github.com/libsdl-org/SDL_image";
license = lib.licenses.zlib;
teams = [ lib.teams.sdl ];
platforms = lib.platforms.unix;
};
})

View File

@@ -0,0 +1,78 @@
{
lib,
SDL2,
fetchFromGitHub,
flac,
fluidsynth,
libogg,
libvorbis,
mpg123,
opusfile,
pkg-config,
smpeg2,
stdenv,
timidity,
wavpack,
libxmp,
game-music-emu,
# Boolean flags
enableSdltest ? (!stdenv.hostPlatform.isDarwin),
}:
stdenv.mkDerivation (finalAttrs: {
pname = "SDL2_mixer";
version = "2.8.1";
src = fetchFromGitHub {
owner = "libsdl-org";
repo = "SDL_mixer";
rev = "release-${finalAttrs.version}";
hash = "sha256-6HOTLwGi2oSQChwHE/oNHfZpcMh8xTuwNQSpKS01bwI=";
};
nativeBuildInputs = [
SDL2
pkg-config
];
propagatedBuildInputs = [
SDL2
flac
fluidsynth
libogg
libvorbis
mpg123
opusfile
smpeg2
wavpack
libxmp
game-music-emu
# MIDI patterns
timidity
];
outputs = [
"out"
"dev"
];
strictDeps = true;
configureFlags = [
(lib.enableFeature false "music-mod-modplug-shared")
(lib.enableFeature false "music-mp3-mpg123-shared")
(lib.enableFeature false "music-opus-shared")
(lib.enableFeature false "music-midi-fluidsynth-shared")
(lib.enableFeature enableSdltest "sdltest")
# override default path to allow MIDI files to be played
(lib.withFeatureAs true "timidity-cfg" "${timidity}/share/timidity/timidity.cfg")
];
meta = {
homepage = "https://github.com/libsdl-org/SDL_mixer";
description = "SDL multi-channel audio mixer library";
license = lib.licenses.zlib;
teams = [ lib.teams.sdl ];
platforms = lib.platforms.unix;
};
})

View File

@@ -0,0 +1,48 @@
{
lib,
SDL2,
fetchFromGitHub,
pkg-config,
stdenv,
# Boolean flags
enableSdltest ? (!stdenv.hostPlatform.isDarwin),
}:
stdenv.mkDerivation (finalAttrs: {
pname = "SDL2_net";
version = "2.2.0";
src = fetchFromGitHub {
owner = "libsdl-org";
repo = "SDL_net";
rev = "release-${finalAttrs.version}";
hash = "sha256-sEcKn/apA6FcR7ijb7sfuvP03ZdVfjkNZTXsasK8fAI=";
};
outputs = [
"out"
"dev"
];
nativeBuildInputs = [
SDL2
pkg-config
];
propagatedBuildInputs = [ SDL2 ];
configureFlags = [
(lib.enableFeature false "examples") # can't find libSDL2_test.a
(lib.enableFeature enableSdltest "sdltest")
];
strictDeps = true;
meta = {
homepage = "https://github.com/libsdl-org/SDL_net";
description = "SDL multiplatform networking library";
license = lib.licenses.zlib;
teams = [ lib.teams.sdl ];
inherit (SDL2.meta) platforms;
};
})

View File

@@ -0,0 +1,58 @@
{
stdenv,
lib,
fetchFromGitHub,
cmake,
SDL2,
nix-update-script,
}:
# As of 2025-06-27 this library has no dependents in nixpkgs (https://github.com/NixOS/nixpkgs/pull/420339) and is
# considered for deletion.
stdenv.mkDerivation (finalAttrs: {
pname = "SDL2_sound";
version = "2.0.4";
src = fetchFromGitHub {
owner = "icculus";
repo = "SDL_sound";
rev = "v${finalAttrs.version}";
hash = "sha256-5t2ELm8d8IX+cIJqGl/8sffwXGj5Cm0kZI6+bmjvvPg=";
};
outputs = [
"out"
"lib"
"dev"
];
nativeBuildInputs = [ cmake ];
cmakeFlags = [
(lib.cmakeBool "SDLSOUND_DECODER_MIDI" true)
(lib.cmakeBool "SDLSOUND_BUILD_SHARED" (!stdenv.hostPlatform.isStatic))
(lib.cmakeBool "SDLSOUND_BUILD_STATIC" stdenv.hostPlatform.isStatic)
];
buildInputs = [ SDL2 ];
passthru.updateScript = nix-update-script { };
meta = {
description = "SDL2 sound library";
mainProgram = "playsound";
platforms = lib.platforms.all;
license = with lib.licenses; [
zlib
# various vendored decoders
publicDomain
# timidity
artistic1
lgpl21Only
];
teams = [ lib.teams.sdl ];
homepage = "https://www.icculus.org/SDL_sound/";
};
})

View File

@@ -0,0 +1,60 @@
{
lib,
SDL2,
fetchurl,
freetype,
harfbuzz,
libGL,
pkg-config,
stdenv,
testers,
# Boolean flags
enableSdltest ? (!stdenv.hostPlatform.isDarwin),
}:
stdenv.mkDerivation (finalAttrs: {
pname = "SDL2_ttf";
version = "2.24.0";
src = fetchurl {
url = "https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-${finalAttrs.version}.tar.gz";
hash = "sha256-Cyvx57ZWitvbybuSRkP3nZ3tr+Bh+h7Wh9HZrE5FO/0=";
};
nativeBuildInputs = [
SDL2
pkg-config
];
buildInputs = [
SDL2
freetype
harfbuzz
]
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
libGL
];
configureFlags = [
(lib.enableFeature false "harfbuzz-builtin")
(lib.enableFeature false "freetype-builtin")
(lib.enableFeature enableSdltest "sdltest")
];
strictDeps = true;
passthru = {
tests.pkg-config = testers.hasPkgConfigModules {
package = finalAttrs.finalPackage;
};
};
meta = {
homepage = "https://github.com/libsdl-org/SDL_ttf";
description = "Support for TrueType (.ttf) font files with Simple Directmedia Layer";
license = lib.licenses.zlib;
teams = [ lib.teams.sdl ];
inherit (SDL2.meta) platforms;
pkgConfigModules = [ "SDL2_ttf" ];
};
})

View File

@@ -0,0 +1,148 @@
diff --git a/SDL_Pango.pc.in b/SDL_Pango.pc.in
index 750d091..3af38ff 100644
--- a/SDL_Pango.pc.in
+++ b/SDL_Pango.pc.in
@@ -6,6 +6,6 @@ includedir=@includedir@
Name: SDL_Pango
Description: SDL library for internationalized text rendering
Version: @VERSION@
-Requires: pango
+Requires: pango pangoft2
Libs: -L${libdir} -lSDL_Pango
Cflags: -I${includedir}
\ No newline at end of file
diff --git a/src/SDL_Pango.c b/src/SDL_Pango.c
index b969bc1..cc2c3f5 100644
--- a/src/SDL_Pango.c
+++ b/src/SDL_Pango.c
@@ -231,6 +231,41 @@
#include "SDL_Pango.h"
+const SDLPango_Matrix _MATRIX_WHITE_BACK
+ = {255, 0, 0, 0,
+ 255, 0, 0, 0,
+ 255, 0, 0, 0,
+ 255, 255, 0, 0,};
+const SDLPango_Matrix *MATRIX_WHITE_BACK = &_MATRIX_WHITE_BACK;
+
+const SDLPango_Matrix _MATRIX_BLACK_BACK
+ = {0, 255, 0, 0,
+ 0, 255, 0, 0,
+ 0, 255, 0, 0,
+ 255, 255, 0, 0,};
+const SDLPango_Matrix *MATRIX_BLACK_BACK = &_MATRIX_BLACK_BACK;
+
+const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_BLACK_LETTER
+ = {0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 255, 0, 0,};
+const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_BLACK_LETTER = &_MATRIX_TRANSPARENT_BACK_BLACK_LETTER;
+
+const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_WHITE_LETTER
+ = {255, 255, 0, 0,
+ 255, 255, 0, 0,
+ 255, 255, 0, 0,
+ 0, 255, 0, 0,};
+const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_WHITE_LETTER = &_MATRIX_TRANSPARENT_BACK_WHITE_LETTER;
+
+const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER
+ = {255, 255, 0, 0,
+ 255, 255, 0, 0,
+ 255, 255, 0, 0,
+ 0, 0, 0, 0,};
+const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER = &_MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER;
+
//! non-zero if initialized
static int IS_INITIALIZED = 0;
diff --git a/src/SDL_Pango.h b/src/SDL_Pango.h
index 6ebdf78..b7e5e58 100644
--- a/src/SDL_Pango.h
+++ b/src/SDL_Pango.h
@@ -47,57 +47,32 @@ typedef struct _SDLPango_Matrix {
Uint8 m[4][4]; /*! Matrix variables */
} SDLPango_Matrix;
-const SDLPango_Matrix _MATRIX_WHITE_BACK
- = {255, 0, 0, 0,
- 255, 0, 0, 0,
- 255, 0, 0, 0,
- 255, 255, 0, 0,};
/*!
Specifies white back and black letter.
*/
-const SDLPango_Matrix *MATRIX_WHITE_BACK = &_MATRIX_WHITE_BACK;
+extern const SDLPango_Matrix *MATRIX_WHITE_BACK;
-const SDLPango_Matrix _MATRIX_BLACK_BACK
- = {0, 255, 0, 0,
- 0, 255, 0, 0,
- 0, 255, 0, 0,
- 255, 255, 0, 0,};
/*!
Specifies black back and white letter.
*/
-const SDLPango_Matrix *MATRIX_BLACK_BACK = &_MATRIX_BLACK_BACK;
+extern const SDLPango_Matrix *MATRIX_BLACK_BACK;
-const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_BLACK_LETTER
- = {0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 255, 0, 0,};
/*!
Specifies transparent back and black letter.
*/
-const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_BLACK_LETTER = &_MATRIX_TRANSPARENT_BACK_BLACK_LETTER;
+extern const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_BLACK_LETTER;
-const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_WHITE_LETTER
- = {255, 255, 0, 0,
- 255, 255, 0, 0,
- 255, 255, 0, 0,
- 0, 255, 0, 0,};
/*!
Specifies transparent back and white letter.
*/
-const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_WHITE_LETTER = &_MATRIX_TRANSPARENT_BACK_WHITE_LETTER;
+extern const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_WHITE_LETTER;
-const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER
- = {255, 255, 0, 0,
- 255, 255, 0, 0,
- 255, 255, 0, 0,
- 0, 0, 0, 0,};
/*!
Specifies transparent back and transparent letter.
This is useful for KARAOKE like rendering.
*/
-const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER = &_MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER;
+extern const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER;
/*!
Specifies direction of text. See Pango reference for detail
@@ -186,7 +161,8 @@ extern DECLSPEC void SDLCALL SDLPango_SetBaseDirection(
SDLPango_Direction direction);
-#ifdef __FT2_BUILD_UNIX_H__
+
+#ifdef __PANGO_H__
extern DECLSPEC void SDLCALL SDLPango_CopyFTBitmapToSurface(
const FT_Bitmap *bitmap,
@@ -194,11 +170,8 @@ extern DECLSPEC void SDLCALL SDLPango_CopyFTBitmapToSurface(
const SDLPango_Matrix *matrix,
SDL_Rect *rect);
-#endif /* __FT2_BUILD_UNIX_H__ */
-#ifdef __PANGO_H__
-
extern DECLSPEC PangoFontMap* SDLCALL SDLPango_GetPangoFontMap(
SDLPango_Context *context);

View File

@@ -0,0 +1,57 @@
{
lib,
SDL,
autoreconfHook,
fetchpatch,
fetchurl,
pango,
pkg-config,
stdenv,
# Boolean flags
enableSdltest ? (!stdenv.hostPlatform.isDarwin),
}:
stdenv.mkDerivation (finalAttrs: {
pname = "SDL_Pango";
version = "0.1.2";
src = fetchurl {
url = "mirror://sourceforge/sdlpango/SDL_Pango-${finalAttrs.version}.tar.gz";
hash = "sha256-f3XTuXrPcHxpbqEmQkkGIE6/oHZgFi3pJRc83QJX66Q=";
};
patches = [
(fetchpatch {
name = "0000-api_additions.patch";
url = "https://sources.debian.org/data/main/s/sdlpango/0.1.2-6/debian/patches/api_additions.patch";
hash = "sha256-jfr+R4tIVZfYoaY4i+aNSGLwJGEipnuKqD2O9orP5QI=";
})
./0001-fixes.patch
];
nativeBuildInputs = [
SDL
autoreconfHook
pkg-config
];
buildInputs = [
SDL
pango
];
configureFlags = [
(lib.enableFeature enableSdltest "sdltest")
];
strictDeps = true;
meta = {
homepage = "https://sdlpango.sourceforge.net/";
description = "Connects the Pango rendering engine to SDL";
license = lib.licenses.lgpl21Plus;
maintainers = with lib.maintainers; [ puckipedia ];
teams = [ lib.teams.sdl ];
inherit (SDL.meta) platforms;
};
})

View File

@@ -0,0 +1,61 @@
{
lib,
SDL2,
cmake,
fetchFromGitHub,
pkg-config,
stdenv,
flac,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "SDL_audiolib";
# don't update to latest master as it will break some sounds in devilutionx
version = "0-unstable-2022-07-13";
src = fetchFromGitHub {
owner = "realnc";
repo = "SDL_audiolib";
rev = "cc1bb6af8d4cf5e200259072bde1edd1c8c5137e";
hash = "sha256-xP7qlwwOkqVeTlCEZLinnvmx8LbU2co5+t//cf4n190=";
};
nativeBuildInputs = [
SDL2
cmake
pkg-config
];
buildInputs = [
SDL2
flac
];
strictDeps = true;
cmakeFlags = [
(lib.cmakeBool "USE_DEC_ADLMIDI" false)
(lib.cmakeBool "USE_DEC_BASSMIDI" false)
(lib.cmakeBool "USE_DEC_DRFLAC" false)
(lib.cmakeBool "USE_DEC_FLUIDSYNTH" false)
(lib.cmakeBool "USE_DEC_LIBOPUSFILE" false)
(lib.cmakeBool "USE_DEC_LIBVORBIS" false)
(lib.cmakeBool "USE_DEC_MODPLUG" false)
(lib.cmakeBool "USE_DEC_MPG123" false)
(lib.cmakeBool "USE_DEC_MUSEPACK" false)
(lib.cmakeBool "USE_DEC_OPENMPT" false)
(lib.cmakeBool "USE_DEC_SNDFILE" false)
(lib.cmakeBool "USE_DEC_WILDMIDI" false)
(lib.cmakeBool "USE_DEC_XMP" false)
(lib.cmakeBool "USE_RESAMP_SOXR" false)
(lib.cmakeBool "USE_RESAMP_SRC" false)
];
meta = {
description = "Audio decoding, resampling and mixing library for SDL";
homepage = "https://github.com/realnc/SDL_audiolib";
license = lib.licenses.lgpl3Plus;
teams = [ lib.teams.sdl ];
inherit (SDL2.meta) platforms;
};
})

View File

@@ -0,0 +1,26 @@
diff --git a/sdl-config.in b/sdl-config.in
index ce332b3..359d574 100755
--- a/sdl-config.in
+++ b/sdl-config.in
@@ -50,14 +50,18 @@ while test $# -gt 0; do
echo @PROJECT_VERSION@
;;
--cflags)
- echo -I${includedir}/SDL @SDL_CFLAGS@
+ SDL_CFLAGS=""
+ for i in @includedir@/SDL $SDL_PATH; do
+ SDL_CFLAGS="$SDL_CFLAGS -I$i"
+ done
+ echo $SDL_CFLAGS @SDL_CFLAGS@
;;
@ENABLE_SHARED_TRUE@ --libs)
-@ENABLE_SHARED_TRUE@ echo -L${libdir} @SDL_RLD_FLAGS@ @SDL_LIBS@
+@ENABLE_SHARED_TRUE@ echo -L${libdir} @SDL_RLD_FLAGS@ @SDL_LIBS@ $SDL_LIB_PATH
@ENABLE_SHARED_TRUE@ ;;
@ENABLE_STATIC_TRUE@@ENABLE_SHARED_TRUE@ --static-libs)
@ENABLE_STATIC_TRUE@@ENABLE_SHARED_FALSE@ --libs|--static-libs)
-@ENABLE_STATIC_TRUE@ echo -L${libdir} @SDL_LIBS@ @SDL_STATIC_LIBS@
+@ENABLE_STATIC_TRUE@ echo -L${libdir} @SDL_LIBS@ @SDL_STATIC_LIBS@ $SDL_LIB_PATH
@ENABLE_STATIC_TRUE@ ;;
*)
echo "${usage}" 1>&2

View File

@@ -0,0 +1,123 @@
{
lib,
sdl2-compat,
cmake,
darwin,
fetchFromGitHub,
libGLU,
libiconv,
libX11,
mesa,
pkg-config,
pkg-config-unwrapped,
stdenv,
testers,
dosbox,
SDL_image,
SDL_ttf,
SDL_mixer,
SDL_sound,
# Boolean flags
libGLSupported ? lib.elem stdenv.hostPlatform.system mesa.meta.platforms,
openglSupport ? libGLSupported,
}:
let
inherit (darwin) autoSignDarwinBinariesHook;
in
stdenv.mkDerivation (finalAttrs: {
pname = "SDL_compat";
version = "1.2.68";
src = fetchFromGitHub {
owner = "libsdl-org";
repo = "sdl12-compat";
rev = "release-" + finalAttrs.version;
hash = "sha256-f2dl3L7/qoYNl4sjik1npcW/W09zsEumiV9jHuKnUmM=";
};
nativeBuildInputs = [
cmake
pkg-config
]
++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
autoSignDarwinBinariesHook
];
# re-export PKG_CHECK_MODULES m4 macro used by sdl.m4
propagatedNativeBuildInputs = [ pkg-config-unwrapped ];
buildInputs = [
libX11
sdl2-compat
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
libiconv
]
++ lib.optionals openglSupport [ libGLU ];
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace-fail 'set(CMAKE_SKIP_RPATH TRUE)' 'set(CMAKE_SKIP_RPATH FALSE)'
'';
dontPatchELF = true; # don't strip rpath
cmakeFlags =
let
rpath = lib.makeLibraryPath [ sdl2-compat ];
in
[
(lib.cmakeFeature "CMAKE_INSTALL_RPATH" rpath)
(lib.cmakeFeature "CMAKE_BUILD_RPATH" rpath)
(lib.cmakeBool "SDL12TESTS" finalAttrs.finalPackage.doCheck)
];
enableParallelBuilding = true;
# Darwin fails with "Critical error: required built-in appearance SystemAppearance not found"
doCheck = !stdenv.hostPlatform.isDarwin;
checkPhase = ''
runHook preCheck
./testver
runHook postCheck
'';
postInstall = ''
# allow as a drop in replacement for SDL
# Can be removed after treewide switch from pkg-config to pkgconf
ln -s $out/lib/pkgconfig/sdl12_compat.pc $out/lib/pkgconfig/sdl.pc
'';
# The setup hook scans paths of buildInputs to find SDL related packages and
# adds their include and library paths to environment variables. The sdl-config
# is patched to use these variables to produce correct flags for compiler.
patches = [ ./find-headers.patch ];
setupHook = ./setup-hook.sh;
passthru.tests = {
pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
inherit
SDL_image
SDL_ttf
SDL_mixer
SDL_sound
dosbox
;
};
meta = {
homepage = "https://www.libsdl.org/";
description = "Cross-platform multimedia library - build SDL 1.2 applications against 2.0";
license = lib.licenses.zlib;
mainProgram = "sdl-config";
maintainers = with lib.maintainers; [ peterhoeg ];
teams = [ lib.teams.sdl ];
platforms = lib.platforms.all;
pkgConfigModules = [
"sdl"
"sdl12_compat"
];
};
})

View File

@@ -0,0 +1,16 @@
addSDLPath () {
if [ -e "$1/include/SDL" ]; then
export SDL_PATH="${SDL_PATH-}${SDL_PATH:+ }$1/include/SDL"
# NB this doesnt work with split dev packages because different packages
# will contain "include/SDL/" and "lib/" directories.
#
# However the SDL_LIB_PATH is consumed by SDL itself and serves to locate
# libraries like SDL_mixer, SDL_image, etc which are not split-package
# so the check above will only trigger on them.
if [ -e "$1/lib" ]; then
export SDL_LIB_PATH="${SDL_LIB_PATH-}${SDL_LIB_PATH:+ }-L$1/lib"
fi
fi
}
addEnvHooks "$hostOffset" addSDLPath

View File

@@ -0,0 +1,57 @@
{
lib,
SDL,
fetchurl,
stdenv,
# Boolean flags
enableSdltest ? (!stdenv.hostPlatform.isDarwin),
}:
stdenv.mkDerivation (finalAttrs: {
pname = "SDL_gfx";
version = "2.0.27";
src = fetchurl {
url = "https://www.ferzkopp.net/Software/SDL_gfx-2.0/SDL_gfx-${finalAttrs.version}.tar.gz";
hash = "sha256-37FaxfjOeklS3BLSrtl0dRjF5rM1wOMWNtI/k8Yw9Bk=";
};
buildInputs = [ SDL ];
# SDL_gfx.pc refers to sdl.pc and some SDL_gfx headers import SDL.h
propagatedBuildInputs = [ SDL ];
env.SDL_CONFIG = lib.getExe' (lib.getDev SDL) "sdl-config";
configureFlags = [
(lib.enableFeature false "mmx")
(lib.enableFeature enableSdltest "sdltest")
];
strictDeps = true;
meta = {
homepage = "https://sourceforge.net/projects/sdlgfx/";
description = "SDL graphics drawing primitives and support functions";
longDescription = ''
The SDL_gfx library evolved out of the SDL_gfxPrimitives code which
provided basic drawing routines such as lines, circles or polygons and
SDL_rotozoom which implemented a interpolating rotozoomer for SDL
surfaces.
The current components of the SDL_gfx library are:
- Graphic Primitives (SDL_gfxPrimitves.h)
- Rotozoomer (SDL_rotozoom.h)
- Framerate control (SDL_framerate.h)
- MMX image filters (SDL_imageFilter.h)
- Custom Blit functions (SDL_gfxBlitFunc.h)
The library is backwards compatible to the above mentioned code. Its is
written in plain C and can be used in C++ code.
'';
license = lib.licenses.zlib;
teams = [ lib.teams.sdl ];
inherit (SDL.meta) platforms;
};
})

View File

@@ -0,0 +1,76 @@
{
lib,
SDL,
fetchFromGitHub,
giflib,
libXpm,
libjpeg,
libpng,
libtiff,
libwebp,
pkg-config,
stdenv,
unstableGitUpdater,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "SDL_image";
version = "1.2.12-unstable-2025-06-15";
src = fetchFromGitHub {
owner = "libsdl-org";
repo = "SDL_image";
rev = "bb266d29e19493fa48bda9bbc56c26363099372f";
hash = "sha256-I8TqZX3249/bcZtfwrJd545E5h9d9HmRy8GGDH9S+kU=";
};
configureFlags = [
# Disable dynamic loading or else dlopen will fail because of no proper
# rpath
(lib.enableFeature false "jpg-shared")
(lib.enableFeature false "png-shared")
(lib.enableFeature false "tif-shared")
(lib.enableFeature false "webp-shared")
(lib.enableFeature (!stdenv.hostPlatform.isDarwin) "sdltest")
];
nativeBuildInputs = [
SDL
pkg-config
];
buildInputs = [
SDL
giflib
libXpm
libjpeg
libpng
libtiff
libwebp
];
env = lib.optionalAttrs stdenv.cc.isGNU {
NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types";
};
outputs = [
"out"
"dev"
];
strictDeps = true;
passthru.updateScript = unstableGitUpdater {
tagFormat = "release-1.*";
tagPrefix = "release-";
branch = "SDL-1.2";
};
meta = {
homepage = "http://www.libsdl.org/projects/SDL_image/";
description = "SDL image library";
license = lib.licenses.zlib;
teams = [ lib.teams.sdl ];
inherit (SDL.meta) platforms;
};
})

View File

@@ -0,0 +1,121 @@
{
lib,
SDL,
fetchpatch,
fetchurl,
fluidsynth,
libopenmpt-modplug,
libogg,
libvorbis,
pkg-config,
smpeg,
stdenv,
# passthru.tests
onscripter-en,
# Boolean flags
enableNativeMidi ? false,
enableSdltest ? (!stdenv.hostPlatform.isDarwin),
enableSmpegtest ? (!stdenv.hostPlatform.isDarwin),
}:
stdenv.mkDerivation (finalAttrs: {
pname = "SDL_mixer";
version = "1.2.12";
# word of caution: while there is a somewhat maintained SDL-1.2 branch on
# https://github.com/libsdl-org/SDL_mixer, it switches from smpeg to mpg123 which
# breaks autoconf in a bunch of packages, it's better to cherry-pick patches as needed
src = fetchurl {
url = "http://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-${finalAttrs.version}.tar.gz";
hash = "sha256-FkQwgnmpdXmQSeSCavLPx4fK0quxGqFFYuQCUh+GmSo=";
};
patches = [
# Fixes implicit declaration of `Mix_QuitFluidSynth`, which causes build failures with clang.
# https://github.com/libsdl-org/SDL_mixer/issues/287
(fetchpatch {
name = "fluidsynth-fix-implicit-declaration.patch";
url = "https://github.com/libsdl-org/SDL_mixer/commit/05b12a3c22c0746c29dc5478f5b7fbd8a51a1303.patch";
hash = "sha256-MDuViLD1w1tAVLoX2yFeJ865v21S2roi0x7Yi7GYRVU=";
})
# Backport of 2.0 fixes for incompatible function pointer conversions, fixing builds with clang.
(fetchpatch {
name = "fluidsynth-fix-function-pointer-conversions.patch";
url = "https://github.com/libsdl-org/SDL_mixer/commit/0c504159d212b710a47cb25c669b21730fc78edd.patch";
hash = "sha256-FSj7JLE2MbGVYCspoq3trXP5Ho+lAtnro2IUOHkto/U";
})
# Backport of MikMod fixes, which includes incompatible function pointer conversions.
(fetchpatch {
name = "mikmod-fixes.patch";
url = "https://github.com/libsdl-org/SDL_mixer/commit/a3e5ff8142cf3530cddcb27b58f871f387796ab6.patch";
hash = "sha256-dqD8hxx6U2HaelUx0WsGPiWuso++LjwasaAeTTGqdbk=";
})
# More incompatible function pointer conversion fixes (this time in Vorbis-decoding code).
(fetchpatch {
name = "vorbis-fix-function-pointer-conversion.patch";
url = "https://github.com/libsdl-org/SDL_mixer/commit/9e6d7b67a00656a68ea0c2eace75c587871549b9.patch";
hash = "sha256-rZI3bFb/KxnduTkA/9CISccKHUgrX22KXg69sl/uXvU=";
})
(fetchpatch {
name = "vorbis-fix-function-pointer-conversion-header-part.patch";
url = "https://github.com/libsdl-org/SDL_mixer/commit/03bd4ca6aa38c1a382c892cef86296cd621ecc1d.patch";
hash = "sha256-7HrSHYFYVgpamP7Q9znrFZMZ72jvz5wYpJEPqWev/I4=";
})
(fetchpatch {
name = "vorbis-fix-function-pointer-signature.patch";
url = "https://github.com/libsdl-org/SDL_mixer/commit/d28cbc34d63dd20b256103c3fe506ecf3d34d379.patch";
hash = "sha256-sGbtF+Tcjf+6a28nJgawefeeKXnhcwu7G55e94oS9AU=";
})
];
# Fix location of modplug header
postPatch = ''
substituteInPlace music_modplug.h \
--replace-fail '#include "modplug.h"' '#include <libmodplug/modplug.h>'
'';
nativeBuildInputs = [
pkg-config
];
buildInputs = [
SDL
fluidsynth
libopenmpt-modplug
libogg
libvorbis
smpeg
];
# pass in correct *-config for cross builds
env.SDL_CONFIG = lib.getExe' (lib.getDev SDL) "sdl-config";
env.SMPEG_CONFIG = lib.getExe' smpeg.dev "smpeg-config";
configureFlags = [
(lib.enableFeature false "music-ogg-shared")
(lib.enableFeature false "music-mod-shared")
(lib.enableFeature true "music-mod-modplug")
(lib.enableFeature enableNativeMidi "music-native-midi-gpl")
(lib.enableFeature enableSdltest "sdltest")
(lib.enableFeature enableSmpegtest "smpegtest")
];
outputs = [
"out"
"dev"
];
strictDeps = true;
passthru.tests = {
inherit onscripter-en;
};
meta = {
description = "SDL multi-channel audio mixer library";
homepage = "http://www.libsdl.org/projects/SDL_mixer/";
teams = [ lib.teams.sdl ];
license = lib.licenses.zlib;
inherit (SDL.meta) platforms;
};
})

View File

@@ -0,0 +1,51 @@
{
lib,
SDL,
fetchFromGitHub,
pkg-config,
stdenv,
unstableGitUpdater,
# Boolean flags
enableSdltest ? (!stdenv.hostPlatform.isDarwin),
}:
stdenv.mkDerivation (finalAttrs: {
pname = "SDL_net";
version = "1.2.8-unstable-2025-04-21";
src = fetchFromGitHub {
owner = "libsdl-org";
repo = "SDL_net";
rev = "e2e041b81747bc01b2c5fb3757a082e525e5d25b";
hash = "sha256-Nk1OoCIrHMABHuPrJHMlLyyR73px/Xikgz40RpDfonw=";
};
nativeBuildInputs = [
SDL
pkg-config
];
propagatedBuildInputs = [
SDL
];
configureFlags = [
(lib.enableFeature enableSdltest "sdltest")
];
strictDeps = true;
passthru.updateScript = unstableGitUpdater {
tagFormat = "release-1.*";
tagPrefix = "release-";
branch = "SDL-1.2";
};
meta = {
homepage = "https://github.com/libsdl-org/SDL_net";
description = "SDL networking library";
license = lib.licenses.zlib;
teams = [ lib.teams.sdl ];
inherit (SDL.meta) platforms;
};
})

View File

@@ -0,0 +1,38 @@
{
lib,
fetchFromGitHub,
libsixel,
pkg-config,
stdenv,
}:
stdenv.mkDerivation {
pname = "SDL_sixel";
version = "0-unstable-2016-02-06";
src = fetchFromGitHub {
owner = "saitoha";
repo = "SDL1.2-SIXEL";
rev = "ab3fccac6e34260a617be511bd8c2b2beae41952";
hash = "sha256-l5eLnfV2ozAlfiTo2pr0a2BXv/pwfpX4pycw1Z7doj4=";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ libsixel ];
configureFlags = [
(lib.enableFeature true "video-sixel")
];
strictDeps = true;
meta = {
homepage = "https://github.com/saitoha/SDL1.2-SIXEL";
description = "SDL 1.2 patched with libsixel support";
license = lib.licenses.lgpl21;
mainProgram = "sdl-config";
maintainers = [ ];
platforms = lib.platforms.linux;
};
}

View File

@@ -0,0 +1,45 @@
{
lib,
SDL,
fetchurl,
flac,
libmikmod,
libvorbis,
stdenv,
# Boolean flags
enableSdltest ? (!stdenv.hostPlatform.isDarwin),
}:
stdenv.mkDerivation (finalAttrs: {
pname = "SDL_sound";
version = "1.0.3";
src = fetchurl {
url = "https://icculus.org/SDL_sound/downloads/SDL_sound-${finalAttrs.version}.tar.gz";
hash = "sha256-OZn9C7tIUomlK+FLL2i1ccuE44DMQzh+rfd49kx55t8=";
};
buildInputs = [
SDL
flac
libmikmod
libvorbis
];
configureFlags = [
(lib.enableFeature enableSdltest "sdltest")
];
env.SDL_CONFIG = lib.getExe' (lib.getDev SDL) "sdl-config";
strictDeps = true;
meta = {
homepage = "https://www.icculus.org/SDL_sound/";
description = "SDL sound library";
license = lib.licenses.lgpl21Plus;
teams = [ lib.teams.sdl ];
mainProgram = "playsound";
inherit (SDL.meta) platforms;
};
})

View File

@@ -0,0 +1,36 @@
{
lib,
SDL,
fetchurl,
stdenv,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "SDL_stretch";
version = "0.3.1";
src = fetchurl {
url = "mirror://sourceforge/sdl-stretch/${finalAttrs.version}/SDL_stretch-${finalAttrs.version}.tar.bz2";
hash = "sha256-fL8L+rAMPt1uceGH0qLEgncEh4DiySQIuqt7YjUy/Nc=";
};
nativeBuildInputs = [ SDL ];
configureFlags = [
(lib.enableFeature (!stdenv.hostPlatform.isDarwin) "sdltest")
];
buildInputs = [ SDL ];
strictDeps = true;
meta = {
# sdlstretchcode.c:38:10: fatal error: 'malloc.h' file not found
broken = stdenv.hostPlatform.isDarwin;
homepage = "https://sdl-stretch.sourceforge.net/";
description = "Stretch Functions For SDL";
license = lib.licenses.lgpl2;
maintainers = [ ];
inherit (SDL.meta) platforms;
};
})

View File

@@ -0,0 +1,57 @@
{
lib,
SDL,
fetchFromGitHub,
freetype,
stdenv,
unstableGitUpdater,
# Boolean flags
enableSdltest ? (!stdenv.hostPlatform.isDarwin),
}:
stdenv.mkDerivation (finalAttrs: {
pname = "SDL_ttf";
version = "2.0.11-unstable-2024-04-23";
src = fetchFromGitHub {
owner = "libsdl-org";
repo = "SDL_ttf";
rev = "3c4233732b94ce08d5f6a868e597af39e13f8b23";
hash = "sha256-FX6Ko4CaOSCSKdpWVsJhTZXlWk1cnjbfVfMDiGG2+TU=";
};
buildInputs = [
SDL
freetype
];
# pass in correct *-config for cross builds
env.SDL_CONFIG = lib.getExe' (lib.getDev SDL) "sdl-config";
env.FT2_CONFIG = lib.getExe' freetype.dev "freetype-config";
configureFlags = [
(lib.enableFeature enableSdltest "sdltest")
];
env.NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin "-liconv";
strictDeps = true;
passthru.updateScript = unstableGitUpdater {
tagFormat = "release-2.0.11";
tagPrefix = "release-";
branch = "SDL-1.2";
};
meta = {
homepage = "https://github.com/libsdl-org/SDL_ttf";
description = "SDL TrueType library";
license = lib.licenses.zlib;
teams = [ lib.teams.sdl ];
inherit (SDL.meta) platforms;
knownVulnerabilities = [
# CVE applies to SDL2 https://github.com/NixOS/nixpkgs/pull/274836#issuecomment-2708627901
# "CVE-2022-27470"
];
};
})

View File

@@ -0,0 +1,29 @@
{
lib,
fetchFromGitHub,
buildGoModule,
}:
buildGoModule rec {
pname = "sd-local";
version = "1.0.58";
src = fetchFromGitHub {
owner = "screwdriver-cd";
repo = "sd-local";
rev = "v${version}";
sha256 = "sha256-7nL+9tJt4EnGGIhsGASXdBp0u7PXbbt50ADdK2Ciel0=";
};
vendorHash = "sha256-CcVb2ugvKzl/HTtub4iq81u7hps7Q5a1e1e+T5t13hY=";
subPackages = [ "." ];
meta = with lib; {
description = "screwdriver.cd local mode";
mainProgram = "sd-local";
homepage = "https://github.com/screwdriver-cd/sd-local";
license = licenses.bsd3;
maintainers = with maintainers; [ midchildan ];
};
}

View File

@@ -0,0 +1,50 @@
{
lib,
stdenv,
fetchgit,
cmake,
pkg-config,
installShellFiles,
libftdi1,
popt,
}:
stdenv.mkDerivation {
pname = "sd-mux-ctrl-unstable";
version = "2020-02-17";
src = fetchgit {
url = "https://git.tizen.org/cgit/tools/testlab/sd-mux";
rev = "9dd189d973da64e033a0c5c2adb3d94b23153d94";
hash = "sha256-b0uoxVPfSrqNt0wJoQho9jlpQQUjofgFm93P+UNFtDs=";
};
nativeBuildInputs = [
cmake
pkg-config
installShellFiles
];
buildInputs = [
libftdi1
popt
];
postInstall = ''
install -D -m 644 ../doc/man/sd-mux-ctrl.1 $out/share/man/man1/sd-mux-ctrl.1
installShellCompletion --cmd sd-mux-ctrl \
--bash ../etc/bash_completion.d/sd-mux-ctrl
'';
meta = with lib; {
description = "Tool for controlling multiple sd-mux devices";
homepage = "https://git.tizen.org/cgit/tools/testlab/sd-mux";
license = licenses.asl20;
maintainers = with maintainers; [
newam
sarcasticadmin
];
platforms = platforms.unix;
mainProgram = "sd-mux-ctrl";
};
}

View File

@@ -0,0 +1,37 @@
{
lib,
fetchFromSourcehut,
rustPlatform,
nix-update-script,
}:
let
version = "0.6.2";
in
rustPlatform.buildRustPackage {
pname = "sd-switch";
inherit version;
src = fetchFromSourcehut {
owner = "~rycee";
repo = "sd-switch";
rev = version;
hash = "sha256-3+FGARca3xcCYKEAxtrhnSnpOP2JZurOPzKvNhAYjkg=";
};
cargoHash = "sha256-jclRF05eUAW/ggCmfZfWE6c4q25d/WGX0dad4rsP8vk=";
passthru = {
updateScript = nix-update-script { };
};
meta = {
description = "Systemd unit switcher for Home Manager";
mainProgram = "sd-switch";
homepage = "https://git.sr.ht/~rycee/sd-switch";
changelog = "https://git.sr.ht/~rycee/sd-switch/refs/${version}";
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ rycee ];
platforms = lib.platforms.linux;
};
}

View File

@@ -0,0 +1,40 @@
{
lib,
fetchFromGitHub,
rustPlatform,
installShellFiles,
}:
rustPlatform.buildRustPackage rec {
pname = "sd";
version = "1.0.0";
src = fetchFromGitHub {
owner = "chmln";
repo = "sd";
rev = "v${version}";
hash = "sha256-hC4VKEgrAVuqOX7b24XhtrxrnJW5kmlX4E6QbY9H8OA=";
};
cargoHash = "sha256-KbEw09tTsUl9BLQsL7lW4VQq6D9E4lBiZf3Jrthst2Y=";
nativeBuildInputs = [ installShellFiles ];
postInstall = ''
installManPage gen/sd.1
installShellCompletion gen/completions/sd.{bash,fish}
installShellCompletion --zsh gen/completions/_sd
'';
meta = {
description = "Intuitive find & replace CLI (sed alternative)";
mainProgram = "sd";
homepage = "https://github.com/chmln/sd";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
amar1729
Br1ght0ne
];
};
}

View File

@@ -0,0 +1,31 @@
{
lib,
fetchFromGitHub,
python3Packages,
}:
python3Packages.buildPythonApplication {
pname = "sdat2img";
version = "0-unstable-2021-11-09";
src = fetchFromGitHub {
repo = "sdat2img";
owner = "xpirt";
rev = "b432c988a412c06ff24d196132e354712fc18929";
sha256 = "sha256-NCbf9H0hoJgeDtP6cQY0H280BQqgKXv3ConZ87QixVY=";
};
format = "other";
installPhase = ''
install -D $src/sdat2img.py $out/bin/sdat2img
'';
meta = {
description = "Convert sparse Android data image (.dat) into filesystem ext4 image (.img)";
homepage = "https://github.com/xpirt/sdat2img";
license = lib.licenses.mit;
maintainers = [ lib.maintainers.xaverdh ];
platforms = lib.platforms.unix;
mainProgram = "sdat2img";
};
}

View File

@@ -0,0 +1,29 @@
{
lib,
stdenv,
fetchFromGitHub,
autoreconfHook,
}:
stdenv.mkDerivation rec {
pname = "sdate";
version = "0.7";
src = fetchFromGitHub {
owner = "ChristophBerg";
repo = "sdate";
rev = version;
hash = "sha256-jkwe+bSBa0p1Xzfetsdpw0RYw/gSRxnY2jBOzC5HtJ8=";
};
nativeBuildInputs = [ autoreconfHook ];
meta = with lib; {
homepage = "https://www.df7cb.de/projects/sdate";
description = "Eternal september version of the date program";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ edef ];
platforms = platforms.all;
mainProgram = "sdate";
};
}

View File

@@ -0,0 +1,130 @@
{
lib,
stdenv,
fetchurl,
autoconf,
bison,
boost,
flex,
gputils,
texinfo,
zlib,
withGputils ? false,
excludePorts ? [ ],
}:
assert
lib.subtractLists [
"ds390"
"ds400"
"gbz80"
"hc08"
"mcs51"
"pic14"
"pic16"
"r2k"
"r3ka"
"s08"
"stm8"
"tlcs90"
"z80"
"z180"
] excludePorts == [ ];
stdenv.mkDerivation (finalAttrs: {
pname = "sdcc";
version = "4.5.0";
src = fetchurl {
url = "mirror://sourceforge/sdcc/sdcc-src-${finalAttrs.version}.tar.bz2";
hash = "sha256-1QMEN/tDa7HZOo29v7RrqqYGEzGPT7P1hx1ygV0e7YA=";
};
# TODO: sdcc version 4.5.0 does not currently produce a man output.
# Until the fix to sdcc's makefiles is released, this workaround
# conditionally withholds the man output on darwin.
#
# sdcc's tracking issue:
# <https://sourceforge.net/p/sdcc/bugs/3848/>
outputs = [
"out"
"doc"
]
++ lib.optionals (!stdenv.isDarwin) [
"man"
];
enableParallelBuilding = true;
nativeBuildInputs = [
autoconf
bison
flex
];
buildInputs = [
boost
texinfo
zlib
]
++ lib.optionals withGputils [
gputils
];
# sdcc 4.5.0 massively rewrote sim/ucsim/Makefile.in, and lost the `.PHONY`
# rule in the process. As a result, on macOS (which uses a case-insensitive
# filesystem), the INSTALL file keeps the `install` target in the ucsim
# directory from running. Nothing else creates the `man` output, causing the
# entire build to fail.
#
# TODO: remove this when updating to the next release - it's been fixed in
# upstream sdcc r15384 <https://sourceforge.net/p/sdcc/code/15384/>.
postPatch = ''
if grep -q '\.PHONY:.*install' sim/ucsim/Makefile.in; then
echo 'Upstream has added `.PHONY: install` rule; must remove `postPatch` from the Nix file.' >&2
exit 1
fi
echo '.PHONY: install' >> sim/ucsim/Makefile.in
'';
configureFlags =
let
excludedPorts =
excludePorts
++ (lib.optionals (!withGputils) [
"pic14"
"pic16"
]);
in
map (f: "--disable-${f}-port") excludedPorts;
preConfigure = ''
if test -n "''${dontStrip-}"; then
export STRIP=none
fi
'';
# ${src}/support/cpp/gcc/Makefile.in states:
# We don't want to compile the compilers with -fPIE, it make PCH fail.
hardeningDisable = [ "pie" ];
meta = {
homepage = "https://sdcc.sourceforge.net/";
description = "Small Device C Compiler";
longDescription = ''
SDCC is a retargettable, optimizing ANSI - C compiler suite that targets
the Intel MCS51 based microprocessors (8031, 8032, 8051, 8052, etc.),
Maxim (formerly Dallas) DS80C390 variants, Freescale (formerly Motorola)
HC08 based (hc08, s08) and Zilog Z80 based MCUs (z80, z180, gbz80, Rabbit
2000/3000, Rabbit 3000A). Work is in progress on supporting the Microchip
PIC16 and PIC18 targets. It can be retargeted for other microprocessors.
'';
license = if withGputils then lib.licenses.unfreeRedistributable else lib.licenses.gpl2Plus;
mainProgram = "sdcc";
maintainers = with lib.maintainers; [
bjornfor
yorickvp
];
platforms = lib.platforms.all;
};
})

View File

@@ -0,0 +1,55 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
pkg-config,
glib,
gettext,
readline,
}:
stdenv.mkDerivation rec {
pname = "sdcv";
version = "0.5.5";
src = fetchFromGitHub {
owner = "Dushistov";
repo = "sdcv";
rev = "v${version}";
sha256 = "sha256-EyvljVXhOsdxIYOGTzD+T16nvW7/RNx3DuQ2OdhjXJ4=";
};
hardeningDisable = [ "format" ];
nativeBuildInputs = [
cmake
pkg-config
];
buildInputs = [
glib
gettext
readline
];
postPatch = ''
# https://github.com/Dushistov/sdcv/pull/104
substituteInPlace src/stardict_lib.cpp --replace-fail \
"gchar *nextchar = g_utf8_next_char(sWord)" \
"gchar *nextchar = const_cast<gchar*>(g_utf8_next_char(sWord))"
'';
preInstall = ''
mkdir locale
'';
env.NIX_CFLAGS_COMPILE = "-D__GNU_LIBRARY__";
meta = with lib; {
homepage = "https://dushistov.github.io/sdcv/";
description = "Console version of StarDict";
maintainers = with maintainers; [ lovek323 ];
license = licenses.gpl2;
platforms = platforms.unix;
mainProgram = "sdcv";
};
}

View File

@@ -0,0 +1,45 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
pkg-config,
SDL,
SDL2,
ncurses,
docbook_xsl,
git,
}:
stdenv.mkDerivation {
pname = "sdl-jstest";
version = "2018-06-15";
src = fetchFromGitHub {
owner = "Grumbel";
repo = "sdl-jstest";
rev = "aafbdb1ed3e687583037ba55ae88b1210d6ce98b";
hash = "sha256-Mw+ENOVZ0O8WercdDNLAAkNMPZ2NyxSa+nMtgNmXjFw=";
fetchSubmodules = true;
};
buildInputs = [
SDL
SDL2
ncurses
];
nativeBuildInputs = [
cmake
pkg-config
docbook_xsl
git
];
meta = with lib; {
homepage = "https://github.com/Grumbel/sdl-jstest";
description = "Simple SDL joystick test application for the console";
license = licenses.gpl3;
platforms = platforms.linux;
maintainers = [ ];
};
}

View File

@@ -0,0 +1,31 @@
diff --git a/SDL2Config.cmake.in b/SDL2Config.cmake.in
index 80c1b99..54f50e6 100644
--- a/SDL2Config.cmake.in
+++ b/SDL2Config.cmake.in
@@ -45,7 +45,8 @@ endif()
set(SDL2_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@")
set(SDL2_EXEC_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@")
set(SDL2_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@/SDL2")
-set(SDL2_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@;@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@/SDL2")
+set(SDL2_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@;@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@/SDL2" $ENV{SDL2_PATH})
+separate_arguments(SDL2_INCLUDE_DIRS)
set(SDL2_BINDIR "@PACKAGE_CMAKE_INSTALL_FULL_BINDIR@")
set(SDL2_LIBDIR "@PACKAGE_CMAKE_INSTALL_FULL_LIBDIR@")
set(SDL2_LIBRARIES SDL2::SDL2)
diff --git a/sdl2-config.in b/sdl2-config.in
index d21b1b2..bb0d624 100644
--- a/sdl2-config.in
+++ b/sdl2-config.in
@@ -50,7 +50,11 @@ while test $# -gt 0; do
echo @PROJECT_VERSION@
;;
--cflags)
- echo -I${includedir}/SDL2 @SDL_CFLAGS@
+ SDL_CFLAGS=""
+ for i in @includedir@/SDL2 $SDL2_PATH; do
+ SDL_CFLAGS="$SDL_CFLAGS -I$i"
+ done
+ echo $SDL_CFLAGS @SDL_CFLAGS@
;;
@ENABLE_SHARED_TRUE@ --libs)
@ENABLE_SHARED_TRUE@ echo -L${libdir} @SDL_RLD_FLAGS@ @SDL_LIBS@

View File

@@ -0,0 +1,125 @@
{
cmake,
lib,
fetchFromGitHub,
ninja,
sdl3,
stdenv,
testers,
libX11,
libGL,
nix-update-script,
# passthru tests
SDL2_ttf,
SDL2_net,
SDL2_gfx,
SDL2_sound,
SDL2_mixer,
SDL2_image,
SDL_compat,
ffmpeg,
qemu,
x11Support ? !stdenv.hostPlatform.isAndroid && !stdenv.hostPlatform.isWindows,
}:
let
# tray support on sdl3 pulls in gtk3, which is quite an expensive dependency.
# sdl2 does not support the tray, so we can just disable that requirement.
sdl3' = sdl3.override { traySupport = false; };
in
stdenv.mkDerivation (finalAttrs: {
pname = "sdl2-compat";
version = "2.32.56";
src = fetchFromGitHub {
owner = "libsdl-org";
repo = "sdl2-compat";
tag = "release-${finalAttrs.version}";
hash = "sha256-Xg886KX54vwGANIhTAFslzPw/sZs2SvpXzXUXcOKgMs=";
};
nativeBuildInputs = [
cmake
ninja
];
buildInputs = [
sdl3'
]
++ lib.optional x11Support libX11;
checkInputs = [ libGL ];
outputs = [
"out"
"dev"
];
outputBin = "dev";
# SDL3 is dlopened at runtime, leave it in runpath
dontPatchELF = true;
cmakeFlags = [
(lib.cmakeBool "SDL2COMPAT_TESTS" finalAttrs.finalPackage.doCheck)
(lib.cmakeFeature "CMAKE_INSTALL_RPATH" (lib.makeLibraryPath [ sdl3' ]))
];
# skip timing-based tests as those are flaky
env.SDL_TESTS_QUICK = 1;
doCheck = true;
patches = [ ./find-headers.patch ];
setupHook = ./setup-hook.sh;
postFixup = ''
# allow as a drop in replacement for SDL2
# Can be removed after treewide switch from pkg-config to pkgconf
ln -s $dev/lib/pkgconfig/sdl2-compat.pc $dev/lib/pkgconfig/sdl2.pc
'';
passthru = {
tests = {
pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
inherit
SDL_compat
SDL2_ttf
SDL2_net
SDL2_gfx
SDL2_sound
SDL2_mixer
SDL2_image
ffmpeg
;
}
// lib.optionalAttrs stdenv.hostPlatform.isLinux {
inherit qemu;
};
updateScript = nix-update-script {
extraArgs = [
"--version-regex"
"release-(.*)"
];
};
};
meta = {
description = "SDL2 compatibility layer that uses SDL3 behind the scenes";
homepage = "https://libsdl.org";
changelog = "https://github.com/libsdl-org/sdl2-compat/releases/tag/${finalAttrs.src.tag}";
license = lib.licenses.zlib;
maintainers = with lib.maintainers; [
nadiaholmquist
];
teams = [ lib.teams.sdl ];
platforms = lib.platforms.all;
pkgConfigModules = [
"sdl2-compat"
"sdl2"
];
};
})

View File

@@ -0,0 +1,7 @@
addSDL2Path () {
if [ -e "$1/include/SDL2" ]; then
export SDL2_PATH="${SDL2_PATH-}${SDL2_PATH:+ }$1/include/SDL2"
fi
}
addEnvHooks "$hostOffset" addSDL2Path

View File

@@ -0,0 +1,84 @@
{
lib,
sdl3,
libavif,
libtiff,
libwebp,
stdenv,
cmake,
fetchFromGitHub,
validatePkgConfig,
libpng,
libjpeg,
nix-update-script,
# Boolean flags
enableTests ? true,
enableSTB ? true,
enableImageIO ? stdenv.hostPlatform.isDarwin,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "sdl3-image";
version = "3.2.4";
outputs = [
"lib"
"dev"
"out"
];
src = fetchFromGitHub {
owner = "libsdl-org";
repo = "SDL_image";
tag = "release-${finalAttrs.version}";
hash = "sha256-/orQ+YfH0CV8DOqXFMF9fOT4YaVpC1t55xM3j520Png=";
};
strictDeps = true;
doCheck = true;
nativeBuildInputs = [
cmake
validatePkgConfig
];
buildInputs = [
sdl3
libtiff
libwebp
libavif
]
++ (lib.optionals (!enableSTB) [
libpng
libjpeg
]);
cmakeFlags = [
# fail when a dependency could not be found
(lib.cmakeBool "SDLIMAGE_STRICT" true)
# disable shared dependencies as they're opened at runtime using SDL_LoadObject otherwise.
(lib.cmakeBool "SDLIMAGE_DEPS_SHARED" false)
# disable stbi
(lib.cmakeBool "SDLIMAGE_BACKEND_STB" enableSTB)
# enable imageio backend
(lib.cmakeBool "SDLIMAGE_BACKEND_IMAGEIO" enableImageIO)
# enable tests
(lib.cmakeBool "SDLIMAGE_TESTS" enableTests)
];
passthru.updateScript = nix-update-script {
extraArgs = [
"--version-regex"
"release-(3\\..*)"
];
};
meta = {
description = "SDL image library";
homepage = "https://github.com/libsdl-org/SDL_image";
license = lib.licenses.zlib;
maintainers = [ lib.maintainers.evythedemon ];
teams = [ lib.teams.sdl ];
inherit (sdl3.meta) platforms;
};
})

View File

@@ -0,0 +1,76 @@
{
lib,
stdenv,
fetchFromGitHub,
nix-update-script,
testers,
validatePkgConfig,
sdl3,
cmake,
freetype,
harfbuzz,
glib,
ninja,
plutosvg,
fixDarwinDylibNames,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "sdl3-ttf";
version = "3.2.2";
src = fetchFromGitHub {
owner = "libsdl-org";
repo = "SDL_ttf";
tag = "release-${finalAttrs.version}";
hash = "sha256-g7LfLxs7yr7bezQWPWn8arNuPxCfYLCO4kzXmLRUUSY=";
};
strictDeps = true;
doCheck = true;
nativeBuildInputs = [
cmake
ninja
validatePkgConfig
]
++ lib.optionals stdenv.hostPlatform.isDarwin [ fixDarwinDylibNames ];
buildInputs = [
sdl3
freetype
harfbuzz
glib
plutosvg
];
cmakeFlags = [
(lib.cmakeBool "SDLTTF_STRICT" true)
(lib.cmakeBool "SDLTTF_HARFBUZZ" true)
(lib.cmakeBool "SDLTTF_PLUTOSVG" true)
];
passthru = {
updateScript = nix-update-script {
extraArgs = [
"--version-regex"
"release-(3\\..*)"
];
};
tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
};
meta = {
description = "SDL TrueType font library";
homepage = "https://github.com/libsdl-org/SDL_ttf";
changelog = "https://github.com/libsdl-org/SDL_ttf/releases/tag/${toString finalAttrs.src.tag}";
license = lib.licenses.zlib;
maintainers = with lib.maintainers; [
charain
Emin017
];
teams = [ lib.teams.sdl ];
pkgConfigModules = [ "sdl3-ttf" ];
platforms = lib.platforms.all;
};
})

View File

@@ -0,0 +1,253 @@
{
lib,
stdenv,
config,
alsa-lib,
apple-sdk_11,
cmake,
darwinMinVersionHook,
dbus,
fetchFromGitHub,
ibusMinimal,
installShellFiles,
libGL,
libayatana-appindicator,
libdecor,
libdrm,
libjack2,
libpulseaudio,
libusb1,
libxkbcommon,
libgbm,
ninja,
nix-update-script,
nixosTests,
pipewire,
sndio,
systemdLibs,
testers,
validatePkgConfig,
vulkan-headers,
vulkan-loader,
wayland,
wayland-scanner,
xorg,
zenity,
# for passthru.tests
SDL_compat,
sdl2-compat,
sdl3-image,
sdl3-ttf,
alsaSupport ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid,
dbusSupport ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid,
drmSupport ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid,
ibusSupport ? stdenv.hostPlatform.isUnix && !stdenv.hostPlatform.isDarwin,
jackSupport ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid,
libdecorSupport ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid,
openglSupport ? lib.meta.availableOn stdenv.hostPlatform libGL,
pipewireSupport ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid,
pulseaudioSupport ?
config.pulseaudio or stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid,
libudevSupport ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid,
sndioSupport ? false,
traySupport ? true,
waylandSupport ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid,
x11Support ? !stdenv.hostPlatform.isAndroid && !stdenv.hostPlatform.isWindows,
}:
assert lib.assertMsg (
waylandSupport -> openglSupport
) "SDL3 requires OpenGL support to enable Wayland";
assert lib.assertMsg (ibusSupport -> dbusSupport) "SDL3 requires dbus support to enable ibus";
stdenv.mkDerivation (finalAttrs: {
pname = "sdl3";
version = "3.2.22";
outputs = [
"lib"
"dev"
"out"
"installedTests"
];
src = fetchFromGitHub {
owner = "libsdl-org";
repo = "SDL";
tag = "release-${finalAttrs.version}";
hash = "sha256-4jGfw2hNZTGuae2DMLz8xJBtfNu5abIN5GlNIKDOUpw=";
};
postPatch =
# Tests timeout on Darwin
# `testtray` loads assets from a relative path, which we are patching to be absolute
lib.optionalString (finalAttrs.finalPackage.doCheck) ''
substituteInPlace test/CMakeLists.txt \
--replace-fail 'set(noninteractive_timeout 10)' 'set(noninteractive_timeout 30)'
substituteInPlace test/testtray.c \
--replace-warn '../test/' '${placeholder "installedTests"}/share/assets/'
''
+ lib.optionalString waylandSupport ''
substituteInPlace src/video/wayland/SDL_waylandmessagebox.c \
--replace-fail '"zenity"' '"${lib.getExe zenity}"'
substituteInPlace src/dialog/unix/SDL_zenitydialog.c \
--replace-fail '"zenity"' '"${lib.getExe zenity}"'
'';
strictDeps = true;
nativeBuildInputs = [
cmake
ninja
validatePkgConfig
]
++ lib.optional waylandSupport wayland-scanner;
buildInputs =
lib.optionals stdenv.hostPlatform.isLinux [
libusb1
]
++ lib.optional (
stdenv.hostPlatform.isUnix && !stdenv.hostPlatform.isDarwin && traySupport
) libayatana-appindicator
++ lib.optional alsaSupport alsa-lib
++ lib.optional dbusSupport dbus
++ lib.optionals drmSupport [
libdrm
libgbm
]
++ lib.optional jackSupport libjack2
++ lib.optional libdecorSupport libdecor
++ lib.optional libudevSupport systemdLibs
++ lib.optional openglSupport libGL
++ lib.optional pipewireSupport pipewire
++ lib.optional pulseaudioSupport libpulseaudio
++ lib.optional sndioSupport sndio
++ lib.optionals waylandSupport [
libxkbcommon
wayland
]
++ lib.optionals x11Support [
xorg.libX11
xorg.libxcb
xorg.libXScrnSaver
xorg.libXcursor
xorg.libXext
xorg.libXfixes
xorg.libXi
xorg.libXrandr
]
++ [
vulkan-headers
vulkan-loader
]
++ lib.optional (openglSupport && !stdenv.hostPlatform.isDarwin) libGL
++ lib.optional x11Support xorg.libX11
++ lib.optionals stdenv.hostPlatform.isDarwin [
# error: 'MTLPixelFormatASTC_4x4_LDR' is unavailable: not available on macOS
(darwinMinVersionHook "11.0")
apple-sdk_11
]
++ lib.optionals ibusSupport [
# sdl3 only uses some constants of the ibus headers
# it never actually loads the library
# thus, it also does not have to care about gtk integration,
# so using ibusMinimal avoids an unnecessarily large closure here.
ibusMinimal
];
cmakeFlags = [
(lib.cmakeBool "SDL_ALSA" alsaSupport)
(lib.cmakeBool "SDL_DBUS" dbusSupport)
(lib.cmakeBool "SDL_IBUS" ibusSupport)
(lib.cmakeBool "SDL_JACK" jackSupport)
(lib.cmakeBool "SDL_KMSDRM" drmSupport)
(lib.cmakeBool "SDL_LIBUDEV" libudevSupport)
(lib.cmakeBool "SDL_OPENGL" openglSupport)
(lib.cmakeBool "SDL_PIPEWIRE" pipewireSupport)
(lib.cmakeBool "SDL_PULSEAUDIO" pulseaudioSupport)
(lib.cmakeBool "SDL_SNDIO" sndioSupport)
(lib.cmakeBool "SDL_TEST_LIBRARY" true)
(lib.cmakeBool "SDL_TRAY_DUMMY" (!traySupport))
(lib.cmakeBool "SDL_WAYLAND" waylandSupport)
(lib.cmakeBool "SDL_WAYLAND_LIBDECOR" libdecorSupport)
(lib.cmakeBool "SDL_X11" x11Support)
(lib.cmakeBool "SDL_TESTS" true)
(lib.cmakeBool "SDL_INSTALL_TESTS" true)
(lib.cmakeBool "SDL_DEPS_SHARED" false)
];
doCheck = true;
postInstall = ''
moveToOutput "share/installed-tests" "$installedTests"
moveToOutput "libexec/installed-tests" "$installedTests"
'';
passthru = {
# Building this in its own derivation to make sure the rpath hack above propagate to users
debug-text-example = stdenv.mkDerivation (finalAttrs': {
pname = "sdl3-debug-text-example";
inherit (finalAttrs) version src;
sourceRoot = "${finalAttrs'.src.name}/examples/renderer/18-debug-text";
nativeBuildInputs = [
installShellFiles
];
buildInputs = [ finalAttrs.finalPackage ];
postBuild = ''
$CC -lSDL3 -o debug-text{,.c}
'';
postInstall = ''
installBin debug-text
'';
meta = {
inherit (finalAttrs.meta) maintainers platforms;
mainProgram = "debug-text";
};
});
tests =
SDL_compat.tests
// sdl2-compat.tests
// {
inherit
SDL_compat
sdl2-compat
sdl3-image
sdl3-ttf
;
pkg-config = testers.hasPkgConfigModules { package = finalAttrs.finalPackage; };
inherit (finalAttrs.passthru) debug-text-example;
}
// lib.optionalAttrs stdenv.hostPlatform.isLinux {
nixosTest = nixosTests.sdl3;
};
updateScript = nix-update-script {
extraArgs = [
"--version-regex"
"release-(3\\..*)"
];
};
};
meta = {
description = "Cross-platform development library";
homepage = "https://libsdl.org";
changelog = "https://github.com/libsdl-org/SDL/releases/tag/${finalAttrs.src.tag}";
license = lib.licenses.zlib;
maintainers = with lib.maintainers; [ getchoo ];
teams = [ lib.teams.sdl ];
platforms = lib.platforms.unix ++ lib.platforms.windows;
pkgConfigModules = [ "sdl3" ];
};
})

View File

@@ -0,0 +1,40 @@
{
lib,
stdenvNoCC,
fetchFromGitHub,
unstableGitUpdater,
}:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "sdl_gamecontrollerdb";
version = "0-unstable-2025-09-13";
src = fetchFromGitHub {
owner = "mdqinc";
repo = "SDL_GameControllerDB";
rev = "38fc811c715365e963a6942092cae147eddddc90";
hash = "sha256-dyOzv9cloQuLOuq8CExXQxloNJ02VgoxWiBHeNrSZcA=";
};
dontBuild = true;
dontConfigure = true;
installPhase = ''
runHook preInstall
install -Dm644 gamecontrollerdb.txt -t $out/share
install -Dm644 LICENSE -t $out/share/licenses/sdl_gamecontrollerdb
runHook postInstall
'';
passthru.updateScript = unstableGitUpdater { };
meta = {
description = "Community sourced database of game controller mappings to be used with SDL2 and SDL3 Game Controller functionality";
homepage = "https://github.com/mdqinc/SDL_GameControllerDB";
license = lib.licenses.zlib;
maintainers = with lib.maintainers; [ qubitnano ];
platforms = lib.platforms.all;
};
})

View File

@@ -0,0 +1,27 @@
{
lib,
buildGoModule,
fetchFromGitHub,
}:
buildGoModule {
pname = "sdlookup";
version = "0-unstable-2022-03-10";
src = fetchFromGitHub {
owner = "j3ssie";
repo = "sdlookup";
rev = "8554bfa27284c4764401dbd8da23800d4ae968a2";
hash = "sha256-c6xAgOxle51waiFsSWvwO9eyt1KXuM0dEeepVsRQHkk=";
};
vendorHash = "sha256-j0UzucZ6kDwM+6U0ZyIW9u8XG/Bn+VUCO2vV1BbnQo0=";
meta = with lib; {
description = "IP lookups for open ports and vulnerabilities from internetdb.shodan.io";
mainProgram = "sdlookup";
homepage = "https://github.com/j3ssie/sdlookup";
license = with licenses; [ mit ];
maintainers = with maintainers; [ fab ];
};
}

View File

@@ -0,0 +1,91 @@
{
lib,
stdenv,
makeWrapper,
makeDesktopItem,
copyDesktopItems,
fetchFromGitHub,
pkg-config,
SDL2,
SDL2_image,
}:
stdenv.mkDerivation rec {
pname = "sdlpop";
version = "1.23";
src = fetchFromGitHub {
owner = "NagyD";
repo = "SDLPoP";
rev = "v${version}";
sha256 = "sha256-UI7NfOC/+druRYL5g2AhIjTPEq4ta1qEThcxgyrFjHY=";
};
nativeBuildInputs = [
pkg-config
makeWrapper
copyDesktopItems
];
buildInputs = [
SDL2
SDL2_image
];
makeFlags = [
"-C"
"src"
];
preBuild = ''
substituteInPlace src/Makefile \
--replace "CC = gcc" "CC = ${stdenv.cc.targetPrefix}cc" \
--replace "CFLAGS += -I/opt/local/include" "CFLAGS += -I${lib.getInclude SDL2}/include/SDL2 -I${SDL2_image}/include/SDL2"
'';
# The prince binary expects two things of the working directory it is called from:
# (1) There is a subdirectory "data" containing the level data.
# (2) The working directory is writable, so save and quicksave files can be created.
# Our solution is to ensure that ~/.local/share/sdlpop is the working
# directory, symlinking the data files into it. This is the task of the
# prince.sh wrapper.
installPhase = ''
runHook preInstall
install -Dm755 prince $out/bin/.prince-bin
substituteAll ${./prince.sh} $out/bin/prince
chmod +x $out/bin/prince
mkdir -p $out/share/sdlpop
cp -r data doc mods SDLPoP.ini $out/share/sdlpop
install -Dm755 data/icon.png $out/share/icons/hicolor/32x32/apps/sdlpop.png
runHook postInstall
'';
desktopItems = [
(makeDesktopItem {
name = "sdlpop";
icon = "sdlpop";
exec = "prince";
desktopName = "SDLPoP";
comment = "An open-source port of Prince of Persia";
categories = [
"Game"
"AdventureGame"
];
})
];
meta = {
description = "Open-source port of Prince of Persia";
homepage = "https://github.com/NagyD/SDLPoP";
changelog = "https://github.com/NagyD/SDLPoP/blob/v${version}/doc/ChangeLog.txt";
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ iblech ];
platforms = lib.platforms.unix;
mainProgram = "prince";
};
}

View File

@@ -0,0 +1,16 @@
#! @shell@
set -euo pipefail
mkdir -p ~/.local/share/sdlpop
cd ~/.local/share/sdlpop
for i in SDLPoP.ini mods; do
[ -e $i ] || cp -r @out@/share/sdlpop/$i .
done
# Create the data symlink or update it (in case it is a symlink, else the user
# has probably tinkered with it and does not want it to be recreated).
[ ! -e data -o -L data ] && ln -sf @out@/share/sdlpop/data .
exec -a "prince" @out@/bin/.prince-bin "$@"

View File

@@ -0,0 +1,22 @@
{
lib,
stdenv,
fetchurl,
}:
stdenv.mkDerivation rec {
pname = "sdparm";
version = "1.12";
src = fetchurl {
url = "http://sg.danny.cz/sg/p/${pname}-${version}.tar.xz";
sha256 = "sha256-xMnvr9vrZi4vlxJwfsSQkyvU0BC7ESmueplSZUburb4=";
};
meta = with lib; {
homepage = "http://sg.danny.cz/sg/sdparm.html";
description = "Utility to access SCSI device parameters";
license = licenses.bsd3;
platforms = with platforms; linux;
};
}

View File

@@ -0,0 +1,130 @@
{
lib,
stdenv,
airspy,
airspyhf,
apple-sdk_12,
aptdec,
boost,
cm256cc,
cmake,
codec2,
dab_lib,
dsdcc,
faad2,
fetchFromGitHub,
fftwFloat,
flac,
glew,
hackrf,
hidapi,
ffmpeg,
libiio,
libopus,
libpulseaudio,
libusb1,
limesuite,
libbladeRF,
mbelib,
ninja,
opencv4,
pkg-config,
qt6,
qt6Packages,
rtl-sdr,
serialdv,
sdrplay,
sgp4,
soapysdr-with-plugins,
uhd,
zlib,
withSDRplay ? false,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "sdrangel";
version = "7.22.9";
src = fetchFromGitHub {
owner = "f4exb";
repo = "sdrangel";
tag = "v${finalAttrs.version}";
hash = "sha256-VYSM9ldzx/8tWKQb++qGROSXdeEXIDhGqnnHUmkW4+k=";
};
nativeBuildInputs = [
cmake
ninja
pkg-config
qt6.wrapQtAppsHook
];
buildInputs = [
airspy
airspyhf
aptdec
boost
cm256cc
codec2
dab_lib
dsdcc
faad2
ffmpeg
fftwFloat
flac
glew
hackrf
hidapi
libbladeRF
libiio
libopus
libpulseaudio
libusb1
limesuite
mbelib
opencv4
qt6Packages.qt5compat
qt6Packages.qtcharts
qt6Packages.qtdeclarative
qt6Packages.qtlocation
qt6Packages.qtmultimedia
qt6Packages.qtscxml
qt6Packages.qtserialport
qt6Packages.qtspeech
qt6Packages.qttools
qt6Packages.qtwebsockets
qt6Packages.qtwebengine
rtl-sdr
serialdv
sgp4
soapysdr-with-plugins
uhd
zlib
]
++ lib.optionals stdenv.hostPlatform.isLinux [ qt6Packages.qtwayland ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_12 ]
++ lib.optionals withSDRplay [ sdrplay ];
cmakeFlags = [
"-DAPT_DIR=${aptdec}"
"-DDAB_DIR=${dab_lib}"
"-DSGP4_DIR=${sgp4}"
"-DSOAPYSDR_DIR=${soapysdr-with-plugins}"
"-Wno-dev"
"-DENABLE_QT6=ON"
];
meta = {
description = "Software defined radio (SDR) software";
homepage = "https://github.com/f4exb/sdrangel";
license = lib.licenses.gpl3Plus;
longDescription = ''
SDRangel is an Open Source Qt6 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
'';
maintainers = with lib.maintainers; [
alkeryn
Tungsten842
];
platforms = lib.platforms.unix;
};
})

View File

@@ -0,0 +1,56 @@
{
pname,
version,
src,
meta,
lib,
stdenv,
xar,
cpio,
libusb1,
fixDarwinDylibNames,
}:
stdenv.mkDerivation {
inherit
pname
version
src
meta
;
nativeBuildInputs = [
xar
cpio
fixDarwinDylibNames
];
unpackPhase = ''
xar -xf $src
zcat SDRplayAPI.pkg/Payload | cpio -i
'';
dontBuild = true;
env = {
majorVersion = lib.versions.major version;
majorMinorVersion = lib.versions.majorMinor version;
};
installPhase = ''
root="$PWD/Library/SDRplayAPI/${version}"
mkdir -p $out/{bin,lib}
cp "$root/bin/sdrplay_apiService" "$out/bin"
cp -r "$root/include" "$out/include"
lib="$out/lib/libsdrplay_api.$majorMinorVersion.dylib"
cp "$root/lib/libsdrplay_api.so.$majorMinorVersion" "$lib"
ln -s "$lib" "$out/lib/libsdrplay_api.$majorVersion.dylib"
ln -s "$lib" "$out/lib/libsdrplay_api.dylib"
'';
postFixup = ''
install_name_tool -add_rpath "${lib.getLib libusb1}/lib" $out/bin/sdrplay_apiService
'';
}

View File

@@ -0,0 +1,54 @@
{
pname,
version,
src,
meta,
stdenv,
lib,
fetchurl,
autoPatchelfHook,
udev,
libusb1,
}:
let
arch = stdenv.hostPlatform.qemuArch;
in
stdenv.mkDerivation rec {
inherit
pname
version
src
meta
;
nativeBuildInputs = [ autoPatchelfHook ];
buildInputs = [
libusb1
udev
(lib.getLib stdenv.cc.cc)
];
unpackPhase = ''
sh "$src" --noexec --target source
'';
sourceRoot = "source";
dontBuild = true;
env = {
majorVersion = lib.versions.major version;
majorMinorVersion = lib.versions.majorMinor version;
};
installPhase = ''
mkdir -p $out/{bin,lib,include}
libName="libsdrplay_api"
cp "${arch}/$libName.so.$majorMinorVersion" $out/lib/
ln -s "$out/lib/$libName.so.$majorMinorVersion" "$out/lib/$libName.so.$majorVersion"
ln -s "$out/lib/$libName.so.$majorVersion" "$out/lib/$libName.so"
cp "${arch}/sdrplay_apiService" $out/bin/
cp -r inc/* $out/include/
'';
}

View File

@@ -0,0 +1,67 @@
{
callPackage,
fetchurl,
stdenv,
lib,
}:
let
version = "3.15.1";
sources = rec {
x86_64-linux = {
url = "https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-${version}.run";
hash = "sha256-CTcyv10Xz9G2LqHh4qOW9tKBEcB+rztE2R7xJIU4QBQ=";
};
x86_64-darwin = {
url = "https://www.sdrplay.com/software/SDRplayAPI-macos-installer-universal-3.15.1.pkg";
hash = "sha256-XRSM7aH653XS0t9bP89G3uJ7YiLiU1xMBjwvLqL3rMM=";
};
aarch64-linux = x86_64-linux;
aarch64-darwin = x86_64-darwin;
};
platforms = lib.attrNames sources;
package = if stdenv.hostPlatform.isLinux then ./linux.nix else ./darwin.nix;
in
callPackage package {
pname = "sdrplay";
inherit version;
src =
let
inherit (stdenv.hostPlatform) system;
source =
if lib.hasAttr system sources then
sources."${system}"
else
throw "SDRplay is not supported on ${system}";
in
fetchurl source;
meta = with lib; {
inherit platforms;
description = "SDRplay API";
longDescription = ''
Proprietary library and api service for working with SDRplay devices. For documentation and licensing details see
https://www.sdrplay.com/docs/SDRplay_API_Specification_v${lib.concatStringsSep "." (lib.take 2 (builtins.splitVersion version))}.pdf
'';
homepage = "https://www.sdrplay.com/downloads/";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
maintainers = with maintainers; [
pmenke
zaninime
];
mainProgram = "sdrplay_apiService";
};
}

View File

@@ -0,0 +1,182 @@
{
stdenv,
lib,
fetchFromGitHub,
cmake,
pkg-config,
libX11,
glfw,
glew,
fftwFloat,
volk,
zstd,
# Sources
airspy_source ? true,
airspy,
airspyhf_source ? true,
airspyhf,
bladerf_source ? true,
libbladeRF,
file_source ? true,
hackrf_source ? true,
hackrf,
limesdr_source ? true,
limesuite,
perseus_source ? false, # needs libperseus-sdr, not yet available in nixpks
plutosdr_source ? stdenv.hostPlatform.isLinux,
libiio,
libad9361,
rfspace_source ? true,
rtl_sdr_source ? true,
rtl-sdr-osmocom,
libusb1, # osmocom better w/ rtlsdr v4
rtl_tcp_source ? true,
sdrplay_source ? false,
sdrplay,
soapy_source ? true,
soapysdr-with-plugins,
spyserver_source ? true,
usrp_source ? false,
uhd,
boost,
# Sinks
audio_sink ? true,
rtaudio,
network_sink ? true,
portaudio_sink ? false,
portaudio,
# Decoders
falcon9_decoder ? false,
m17_decoder ? false,
codec2,
meteor_demodulator ? true,
radio ? true,
weather_sat_decoder ? false, # is missing some dsp/pll.h
# Misc
discord_presence ? true,
frequency_manager ? true,
recorder ? true,
rigctl_server ? true,
scanner ? true,
}:
stdenv.mkDerivation rec {
pname = "sdrpp";
# SDR++ uses a rolling release model.
# Choose a git hash from head and use the date from that commit as
# version qualifier
git_hash = "27ab5bf3c194169ddf60ca312723fce96149cc8e";
git_date = "2024-01-22";
version = "1.1.0-unstable-" + git_date;
src = fetchFromGitHub {
owner = "AlexandreRouma";
repo = "SDRPlusPlus";
rev = git_hash;
hash = "sha256-R4xWeqdHEAaje37VQaGlg+L2iYIOH4tXMHvZkZq4SDU=";
};
patches = [ ./runtime-prefix.patch ];
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace "/usr/share" "share" \
--replace "set(CMAKE_INSTALL_PREFIX" "#set(CMAKE_INSTALL_PREFIX"
substituteInPlace decoder_modules/m17_decoder/src/m17dsp.h \
--replace "codec2.h" "codec2/codec2.h"
# Since the __TIME_ and __DATE__ is canonicalized in the build,
# use our qualified version shown in the programs window title.
substituteInPlace core/src/version.h --replace "1.1.0" "$version"
'';
nativeBuildInputs = [
cmake
pkg-config
];
buildInputs = [
glfw
glew
fftwFloat
volk
zstd
]
++ lib.optional stdenv.hostPlatform.isLinux libX11
++ lib.optional airspy_source airspy
++ lib.optional airspyhf_source airspyhf
++ lib.optional bladerf_source libbladeRF
++ lib.optional hackrf_source hackrf
++ lib.optional limesdr_source limesuite
++ lib.optionals rtl_sdr_source [
rtl-sdr-osmocom
libusb1
]
++ lib.optional sdrplay_source sdrplay
++ lib.optional soapy_source soapysdr-with-plugins
++ lib.optionals plutosdr_source [
libiio
libad9361
]
++ lib.optionals usrp_source [
uhd
boost
]
++ lib.optional audio_sink rtaudio
++ lib.optional portaudio_sink portaudio
++ lib.optional m17_decoder codec2;
cmakeFlags = [
# Sources
(lib.cmakeBool "OPT_BUILD_AIRSPYHF_SOURCE" airspyhf_source)
(lib.cmakeBool "OPT_BUILD_AIRSPY_SOURCE" airspy_source)
(lib.cmakeBool "OPT_BUILD_BLADERF_SOURCE" bladerf_source)
(lib.cmakeBool "OPT_BUILD_FILE_SOURCE" file_source)
(lib.cmakeBool "OPT_BUILD_HACKRF_SOURCE" hackrf_source)
(lib.cmakeBool "OPT_BUILD_LIMESDR_SOURCE" limesdr_source)
(lib.cmakeBool "OPT_BUILD_PERSEUS_SOURCE" perseus_source)
(lib.cmakeBool "OPT_BUILD_PLUTOSDR_SOURCE" plutosdr_source)
(lib.cmakeBool "OPT_BUILD_RFSPACE_SOURCE" rfspace_source)
(lib.cmakeBool "OPT_BUILD_RTL_SDR_SOURCE" rtl_sdr_source)
(lib.cmakeBool "OPT_BUILD_RTL_TCP_SOURCE" rtl_tcp_source)
(lib.cmakeBool "OPT_BUILD_SDRPLAY_SOURCE" sdrplay_source)
(lib.cmakeBool "OPT_BUILD_SOAPY_SOURCE" soapy_source)
(lib.cmakeBool "OPT_BUILD_SPYSERVER_SOURCE" spyserver_source)
(lib.cmakeBool "OPT_BUILD_USRP_SOURCE" usrp_source)
# Sinks
(lib.cmakeBool "OPT_BUILD_AUDIO_SINK" audio_sink)
(lib.cmakeBool "OPT_BUILD_NETWORK_SINK" network_sink)
(lib.cmakeBool "OPT_BUILD_NEW_PORTAUDIO_SINK" portaudio_sink)
# Decoders
(lib.cmakeBool "OPT_BUILD_FALCON9_DECODER" falcon9_decoder)
(lib.cmakeBool "OPT_BUILD_M17_DECODER" m17_decoder)
(lib.cmakeBool "OPT_BUILD_METEOR_DEMODULATOR" meteor_demodulator)
(lib.cmakeBool "OPT_BUILD_RADIO" radio)
(lib.cmakeBool "OPT_BUILD_WEATHER_SAT_DECODER" weather_sat_decoder)
# Misc
(lib.cmakeBool "OPT_BUILD_DISCORD_PRESENCE" discord_presence)
(lib.cmakeBool "OPT_BUILD_FREQUENCY_MANAGER" frequency_manager)
(lib.cmakeBool "OPT_BUILD_RECORDER" recorder)
(lib.cmakeBool "OPT_BUILD_RIGCTL_SERVER" rigctl_server)
(lib.cmakeBool "OPT_BUILD_SCANNER" scanner)
];
env.NIX_CFLAGS_COMPILE = "-fpermissive";
hardeningDisable = lib.optional stdenv.cc.isClang "format";
meta = with lib; {
description = "Cross-Platform SDR Software";
homepage = "https://github.com/AlexandreRouma/SDRPlusPlus";
license = licenses.gpl3Only;
platforms = platforms.unix;
maintainers = with maintainers; [ sikmir ];
mainProgram = "sdrpp";
};
}

View File

@@ -0,0 +1,60 @@
From a80a739163d2013ec400223a68a387f4f9297b2a Mon Sep 17 00:00:00 2001
From: Nikolay Korotkiy <sikmir@gmail.com>
Date: Fri, 29 Oct 2021 01:38:21 +0300
Subject: [PATCH] Fix sdrpp breaking every time the package is rebuilt.
On NixOS, the INSTALL_PREFIX changes on every rebuild to the package, but sdrpp
fills it in as part of the default config and then installs that config
to the users home folder. Fix this by not substituting @INSTALL_PREFIX@ in the
default config until runtime.
---
core/src/core.cpp | 8 ++++++--
core/src/gui/main_window.cpp | 6 ++++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/core/src/core.cpp b/core/src/core.cpp
index 9546e60..98d6065 100644
--- a/core/src/core.cpp
+++ b/core/src/core.cpp
@@ -242,8 +242,8 @@ int sdrpp_main(int argc, char *argv[]) {
defConfig["modulesDirectory"] = "./modules";
defConfig["resourcesDirectory"] = "./res";
#else
- defConfig["modulesDirectory"] = INSTALL_PREFIX "/lib/sdrpp/plugins";
- defConfig["resourcesDirectory"] = INSTALL_PREFIX "/share/sdrpp";
+ defConfig["modulesDirectory"] = "@prefix@/lib/sdrpp/plugins";
+ defConfig["resourcesDirectory"] = "@prefix@/share/sdrpp";
#endif
// Load config
@@ -290,6 +290,10 @@ int sdrpp_main(int argc, char *argv[]) {
int winHeight = core::configManager.conf["windowSize"]["h"];
maximized = core::configManager.conf["maximized"];
std::string resDir = core::configManager.conf["resourcesDirectory"];
+ {
+ std::size_t pos = resDir.find("@prefix@");
+ if (pos != std::string::npos) resDir.replace(pos, 8, INSTALL_PREFIX);
+ }
json bandColors = core::configManager.conf["bandColors"];
core::configManager.release();
diff --git a/core/src/gui/main_window.cpp b/core/src/gui/main_window.cpp
index 954dbd6..52f0eed 100644
--- a/core/src/gui/main_window.cpp
+++ b/core/src/gui/main_window.cpp
@@ -44,6 +44,12 @@ void MainWindow::init() {
json menuElements = core::configManager.conf["menuElements"];
std::string modulesDir = core::configManager.conf["modulesDirectory"];
std::string resourcesDir = core::configManager.conf["resourcesDirectory"];
+ {
+ std::size_t pos = modulesDir.find("@prefix@");
+ if (pos != std::string::npos) modulesDir.replace(pos, 8, INSTALL_PREFIX);
+ pos = resourcesDir.find("@prefix@");
+ if (pos != std::string::npos) resourcesDir.replace(pos, 8, INSTALL_PREFIX);
+ }
core::configManager.release();
// Load menu elements
--
2.33.0