From 809ecca039565e75d20653ef1a049fd2fefb4676 Mon Sep 17 00:00:00 2001 From: azahi Date: Wed, 2 Apr 2025 22:11:53 +0300 Subject: [PATCH 1/2] gsl-lite: 0.41.0 -> 0.42.0 --- pkgs/by-name/gs/gsl-lite/package.nix | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/pkgs/by-name/gs/gsl-lite/package.nix b/pkgs/by-name/gs/gsl-lite/package.nix index dba428c51a0e..caa8c9f3c6e6 100644 --- a/pkgs/by-name/gs/gsl-lite/package.nix +++ b/pkgs/by-name/gs/gsl-lite/package.nix @@ -2,7 +2,6 @@ lib, stdenv, fetchFromGitHub, - fetchpatch, cmake, ninja, installCompatHeader ? false, @@ -11,23 +10,15 @@ stdenv.mkDerivation rec { pname = "gsl-lite"; - version = "0.41.0"; + version = "0.42.0"; src = fetchFromGitHub { owner = "gsl-lite"; repo = "gsl-lite"; rev = "v${version}"; - hash = "sha256-cuuix302bVA7dWa7EJoxJ+otf1rSzjWQK8DHJsVkQio="; + hash = "sha256-4CQG+sX/UTQ4zICmDR6YBfapuh0hSqkWk5skZAVAy2o="; }; - patches = [ - (fetchpatch { - name = "type-limits-cast-fix.patch"; - url = "https://github.com/gsl-lite/gsl-lite/commit/13475be0e5bf5f464c398f4a07ef5c7684bc57c5.patch"; - hash = "sha256-rSz7OBmgQ3KcQ971tS3Z3QNC+U4XmrPjgmuOyG7J6Bo="; - }) - ]; - nativeBuildInputs = [ cmake ninja From 0c1a2761e96fe55a5964d9d268becc28f5337694 Mon Sep 17 00:00:00 2001 From: azahi Date: Wed, 2 Apr 2025 22:18:42 +0300 Subject: [PATCH 2/2] gsl-lite: refactor --- pkgs/by-name/gs/gsl-lite/package.nix | 34 ++++++++++++---------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/pkgs/by-name/gs/gsl-lite/package.nix b/pkgs/by-name/gs/gsl-lite/package.nix index caa8c9f3c6e6..ba49c51a410b 100644 --- a/pkgs/by-name/gs/gsl-lite/package.nix +++ b/pkgs/by-name/gs/gsl-lite/package.nix @@ -7,15 +7,14 @@ installCompatHeader ? false, installLegacyHeaders ? false, }: - -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "gsl-lite"; version = "0.42.0"; src = fetchFromGitHub { owner = "gsl-lite"; repo = "gsl-lite"; - rev = "v${version}"; + tag = "v${finalAttrs.version}"; hash = "sha256-4CQG+sX/UTQ4zICmDR6YBfapuh0hSqkWk5skZAVAy2o="; }; @@ -24,22 +23,17 @@ stdenv.mkDerivation rec { ninja ]; - cmakeFlags = - lib.mapAttrsToList (name: value: ''-DGSL_LITE_OPT_${name}:BOOL=${if value then "ON" else "OFF"}'') - { - INSTALL_COMPAT_HEADER = installCompatHeader; - INSTALL_LEGACY_HEADERS = installLegacyHeaders; - BUILD_TESTS = doCheck; - }; + cmakeFlags = [ + (lib.cmakeBool "GSL_LITE_OPT_BUILD_TESTS" finalAttrs.doCheck) + (lib.cmakeBool "GSL_LITE_OPT_INSTALL_COMPAT_HEADER" installCompatHeader) + (lib.cmakeBool "GSL_LITE_OPT_INSTALL_LEGACY_HEADERS" installLegacyHeaders) + ]; # Building tests is broken on Darwin. doCheck = !stdenv.hostPlatform.isDarwin; - meta = with lib; { - description = '' - A single-file header-only version of ISO C++ Guidelines Support Library - (GSL) for C++98, C++11, and later - ''; + meta = { + description = "Single-file header-only version of ISO C++ GSL"; longDescription = '' gsl-lite is a single-file header-only implementation of the C++ Core Guidelines Support Library originally based on Microsoft GSL and adapted @@ -47,9 +41,9 @@ stdenv.mkDerivation rec { C++20. ''; homepage = "https://github.com/gsl-lite/gsl-lite"; - changelog = "https://github.com/gsl-lite/gsl-lite/blob/${src.rev}/CHANGES.txt"; - license = licenses.mit; - maintainers = with maintainers; [ azahi ]; - platforms = platforms.all; + changelog = "https://github.com/gsl-lite/gsl-lite/blob/${finalAttrs.src.rev}/CHANGES.txt"; + license = lib.licenses.mit; + maintainers = [ lib.maintainers.azahi ]; + platforms = lib.platforms.all; }; -} +})