uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
97
pkgs/development/compilers/idris2/default.nix
Normal file
97
pkgs/development/compilers/idris2/default.nix
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
# Almost 1:1 copy of idris2's nix/platform.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
|
||||
# Taken from Idris2/idris2/flake.nix. Check if the idris2 project does it this
|
||||
# way, still, every now and then.
|
||||
platformChez = if stdenv.system == "x86_64-linux" then chez else chez-racket;
|
||||
# Uses scheme to bootstrap the build of idris2
|
||||
in stdenv.mkDerivation rec {
|
||||
pname = "idris2";
|
||||
version = "0.5.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "idris-lang";
|
||||
repo = "Idris2";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-6CTn8o5geWSesXO7vTrrV/2EOQ3f+nPQ2M5cem13ZSY=";
|
||||
};
|
||||
|
||||
strictDeps = true;
|
||||
nativeBuildInputs = [ makeWrapper clang platformChez ]
|
||||
++ lib.optional 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";
|
||||
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 "${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 = "A purely functional programming language with first class types";
|
||||
homepage = "https://github.com/idris-lang/Idris2";
|
||||
license = lib.licenses.bsd3;
|
||||
maintainers = with lib.maintainers; [ fabianhjr wchresta ];
|
||||
inherit (chez.meta) platforms;
|
||||
};
|
||||
}
|
||||
68
pkgs/development/compilers/idris2/tests.nix
Normal file
68
pkgs/development/compilers/idris2/tests.nix
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
{ 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.optional 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]";
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue