nixpkgs/pkgs/by-name/sc/scalp/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

60 lines
1.3 KiB
Nix

{ lib
, stdenv
, fetchgit
, cmake
, withGurobi ? false
, gurobi
, withCplex ? false
, cplex
, withLpsolve ? true
, lp_solve
}:
stdenv.mkDerivation rec {
pname = "scalp";
version = "unstable-2022-03-15";
src = fetchgit {
url = "https://digidev.digi.e-technik.uni-kassel.de/git/scalp.git";
# mirrored at https://git.sr.ht/~weijia/scalp
rev = "185b84e4ff967f42cf2de5db4db4e6fa0cc18fb8";
hash = "sha256-NyMZdJwdD3FR6uweYCclJjfcf3Y24Bns1ViwsmJ5izg=";
};
nativeBuildInputs = [
cmake
];
buildInputs = lib.optionals withGurobi [
gurobi
] ++ lib.optionals withCplex [
cplex
] ++ lib.optionals withLpsolve [
lp_solve
];
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace CMakeLists.txt \
--replace "\''$ORIGIN" "\''${CMAKE_INSTALL_PREFIX}/lib"
'';
cmakeFlags = [
"-DBUILD_TESTS=${lib.boolToString doCheck}"
] ++ lib.optionals withGurobi [
"-DGUROBI_DIR=${gurobi}"
] ++ lib.optionals withCplex [
"-DCPLEX_DIR=${cplex}"
];
doCheck = true;
meta = with lib; {
description = "Scalable Linear Programming Library";
mainProgram = "scalp";
homepage = "https://digidev.digi.e-technik.uni-kassel.de/scalp/";
license = licenses.lgpl3;
platforms = platforms.unix;
maintainers = with maintainers; [ wegank ];
};
}