mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-09-11 21:37:48 +03:00
Update nix build scripts to build idris with the current version of idris
This commit is contained in:
parent
c906720ee3
commit
b1f2eab6d6
5
.github/workflows/ci-idris2.yml
vendored
5
.github/workflows/ci-idris2.yml
vendored
@ -231,10 +231,9 @@ jobs:
|
|||||||
needs: quick-check
|
needs: quick-check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: |
|
if: |
|
||||||
false
|
!contains(needs.initialise.outputs.commit_message, '[ci:')
|
||||||
&& (!contains(needs.initialise.outputs.commit_message, '[ci:')
|
|
||||||
|| contains(needs.initialise.outputs.commit_message, '[ci: nix]')
|
|| contains(needs.initialise.outputs.commit_message, '[ci: nix]')
|
||||||
|| contains(needs.initialise.outputs.commit_message, '[ci: chez]'))
|
|| contains(needs.initialise.outputs.commit_message, '[ci: chez]')
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
|
@ -30,10 +30,14 @@
|
|||||||
chez = if system == "x86_64-linux"
|
chez = if system == "x86_64-linux"
|
||||||
then pkgs.chez
|
then pkgs.chez
|
||||||
else pkgs.chez-racket; # TODO: Should this always be the default?
|
else pkgs.chez-racket; # TODO: Should this always be the default?
|
||||||
idris2Pkg = pkgs.callPackage ./nix/package.nix {
|
idris2Bootstrap = pkgs.callPackage ./nix/bootstrap.nix {
|
||||||
inherit idris2-version chez;
|
inherit idris2-version chez;
|
||||||
srcRev = self.shortRev or "dirty";
|
srcRev = self.shortRev or "dirty";
|
||||||
};
|
};
|
||||||
|
idris2Pkg = pkgs.callPackage ./nix/package.nix {
|
||||||
|
inherit idris2-version chez idris2Bootstrap;
|
||||||
|
srcRev = self.shortRev or "dirty";
|
||||||
|
};
|
||||||
buildIdris = pkgs.callPackage ./nix/buildIdris.nix { inherit idris2-version; idris2 = idris2Pkg; };
|
buildIdris = pkgs.callPackage ./nix/buildIdris.nix { inherit idris2-version; idris2 = idris2Pkg; };
|
||||||
in rec {
|
in rec {
|
||||||
checks = import ./nix/test.nix {
|
checks = import ./nix/test.nix {
|
||||||
|
75
nix/bootstrap.nix
Normal file
75
nix/bootstrap.nix
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
{ stdenv
|
||||||
|
, lib
|
||||||
|
, chez
|
||||||
|
, clang
|
||||||
|
, gmp
|
||||||
|
, fetchFromGitHub
|
||||||
|
, makeWrapper
|
||||||
|
, idris2-version
|
||||||
|
, srcRev
|
||||||
|
, gambit
|
||||||
|
, nodejs
|
||||||
|
, zsh
|
||||||
|
}:
|
||||||
|
|
||||||
|
# Uses scheme to bootstrap the build of idris2
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "idris2";
|
||||||
|
version = idris2-version;
|
||||||
|
|
||||||
|
src = ../.;
|
||||||
|
|
||||||
|
strictDeps = true;
|
||||||
|
nativeBuildInputs = [ makeWrapper clang chez ]
|
||||||
|
++ lib.optional stdenv.isDarwin [ zsh ];
|
||||||
|
buildInputs = [ chez gmp ];
|
||||||
|
|
||||||
|
prePatch = ''
|
||||||
|
patchShebangs --build tests
|
||||||
|
sed 's/''$(GIT_SHA1)/${srcRev}/' -i Makefile
|
||||||
|
'';
|
||||||
|
|
||||||
|
makeFlags = [ "PREFIX=$(out)" ]
|
||||||
|
++ lib.optional stdenv.isDarwin "OS=";
|
||||||
|
|
||||||
|
# The name of the main executable of pkgs.chez is `scheme`
|
||||||
|
buildFlags = [ "bootstrap" "SCHEME=scheme" ];
|
||||||
|
|
||||||
|
checkInputs = [ 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 "${chez}/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"
|
||||||
|
'';
|
||||||
|
}
|
@ -10,6 +10,7 @@
|
|||||||
, gambit
|
, gambit
|
||||||
, nodejs
|
, nodejs
|
||||||
, zsh
|
, zsh
|
||||||
|
, idris2Bootstrap
|
||||||
}:
|
}:
|
||||||
|
|
||||||
# Uses scheme to bootstrap the build of idris2
|
# Uses scheme to bootstrap the build of idris2
|
||||||
@ -20,7 +21,7 @@ stdenv.mkDerivation rec {
|
|||||||
src = ../.;
|
src = ../.;
|
||||||
|
|
||||||
strictDeps = true;
|
strictDeps = true;
|
||||||
nativeBuildInputs = [ makeWrapper clang chez ]
|
nativeBuildInputs = [ makeWrapper clang chez idris2Bootstrap ]
|
||||||
++ lib.optional stdenv.isDarwin [ zsh ];
|
++ lib.optional stdenv.isDarwin [ zsh ];
|
||||||
buildInputs = [ chez gmp ];
|
buildInputs = [ chez gmp ];
|
||||||
|
|
||||||
@ -33,7 +34,7 @@ stdenv.mkDerivation rec {
|
|||||||
++ lib.optional stdenv.isDarwin "OS=";
|
++ lib.optional stdenv.isDarwin "OS=";
|
||||||
|
|
||||||
# The name of the main executable of pkgs.chez is `scheme`
|
# The name of the main executable of pkgs.chez is `scheme`
|
||||||
buildFlags = [ "bootstrap" "SCHEME=scheme" ];
|
buildFlags = [ ];
|
||||||
|
|
||||||
checkInputs = [ gambit nodejs ]; # racket ];
|
checkInputs = [ gambit nodejs ]; # racket ];
|
||||||
checkFlags = [ "INTERACTIVE=" ];
|
checkFlags = [ "INTERACTIVE=" ];
|
||||||
|
Loading…
Reference in New Issue
Block a user