about summary refs log tree commit diff
path: root/pkgs/development/compilers/idris2
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/idris2')
-rw-r--r--pkgs/development/compilers/idris2/build-idris.nix98
-rw-r--r--pkgs/development/compilers/idris2/default.nix21
-rw-r--r--pkgs/development/compilers/idris2/idris2-lsp.nix52
-rw-r--r--pkgs/development/compilers/idris2/idris2.nix100
-rw-r--r--pkgs/development/compilers/idris2/tests.nix68
5 files changed, 0 insertions, 339 deletions
diff --git a/pkgs/development/compilers/idris2/build-idris.nix b/pkgs/development/compilers/idris2/build-idris.nix
deleted file mode 100644
index 1df763e4c4fd..000000000000
--- a/pkgs/development/compilers/idris2/build-idris.nix
+++ /dev/null
@@ -1,98 +0,0 @@
-{ stdenv, lib, idris2, makeWrapper
-}:
-# Usage: let
-#          pkg = idris2Packages.buildIdris {
-#            src = ...;
-#            ipkgName = "my-pkg";
-#            idrisLibraries = [ ];
-#          };
-#        in {
-#          lib = pkg.library { withSource = true; };
-#          bin = pkg.executable;
-#        }
-#
-{ src
-, ipkgName
-, version ? "unversioned"
-, idrisLibraries # Other libraries built with buildIdris
-, ... }@attrs:
-
-let
-  propagate = libs: lib.unique (lib.concatMap (nextLib: [nextLib] ++ nextLib.propagatedIdrisLibraries) libs);
-  ipkgFileName = ipkgName + ".ipkg";
-  idrName = "idris2-${idris2.version}";
-  libSuffix = "lib/${idrName}";
-  propagatedIdrisLibraries = propagate idrisLibraries;
-  libDirs =
-    (lib.makeSearchPath libSuffix propagatedIdrisLibraries) +
-    ":${idris2}/${idrName}";
-  supportDir = "${idris2}/${idrName}/lib";
-  drvAttrs = builtins.removeAttrs attrs [
-    "ipkgName"
-    "idrisLibraries"
-  ];
-
-  derivation = stdenv.mkDerivation (finalAttrs:
-    drvAttrs // {
-      pname = ipkgName;
-      inherit version;
-      src = src;
-      nativeBuildInputs = [ idris2 makeWrapper ] ++ attrs.nativeBuildInputs or [];
-      buildInputs = propagatedIdrisLibraries ++ attrs.buildInputs or [];
-
-      IDRIS2_PACKAGE_PATH = libDirs;
-
-      buildPhase = ''
-        runHook preBuild
-        idris2 --build ${ipkgFileName}
-        runHook postBuild
-      '';
-
-      passthru = {
-        inherit propagatedIdrisLibraries;
-      };
-
-      shellHook = ''
-        export IDRIS2_PACKAGE_PATH="${finalAttrs.IDRIS2_PACKAGE_PATH}"
-      '';
-    }
-  );
-
-in {
-  executable = derivation.overrideAttrs {
-    installPhase = ''
-      runHook preInstall
-      mkdir -p $out/bin
-      scheme_app="$(find ./build/exec -name '*_app')"
-      if [ "$scheme_app" = ''' ]; then
-        mv -- build/exec/* $out/bin/
-        chmod +x $out/bin/*
-        # ^ remove after Idris2 0.8.0 is released. will be superfluous:
-        # https://github.com/idris-lang/Idris2/pull/3189
-      else
-        cd build/exec/*_app
-        rm -f ./libidris2_support.so
-        for file in *.so; do
-          bin_name="''${file%.so}"
-          mv -- "$file" "$out/bin/$bin_name"
-          wrapProgram "$out/bin/$bin_name" \
-            --prefix LD_LIBRARY_PATH : ${supportDir} \
-            --prefix DYLD_LIBRARY_PATH : ${supportDir}
-        done
-      fi
-      runHook postInstall
-    '';
-  };
-
-  library = { withSource ? false }:
-    let installCmd = if withSource then "--install-with-src" else "--install";
-    in derivation.overrideAttrs {
-      installPhase = ''
-        runHook preInstall
-        mkdir -p $out/${libSuffix}
-        export IDRIS2_PREFIX=$out/lib
-        idris2 ${installCmd} ${ipkgFileName}
-        runHook postInstall
-      '';
-    };
-}
diff --git a/pkgs/development/compilers/idris2/default.nix b/pkgs/development/compilers/idris2/default.nix
deleted file mode 100644
index 79a90cbee0f3..000000000000
--- a/pkgs/development/compilers/idris2/default.nix
+++ /dev/null
@@ -1,21 +0,0 @@
-{ callPackage
-, idris2Packages
-}:
-
-let
-in {
-  idris2 = callPackage ./idris2.nix { };
-  idris2Lsp = callPackage ./idris2-lsp.nix { };
-
-  buildIdris = callPackage ./build-idris.nix { };
-
-  idris2Api = (idris2Packages.buildIdris {
-    inherit (idris2Packages.idris2) src version;
-    ipkgName = "idris2api";
-    idrisLibraries = [ ];
-    preBuild = ''
-      export IDRIS2_PREFIX=$out/lib
-      make src/IdrisPaths.idr
-    '';
-  }).library;
-}
diff --git a/pkgs/development/compilers/idris2/idris2-lsp.nix b/pkgs/development/compilers/idris2/idris2-lsp.nix
deleted file mode 100644
index 095b973cc0cb..000000000000
--- a/pkgs/development/compilers/idris2/idris2-lsp.nix
+++ /dev/null
@@ -1,52 +0,0 @@
-{ lib, fetchFromGitHub, idris2Packages, makeWrapper }:
-
-let
-  globalLibraries = let
-    idrName = "idris2-${idris2Packages.idris2.version}";
-    libSuffix = "lib/${idrName}";
-  in [
-    "\\$HOME/.nix-profile/lib/${idrName}"
-    "/run/current-system/sw/lib/${idrName}"
-    "${idris2Packages.idris2}/${idrName}"
-  ];
-  globalLibrariesPath = builtins.concatStringsSep ":" globalLibraries;
-
-  idris2Api = idris2Packages.idris2Api { };
-  lspLib = (idris2Packages.buildIdris {
-    ipkgName = "lsp-lib";
-    version = "2024-01-21";
-    src = fetchFromGitHub {
-     owner = "idris-community";
-     repo = "LSP-lib";
-     rev = "03851daae0c0274a02d94663d8f53143a94640da";
-     hash = "sha256-ICW9oOOP70hXneJFYInuPY68SZTDw10dSxSPTW4WwWM=";
-    };
-    idrisLibraries = [ ];
-  }).library { };
-
-  lspPkg = idris2Packages.buildIdris {
-    ipkgName = "idris2-lsp";
-    version = "2024-01-21";
-    src = fetchFromGitHub {
-       owner = "idris-community";
-       repo = "idris2-lsp";
-       rev = "a77ef2d563418925aa274fa29f06880dde43f4ec";
-       hash = "sha256-zjfVfkpiQS9AdmTfq0hYRSelJq5Caa9VGTuFLtSvl5o=";
-    };
-    idrisLibraries = [idris2Api lspLib];
-
-    buildInputs = [makeWrapper];
-    postInstall = ''
-      wrapProgram $out/bin/idris2-lsp \
-        --suffix IDRIS2_PACKAGE_PATH ':' "${globalLibrariesPath}"
-    '';
-
-    meta = with lib; {
-      description = "Language Server for Idris2";
-      mainProgram = "idris2-lsp";
-      homepage = "https://github.com/idris-community/idris2-lsp";
-      license = licenses.bsd3;
-      maintainers = with maintainers; [ mattpolzin ];
-    };
-  };
-in lspPkg.executable
diff --git a/pkgs/development/compilers/idris2/idris2.nix b/pkgs/development/compilers/idris2/idris2.nix
deleted file mode 100644
index 4d28b35bd4a9..000000000000
--- a/pkgs/development/compilers/idris2/idris2.nix
+++ /dev/null
@@ -1,100 +0,0 @@
-# Almost 1:1 copy of idris2's nix/package.nix. Some work done in their flake.nix
-# we do here instead.
-{ stdenv
-, lib
-, chez
-, chez-racket
-, clang
-, gmp
-, fetchFromGitHub
-, makeWrapper
-, gambit
-, nodejs
-, zsh
-, callPackage
-}:
-
-# NOTICE: An `idris2WithPackages` is available at: https://github.com/claymager/idris2-pkgs
-
-let
-  platformChez =
-    if (stdenv.system == "x86_64-linux") || (lib.versionAtLeast chez.version "10.0.0")
-      then
-        chez
-      else
-        chez-racket;
-in stdenv.mkDerivation rec {
-  pname = "idris2";
-  version = "0.7.0";
-
-  src = fetchFromGitHub {
-    owner = "idris-lang";
-    repo = "Idris2";
-    rev = "v${version}";
-    sha256 = "sha256-VwveX3fZfrxEsytpbOc5Tm6rySpLFhTt5132J6rmrmM=";
-  };
-
-  strictDeps = true;
-  nativeBuildInputs = [ makeWrapper clang platformChez ]
-    ++ lib.optionals stdenv.isDarwin [ zsh ];
-  buildInputs = [ platformChez gmp ];
-
-  prePatch = ''
-    patchShebangs --build tests
-  '';
-
-  makeFlags = [ "PREFIX=$(out)" ]
-    ++ lib.optional stdenv.isDarwin "OS=";
-
-  # The name of the main executable of pkgs.chez is `scheme`
-  buildFlags = [ "bootstrap" "SCHEME=scheme" ];
-
-  checkTarget = "test";
-  nativeCheckInputs = [ gambit nodejs ]; # racket ];
-  checkFlags = [ "INTERACTIVE=" ];
-
-  # TODO: Move this into its own derivation, such that this can be changed
-  #       without having to recompile idris2 every time.
-  postInstall = let
-    name = "${pname}-${version}";
-    globalLibraries = [
-      "\\$HOME/.nix-profile/lib/${name}"
-      "/run/current-system/sw/lib/${name}"
-      "$out/${name}"
-    ];
-    globalLibrariesPath = builtins.concatStringsSep ":" globalLibraries;
-  in ''
-    # Remove existing idris2 wrapper that sets incorrect LD_LIBRARY_PATH
-    rm $out/bin/idris2
-    # The only thing we need from idris2_app is the actual binary
-    mv $out/bin/idris2_app/idris2.so $out/bin/idris2
-    rm $out/bin/idris2_app/*
-    rmdir $out/bin/idris2_app
-    # idris2 needs to find scheme at runtime to compile
-    # idris2 installs packages with --install into the path given by
-    #   IDRIS2_PREFIX. We set that to a default of ~/.idris2, to mirror the
-    #   behaviour of the standard Makefile install.
-    # TODO: Make support libraries their own derivation such that
-    #       overriding LD_LIBRARY_PATH is unnecessary
-    wrapProgram "$out/bin/idris2" \
-      --set-default CHEZ "${platformChez}/bin/scheme" \
-      --run 'export IDRIS2_PREFIX=''${IDRIS2_PREFIX-"$HOME/.idris2"}' \
-      --suffix IDRIS2_LIBS ':' "$out/${name}/lib" \
-      --suffix IDRIS2_DATA ':' "$out/${name}/support" \
-      --suffix IDRIS2_PACKAGE_PATH ':' "${globalLibrariesPath}" \
-      --suffix DYLD_LIBRARY_PATH ':' "$out/${name}/lib" \
-      --suffix LD_LIBRARY_PATH ':' "$out/${name}/lib"
-  '';
-
-  # Run package tests
-  passthru.tests = callPackage ./tests.nix { inherit pname; };
-
-  meta = {
-    description = "Purely functional programming language with first class types";
-    mainProgram = "idris2";
-    homepage = "https://github.com/idris-lang/Idris2";
-    license = lib.licenses.bsd3;
-    maintainers = with lib.maintainers; [ fabianhjr wchresta mattpolzin ];
-    inherit (chez.meta) platforms;
-  };
-}
diff --git a/pkgs/development/compilers/idris2/tests.nix b/pkgs/development/compilers/idris2/tests.nix
deleted file mode 100644
index 54bb6d29eeef..000000000000
--- a/pkgs/development/compilers/idris2/tests.nix
+++ /dev/null
@@ -1,68 +0,0 @@
-{ stdenv, lib, pname, idris2, zsh }:
-
-let
-  testCompileAndRun = {testName, code, want, packages ? []}: let
-      packageString = builtins.concatStringsSep " " (map (p: "--package " + p) packages);
-    in stdenv.mkDerivation {
-      name = "${pname}-${testName}";
-      meta.timeout = 60;
-
-      # with idris2 compiled binaries assume zsh is available on darwin, but that
-      # is not the case with pure nix environments. Thus, we need to include zsh
-      # when we build for darwin in tests. While this is impure, this is also what
-      # we find in real darwin hosts.
-      nativeBuildInputs = lib.optionals stdenv.isDarwin [ zsh ];
-
-      buildCommand = ''
-        set -eo pipefail
-
-        cat > packageTest.idr <<HERE
-        ${code}
-        HERE
-
-        ${idris2}/bin/idris2 ${packageString} -o packageTest packageTest.idr
-
-        GOT=$(./build/exec/packageTest)
-
-        if [ "$GOT" = "${want}" ]; then
-          echo "${testName} SUCCESS: '$GOT' = '${want}'"
-        else
-          >&2 echo "Got '$GOT', want: '${want}'"
-          exit 1
-        fi
-
-        touch $out
-      '';
-    };
-in {
-  # Simple hello world compiles, runs and outputs as expected
-  hello-world = testCompileAndRun {
-    testName = "hello-world";
-    code = ''
-      module Main
-
-      main : IO ()
-      main = putStrLn "Hello World!"
-    '';
-    want = "Hello World!";
-  };
-
-  # Data.Vect.Sort is available via --package contrib
-  use-contrib = testCompileAndRun {
-    testName = "use-contrib";
-    packages = [ "contrib" ];
-    code = ''
-      module Main
-
-      import Data.Vect
-      import Data.Vect.Sort  -- from contrib
-
-      vect : Vect 3 Int
-      vect = 3 :: 1 :: 5 :: Nil
-
-      main : IO ()
-      main = putStrLn $ show (sort vect)
-    '';
-    want = "[1, 3, 5]";
-  };
-}