nixpkgs/pkgs/by-name/mi/microsoft-gsl/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

51 lines
1.4 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, cmake
, gtest
, pkg-config
}:
stdenv.mkDerivation rec {
pname = "microsoft-gsl";
version = "4.0.0";
src = fetchFromGitHub {
owner = "Microsoft";
repo = "GSL";
rev = "v${version}";
hash = "sha256-cXDFqt2KgMFGfdh6NGE+JmP4R0Wm9LNHM0eIblYe6zU=";
};
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = [ gtest ];
# error: unsafe buffer access
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-unsafe-buffer-usage";
patches = [
# nvcc doesn't recognize the "gsl" attribute namespace (microsoft/onnxruntime#13573)
# only affects nvcc
(fetchpatch {
url = "https://raw.githubusercontent.com/microsoft/onnxruntime/4bfa69def85476b33ccfaf68cf070f3fb65d39f7/cmake/patches/gsl/1064.patch";
hash = "sha256-0jESA+VENWQms9HGE0jRiZZuWLJehBlbArxSaQbYOrM=";
})
];
doCheck = true;
meta = with lib; {
description = "C++ Core Guideline support library";
longDescription = ''
The Guideline Support Library (GSL) contains functions and types that are suggested for
use by the C++ Core Guidelines maintained by the Standard C++ Foundation.
This package contains Microsoft's implementation of GSL.
'';
homepage = "https://github.com/Microsoft/GSL";
license = licenses.mit;
platforms = platforms.all;
maintainers = with maintainers; [ thoughtpolice yuriaisaka ];
};
}