Skip to content

Commit 0c1a276

Browse files
committed
gsl-lite: refactor
1 parent 809ecca commit 0c1a276

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

pkgs/by-name/gs/gsl-lite/package.nix

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@
77
installCompatHeader ? false,
88
installLegacyHeaders ? false,
99
}:
10-
11-
stdenv.mkDerivation rec {
10+
stdenv.mkDerivation (finalAttrs: {
1211
pname = "gsl-lite";
1312
version = "0.42.0";
1413

1514
src = fetchFromGitHub {
1615
owner = "gsl-lite";
1716
repo = "gsl-lite";
18-
rev = "v${version}";
17+
tag = "v${finalAttrs.version}";
1918
hash = "sha256-4CQG+sX/UTQ4zICmDR6YBfapuh0hSqkWk5skZAVAy2o=";
2019
};
2120

@@ -24,32 +23,27 @@ stdenv.mkDerivation rec {
2423
ninja
2524
];
2625

27-
cmakeFlags =
28-
lib.mapAttrsToList (name: value: ''-DGSL_LITE_OPT_${name}:BOOL=${if value then "ON" else "OFF"}'')
29-
{
30-
INSTALL_COMPAT_HEADER = installCompatHeader;
31-
INSTALL_LEGACY_HEADERS = installLegacyHeaders;
32-
BUILD_TESTS = doCheck;
33-
};
26+
cmakeFlags = [
27+
(lib.cmakeBool "GSL_LITE_OPT_BUILD_TESTS" finalAttrs.doCheck)
28+
(lib.cmakeBool "GSL_LITE_OPT_INSTALL_COMPAT_HEADER" installCompatHeader)
29+
(lib.cmakeBool "GSL_LITE_OPT_INSTALL_LEGACY_HEADERS" installLegacyHeaders)
30+
];
3431

3532
# Building tests is broken on Darwin.
3633
doCheck = !stdenv.hostPlatform.isDarwin;
3734

38-
meta = with lib; {
39-
description = ''
40-
A single-file header-only version of ISO C++ Guidelines Support Library
41-
(GSL) for C++98, C++11, and later
42-
'';
35+
meta = {
36+
description = "Single-file header-only version of ISO C++ GSL";
4337
longDescription = ''
4438
gsl-lite is a single-file header-only implementation of the C++ Core
4539
Guidelines Support Library originally based on Microsoft GSL and adapted
4640
for C++98, C++03. It also works when compiled as C++11, C++14, C++17,
4741
C++20.
4842
'';
4943
homepage = "https://github.com/gsl-lite/gsl-lite";
50-
changelog = "https://github.com/gsl-lite/gsl-lite/blob/${src.rev}/CHANGES.txt";
51-
license = licenses.mit;
52-
maintainers = with maintainers; [ azahi ];
53-
platforms = platforms.all;
44+
changelog = "https://github.com/gsl-lite/gsl-lite/blob/${finalAttrs.src.rev}/CHANGES.txt";
45+
license = lib.licenses.mit;
46+
maintainers = [ lib.maintainers.azahi ];
47+
platforms = lib.platforms.all;
5448
};
55-
}
49+
})

0 commit comments

Comments
 (0)