mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-06 04:53:27 +00:00
e0464e4788
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" ```
71 lines
1.5 KiB
Nix
71 lines
1.5 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchFromGitHub,
|
|
blas,
|
|
lapack,
|
|
gfortran,
|
|
fixDarwinDylibNames,
|
|
nix-update-script,
|
|
}:
|
|
|
|
assert (!blas.isILP64) && (!lapack.isILP64);
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "scs";
|
|
version = "3.2.7";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "cvxgrp";
|
|
repo = "scs";
|
|
rev = "refs/tags/${version}";
|
|
hash = "sha256-Y28LrYUuDaXPO8sce1pJIfG3A03rw7BumVgxCIKRn+U=";
|
|
};
|
|
|
|
# Actually link and add libgfortran to the rpath
|
|
postPatch = ''
|
|
substituteInPlace scs.mk \
|
|
--replace "#-lgfortran" "-lgfortran" \
|
|
--replace "gcc" "cc"
|
|
'';
|
|
|
|
nativeBuildInputs = lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
|
|
|
|
buildInputs = [
|
|
blas
|
|
lapack
|
|
gfortran.cc.lib
|
|
];
|
|
|
|
doCheck = true;
|
|
|
|
# Test demo requires passing data and seed; numbers chosen arbitrarily.
|
|
postCheck = ''
|
|
./out/demo_socp_indirect 42 0.42 0.42 42
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
mkdir -p $out/lib
|
|
cp -r include $out/
|
|
cp out/*.a out/*.so out/*.dylib $out/lib/
|
|
runHook postInstall
|
|
'';
|
|
|
|
passthru = {
|
|
updateScript = nix-update-script { };
|
|
};
|
|
|
|
meta = {
|
|
description = "Splitting Conic Solver";
|
|
longDescription = ''
|
|
Numerical optimization package for solving large-scale convex cone problems
|
|
'';
|
|
homepage = "https://github.com/cvxgrp/scs";
|
|
changelog = "https://github.com/cvxgrp/scs/releases/tag/${version}";
|
|
license = lib.licenses.mit;
|
|
platforms = lib.platforms.all;
|
|
maintainers = with lib.maintainers; [ bhipple ];
|
|
};
|
|
}
|