From 738d25b858291bb64f73c43d5c9379cfb7e11f47 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Fri, 26 Apr 2024 13:31:55 -0300 Subject: [PATCH 1/3] SDL2_net: migrate to by-name --- .../SDL2_net/default.nix => by-name/sd/SDL2_net/package.nix} | 0 pkgs/top-level/all-packages.nix | 2 -- 2 files changed, 2 deletions(-) rename pkgs/{development/libraries/SDL2_net/default.nix => by-name/sd/SDL2_net/package.nix} (100%) diff --git a/pkgs/development/libraries/SDL2_net/default.nix b/pkgs/by-name/sd/SDL2_net/package.nix similarity index 100% rename from pkgs/development/libraries/SDL2_net/default.nix rename to pkgs/by-name/sd/SDL2_net/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c0054b6f0a94..925ad531af7d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24337,8 +24337,6 @@ with pkgs; # SDL2_mixer_2_0 pinned for lzwolf SDL2_mixer_2_0 = callPackage ../development/libraries/SDL2_mixer/2_0.nix { }; - SDL2_net = callPackage ../development/libraries/SDL2_net { }; - SDL2_gfx = callPackage ../development/libraries/SDL2_gfx { }; SDL2_sound = callPackage ../development/libraries/SDL2_sound { From 922be032e50087a60bf6b878c196ef692d62ff0d Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Wed, 1 May 2024 15:40:55 -0300 Subject: [PATCH 2/3] SDL2_net: adopted by AndersonTorres --- pkgs/by-name/sd/SDL2_net/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/sd/SDL2_net/package.nix b/pkgs/by-name/sd/SDL2_net/package.nix index 1640c5e3b86b..83840a4eada6 100644 --- a/pkgs/by-name/sd/SDL2_net/package.nix +++ b/pkgs/by-name/sd/SDL2_net/package.nix @@ -24,7 +24,7 @@ stdenv.mkDerivation rec { description = "SDL multiplatform networking library"; homepage = "https://www.libsdl.org/projects/SDL_net"; license = licenses.zlib; - maintainers = with maintainers; [ ]; + maintainers = with maintainers; [ AndersonTorres ]; platforms = platforms.unix; }; } From a13158505e39fc3622f7a4ed07fafcfb0f49d220 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Fri, 26 Apr 2024 13:59:54 -0300 Subject: [PATCH 3/3] SDL2_net: refactor - finalAttrs - use fetchFromGitHub (since the url is deactivated) - strictDeps - no nested with --- pkgs/by-name/sd/SDL2_net/package.nix | 52 +++++++++++++++++++--------- 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/pkgs/by-name/sd/SDL2_net/package.nix b/pkgs/by-name/sd/SDL2_net/package.nix index 83840a4eada6..79e0e0098623 100644 --- a/pkgs/by-name/sd/SDL2_net/package.nix +++ b/pkgs/by-name/sd/SDL2_net/package.nix @@ -1,30 +1,50 @@ -{ lib, stdenv, pkg-config, darwin, fetchurl, SDL2 }: +{ + lib, + SDL2, + darwin, + fetchFromGitHub, + pkg-config, + stdenv, + # Boolean flags + enableSdltest ? (!stdenv.isDarwin), +}: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "SDL2_net"; version = "2.2.0"; - src = fetchurl { - url = "https://www.libsdl.org/projects/SDL_net/release/${pname}-${version}.tar.gz"; - sha256 = "sha256-TkqJGYgxYnGXT/TpWF7R73KaEj0iwIvUcxKRedyFf+s="; + src = fetchFromGitHub { + owner = "libsdl-org"; + repo = "SDL_net"; + rev = "release-${finalAttrs.version}"; + hash = "sha256-sEcKn/apA6FcR7ijb7sfuvP03ZdVfjkNZTXsasK8fAI="; }; outputs = [ "out" "dev" ]; - nativeBuildInputs = [ pkg-config ]; + nativeBuildInputs = [ + SDL2 + pkg-config + ]; - buildInputs = lib.optional stdenv.isDarwin darwin.libobjc; - - configureFlags = [ "--disable-examples" ] - ++ lib.optional stdenv.isDarwin "--disable-sdltest"; + buildInputs = lib.optionals stdenv.isDarwin [ + darwin.libobjc + ]; propagatedBuildInputs = [ SDL2 ]; - meta = with lib; { + 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"; - homepage = "https://www.libsdl.org/projects/SDL_net"; - license = licenses.zlib; - maintainers = with maintainers; [ AndersonTorres ]; - platforms = platforms.unix; + license = lib.licenses.zlib; + maintainers = with lib.maintainers; [ AndersonTorres ]; + inherit (SDL2.meta) platforms; }; -} +})