nix fuckery
This commit is contained in:
parent
1b49477c4e
commit
017aadcf35
7 changed files with 159 additions and 79 deletions
|
|
@ -0,0 +1,30 @@
|
|||
From 1999109df34e67ed7c34d2b6b42f59feafc22bf1 Mon Sep 17 00:00:00 2001
|
||||
From: seth <getchoo@tuta.io>
|
||||
Date: Fri, 12 Jul 2024 21:59:14 -0400
|
||||
Subject: [PATCH] cmake: use `FULL` install directory variants in pkg-config
|
||||
file
|
||||
|
||||
Instead of manually prepending the install prefix to
|
||||
`CMAKE_INSTALL_<dir>` (which may already be an absolute path), we can
|
||||
let cmake do it for us
|
||||
---
|
||||
cmake/sdl3.pc.in | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/cmake/sdl3.pc.in b/cmake/sdl3.pc.in
|
||||
index bfc2afffe..3724d6cf8 100644
|
||||
--- a/cmake/sdl3.pc.in
|
||||
+++ b/cmake/sdl3.pc.in
|
||||
@@ -1,7 +1,7 @@
|
||||
prefix=@SDL_PKGCONFIG_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
-libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
|
||||
-includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
|
||||
+libdir=@CMAKE_INSTALL_FULL_LIBDIR@
|
||||
+includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
|
||||
|
||||
Name: sdl3
|
||||
Description: Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer.
|
||||
--
|
||||
2.45.2
|
||||
|
||||
95
nix/packages/SDL3/default.nix
Normal file
95
nix/packages/SDL3/default.nix
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
alsa-lib,
|
||||
cmake,
|
||||
darwin,
|
||||
dbus,
|
||||
fcitx5,
|
||||
libdecor,
|
||||
libdrm,
|
||||
libjack2,
|
||||
libpulseaudio,
|
||||
libxkbcommon,
|
||||
mesa,
|
||||
nas,
|
||||
ninja,
|
||||
pipewire,
|
||||
sndio,
|
||||
systemdLibs,
|
||||
testers,
|
||||
validatePkgConfig,
|
||||
wayland,
|
||||
xorg,
|
||||
}:
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "sdl3";
|
||||
version = "3.1.2-unstable-2024-08-01";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "libsdl-org";
|
||||
repo = "SDL";
|
||||
rev = "f01d4278c66e065e64bc934cd01e4f2952f613d7";
|
||||
hash = "sha256-ok3ortmy5dm3zZdH+3tAvOIRDrDxDDXBjxBC3nGdHDM=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# Case of https://github.com/NixOS/nixpkgs/issues/144170
|
||||
# Remove if/when https://github.com/libsdl-org/SDL/pull/10246 is merged
|
||||
./0001-cmake-use-FULL-install-directory-variants-in-pkg-con.patch
|
||||
];
|
||||
|
||||
outputs = [
|
||||
"lib"
|
||||
"dev"
|
||||
"out"
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
ninja
|
||||
validatePkgConfig
|
||||
];
|
||||
|
||||
buildInputs =
|
||||
lib.optionals stdenv.isLinux [
|
||||
alsa-lib
|
||||
dbus
|
||||
fcitx5
|
||||
libdecor
|
||||
libdrm
|
||||
libjack2
|
||||
libpulseaudio
|
||||
mesa # libgbm
|
||||
nas # libaudo
|
||||
pipewire
|
||||
sndio
|
||||
systemdLibs # libudev
|
||||
|
||||
# SDL_VIDEODRIVER=wayland
|
||||
wayland
|
||||
|
||||
# SDL_VIDEODRIVER=x11
|
||||
libxkbcommon
|
||||
xorg.libX11
|
||||
xorg.libXcursor
|
||||
xorg.libXext
|
||||
xorg.libXfixes
|
||||
xorg.libXi
|
||||
xorg.libXrandr
|
||||
]
|
||||
++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [Cocoa]);
|
||||
|
||||
passthru = {
|
||||
tests.pkg-config = testers.hasPkgConfigModules {package = finalAttrs.finalPackage;};
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Cross-platform development library (Pre-release version)";
|
||||
homepage = "https://libsdl.org";
|
||||
license = lib.licenses.zlib;
|
||||
maintainers = with lib.maintainers; [getchoo];
|
||||
pkgConfigModules = ["sdl3"];
|
||||
};
|
||||
})
|
||||
11
nix/packages/cursed-libcxx-stdenv/default.nix
Normal file
11
nix/packages/cursed-libcxx-stdenv/default.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{llvmPackages_19, ...}: let
|
||||
cursed-libcxx-stdenv = llvmPackages_19.libcxxStdenv.overrideAttrs (oa: {
|
||||
postFixup =
|
||||
(oa.postFixup or "")
|
||||
+ ''
|
||||
ln -sf ${llvmPackages_19.libcxx}/lib/libc++.modules.json $out/resource-root/libc++.modules.json
|
||||
ln -sf ${llvmPackages_19.libcxx}/share $out
|
||||
'';
|
||||
});
|
||||
in
|
||||
cursed-libcxx-stdenv
|
||||
64
nix/packages/gooey/default.nix
Normal file
64
nix/packages/gooey/default.nix
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
{
|
||||
self,
|
||||
sdl3, # from self.packages
|
||||
lib,
|
||||
fetchurl,
|
||||
cmake,
|
||||
ninja,
|
||||
llvmPackages_19,
|
||||
...
|
||||
}: let
|
||||
pname = "gooey";
|
||||
version = "0.0.1";
|
||||
in
|
||||
llvmPackages_19.libcxxStdenv.mkDerivation {
|
||||
inherit pname version;
|
||||
src = builtins.path {
|
||||
# reproducible source path
|
||||
path = self;
|
||||
name = "${pname}-${version}";
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
strictDeps = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
ninja
|
||||
(cmake.overrideAttrs {
|
||||
version = "3.30.4";
|
||||
src = let
|
||||
cmake-version = "3.30.4";
|
||||
in
|
||||
fetchurl {
|
||||
url = "https://cmake.org/files/v${lib.versions.majorMinor cmake-version}/cmake-${cmake-version}.tar.gz";
|
||||
hash = "sha256-x1nJcnTx56qq/LHw0mH53pvzpdbst+LfYWMkpG/nBLI=";
|
||||
};
|
||||
})
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
sdl3
|
||||
llvmPackages_19.clang-tools
|
||||
];
|
||||
|
||||
configurePhase = ''
|
||||
runHook preConfigure
|
||||
cmake -GNinja .
|
||||
runHook postConfiguree
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
ninja
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/bin
|
||||
mv gooey $out/bin
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
||||
Reference in a new issue