about summary refs log tree commit diff
path: root/pkgs/tools/misc/gavin-bc/default.nix
blob: 7f1a788246749d507163482fa57e4dc17915c73c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{ lib
, stdenv
, fetchFromGitea
, editline
, readline
, historyType ? "internal"
, predefinedBuildType ? "BSD"
}:

assert lib.elem historyType [ "editline" "readline" "internal" ];
assert lib.elem predefinedBuildType [ "BSD" "GNU" "GDH" "DBG" ];
stdenv.mkDerivation (finalAttrs: {
  pname = "gavin-bc";
  version = "6.2.4";

  src = fetchFromGitea {
    domain = "git.gavinhoward.com";
    owner = "gavin";
    repo = "bc";
    rev = finalAttrs.version;
    hash = "sha256-KQheSyBbxh2ROOvwt/gqhJM+qWc+gDS/x4fD6QIYUWw=";
  };

  buildInputs =
    (lib.optional (historyType == "editline") editline)
    ++ (lib.optional (historyType == "readline") readline);

  configureFlags = [
    "--disable-nls"
    "--predefined-build-type=${predefinedBuildType}"
  ]
  ++ (lib.optional (historyType == "editline") "--enable-editline")
  ++ (lib.optional (historyType == "readline") "--enable-readline");

  meta = {
    homepage = "https://git.gavinhoward.com/gavin/bc";
    description = "Gavin Howard's BC calculator implementation";
    license = lib.licenses.bsd2;
    maintainers = [ lib.maintainers.AndersonTorres ];
    platforms = lib.platforms.unix;
    broken = stdenv.isDarwin;
  };
})