nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 blas,
6 lapack,
7 gfortran,
8 fixDarwinDylibNames,
9 nix-update-script,
10 python3Packages,
11}:
12
13assert (!blas.isILP64) && (!lapack.isILP64);
14
15stdenv.mkDerivation (finalAttrs: {
16 pname = "scs";
17 version = "3.2.11";
18
19 src = fetchFromGitHub {
20 owner = "cvxgrp";
21 repo = "scs";
22 tag = finalAttrs.version;
23 hash = "sha256-hF5BxCLscyUmNXIVFIAAjY0GDbcH7WjODC4116aQfIs=";
24 };
25
26 # Actually link and add libgfortran to the rpath
27 postPatch = ''
28 substituteInPlace scs.mk \
29 --replace-fail "# -lgfortran" "-lgfortran" \
30 --replace-fail "gcc" "cc"
31 '';
32
33 nativeBuildInputs = lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
34
35 buildInputs = [
36 blas
37 lapack
38 gfortran.cc.lib
39 ];
40
41 doCheck = true;
42
43 # Test demo requires passing data and seed; numbers chosen arbitrarily.
44 postCheck = ''
45 ./out/demo_socp_indirect 42 0.42 0.42 42
46 '';
47
48 installPhase = ''
49 runHook preInstall
50 mkdir -p $out/lib
51 cp -r include $out/
52 cp out/*.a out/*.so out/*.dylib $out/lib/
53 runHook postInstall
54 '';
55
56 passthru = {
57 updateScript = nix-update-script { };
58 tests.scs-python = python3Packages.scs;
59 };
60
61 meta = {
62 description = "Splitting Conic Solver";
63 longDescription = ''
64 Numerical optimization package for solving large-scale convex cone problems
65 '';
66 homepage = "https://github.com/cvxgrp/scs";
67 changelog = "https://github.com/cvxgrp/scs/releases/tag/${finalAttrs.version}";
68 license = lib.licenses.mit;
69 platforms = lib.platforms.all;
70 };
71})