nixpkgs/pkgs/by-name/su/superscs/package.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

45 lines
987 B
Nix

{
blas,
lapack,
lib,
fetchFromGitHub,
stdenv,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "superscs";
version = "1.3.3";
src = fetchFromGitHub {
owner = "kul-optec";
repo = "superscs";
#rev = "v${finalAttrs.version}";
# ref. https://github.com/kul-optec/superscs/pull/38
rev = "500070e807f92347a7c6cbdc96739521a256b71e";
hash = "sha256-Qu7RM6Ew4hEmoIXO0utDDVmjmNX3yt3FxWZXCQ/Xjp4=";
};
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace Makefile --replace-fail \
".so" \
".dylib"
'';
buildInputs = [
blas
lapack
];
makeFlags = [ "PREFIX=$(out)" ];
doCheck = true;
meta = {
description = "Fast conic optimization in C";
homepage = "https://github.com/kul-optec/superscs";
changelog = "https://github.com/kul-optec/superscs/blob/${finalAttrs.src.rev}/CHANGELOG.md";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ nim65s ];
};
})