about summary refs log tree commit diff
path: root/pkgs/development/compilers/c3c/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/c3c/default.nix')
-rw-r--r--pkgs/development/compilers/c3c/default.nix47
1 files changed, 47 insertions, 0 deletions
diff --git a/pkgs/development/compilers/c3c/default.nix b/pkgs/development/compilers/c3c/default.nix
new file mode 100644
index 0000000000000..2fa280fc898ca
--- /dev/null
+++ b/pkgs/development/compilers/c3c/default.nix
@@ -0,0 +1,47 @@
+{ llvmPackages
+, lib
+, fetchFromGitHub
+, cmake
+, python3
+}:
+
+llvmPackages.stdenv.mkDerivation rec {
+  pname = "c3c";
+  version = "unstable-2021-07-30";
+
+  src = fetchFromGitHub {
+    owner = "c3lang";
+    repo = pname;
+    rev = "2246b641b16e581aec9059c8358858e10a548d94";
+    sha256 = "VdMKdQsedDQCnsmTxO4HnBj5GH/EThspnotvrAscSqE=";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = [
+    llvmPackages.llvm
+    llvmPackages.lld
+  ];
+
+  checkInputs = [ python3 ];
+
+  doCheck = true;
+
+  checkPhase = ''
+    ( cd ../resources/testproject; ../../build/c3c build )
+    ( cd ../test; python src/tester.py ../build/c3c test_suite )
+  '';
+
+  installPhase = ''
+    install -Dm755 c3c $out/bin/c3c
+    cp -r lib $out
+  '';
+
+  meta = with lib; {
+    description = "Compiler for the C3 language";
+    homepage = "https://github.com/c3lang/c3c";
+    license = licenses.lgpl3Only;
+    maintainers = with maintainers; [ luc65r ];
+    platforms = platforms.all;
+  };
+}