2017-01-16 22:24:21 +01:00
{ stdenv , fetchFromGitHub , bc , python , fuse , libarchive }:
stdenv . mkDerivation rec {
name = " l k l - ${ stdenv . lib . substring 0 7 rev } " ;
2017-01-17 19:40:58 +01:00
rev = " d 7 4 7 0 7 3 0 4 d 4 e 4 6 1 4 0 8 1 a e 2 a 6 1 2 a 8 3 3 a e b 4 6 6 2 2 b 5 " ;
2017-01-16 22:24:21 +01:00
buildInputs = [ bc python fuse libarchive ] ;
src = fetchFromGitHub {
inherit rev ;
2017-01-17 19:40:58 +01:00
owner = " l k l " ;
2017-01-16 22:24:21 +01:00
repo = " l i n u x " ;
2017-01-17 19:40:58 +01:00
sha256 = " 0 x 1 h d j s r j 6 h f k 1 s g f w 1 1 i h m 0 0 f m p 6 g 1 5 8 s r 2 q 3 c g j y 2 b 6 j n s r 4 h p " ;
2017-01-16 22:24:21 +01:00
} ;
2017-01-25 22:30:46 +01:00
# Fix a /usr/bin/env reference in here that breaks sandboxed builds
prePatch = " p a t c h S h e b a n g s a r c h / l k l / s c r i p t s " ;
2017-01-16 22:24:21 +01:00
installPhase = ''
mkdir - p $ out / { bin , lib }
# This tool assumes a different directory structure so let's point it at the right location
cp tools/lkl/bin/lkl-hijack.sh $ out/bin
substituteInPlace $ out/bin/lkl-hijack.sh - - replace ' /.. / ' ' /../lib '
cp tools/lkl / { cptofs , cpfromfs , fs2tar , lklfuse } $ out/bin
cp - r tools/lkl/include $ out
cp tools/lkl/liblkl * . { a , so } $ out/lib
'' ;
# We turn off format and fortify because of these errors (fortify implies -O2, which breaks the jitter entropy code):
# fs/xfs/xfs_log_recover.c:2575:3: error: format not a string literal and no format arguments [-Werror=format-security]
# crypto/jitterentropy.c:54:3: error: #error "The CPU Jitter random number generator must not be compiled with optimizations. See documentation. Use the compiler switch -O0 for compiling jitterentropy.c."
hardeningDisable = [ " f o r m a t " " f o r t i f y " ] ;
makeFlags = " - C t o o l s / l k l " ;
enableParallelBuilds = true ;
meta = with stdenv . lib ; {
description = " L K L ( L i n u x K e r n e l L i b r a r y ) a i m s t o a l l o w r e u s i n g t h e L i n u x k e r n e l c o d e a s e x t e n s i v e l y a s p o s s i b l e w i t h m i n i m a l e f f o r t a n d r e d u c e d m a i n t e n a n c e o v e r h e a d " ;
platforms = platforms . linux ; # Darwin probably works too but I haven't tested it
license = licenses . gpl2 ;
maintainers = with maintainers ; [ copumpkin ] ;
} ;
}