about summary refs log tree commit diff
path: root/pkgs/development/interpreters/janet/default.nix
blob: 35631174e2609c5ab161b6f5bc37229c59578ad2 (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
{ lib, stdenv, fetchFromGitHub, meson, ninja }:

stdenv.mkDerivation rec {
  pname = "janet";
  version = "1.16.1";

  src = fetchFromGitHub {
    owner = "janet-lang";
    repo = pname;
    rev = "v${version}";
    sha256 = "sha256-TzJbHmHIySlf3asQ02HOdehMR+s0KkPifBiaQ4FvFCg=";
  };

  # we don't have /usr/bin/env in the sandbox, so substitute for a proper,
  # absolute path to janet
  postPatch = ''
    substituteInPlace jpm \
      --replace '/usr/bin/env janet' $out/bin/janet \
      --replace /usr/local/lib/janet $out/lib \
      --replace /usr/local           $out

    substituteInPlace janet.1 \
      --replace /usr/local/lib/janet $out/lib
  '';

  nativeBuildInputs = [ meson ninja ];

  mesonFlags = [ "-Dgit_hash=release" ];

  doCheck = true;

  meta = with lib; {
    description = "Janet programming language";
    homepage = "https://janet-lang.org/";
    license = licenses.mit;
    maintainers = with maintainers; [ andrewchambers peterhoeg ];
    platforms = platforms.all;
  };
}