2023-05-24 13:37:59 +00:00
{ lib
, buildDotnetModule
, fetchFromGitHub
, writeScript
, jdk11
, z3
} :
buildDotnetModule rec {
pname = " D a f n y " ;
2023-08-04 22:07:22 +00:00
version = " 4 . 2 . 0 " ;
2023-05-24 13:37:59 +00:00
src = fetchFromGitHub {
owner = " d a f n y - l a n g " ;
repo = " d a f n y " ;
rev = " v ${ version } " ;
2023-08-04 22:07:22 +00:00
sha256 = " s h a 2 5 6 - R S G a O g G f 3 m 9 4 t 3 S K n v S P q z 0 V H h W r 6 N m I M t G s m O y n M a M = " ;
2023-05-24 13:37:59 +00:00
} ;
postPatch = ''
cp $ { writeScript " f a k e - g r a d l e w - f o r - d a f n y " ''
mkdir - p build/libs /
javac $ ( find - name " * . j a v a " | grep " ^ . / s r c / m a i n " ) - d classes
2023-08-04 22:07:22 +00:00
jar cf build/libs/DafnyRuntime- $ { version } . jar - C classes dafny
2023-05-24 13:37:59 +00:00
'' } S o u r c e / D a f n y R u n t i m e / D a f n y R u n t i m e J a v a / g r a d l e w
# Needed to fix
# "error NETSDK1129: The 'Publish' target is not supported without specifying a target framework. The current project targets multiple frameworks, you must specify the framework for the published application."
substituteInPlace Source/DafnyRuntime/DafnyRuntime.csproj \
- - replace TargetFrameworks TargetFramework \
- - replace " n e t s t a n d a r d 2 . 0 ; n e t 4 5 2 " net6 .0
'' ;
buildInputs = [ jdk11 ] ;
nugetDeps = ./deps.nix ;
# Build just these projects. Building Source/Dafny.sln includes a bunch of
# unnecessary components like tests.
projectFile = [
" S o u r c e / D a f n y / D a f n y . c s p r o j "
" S o u r c e / D a f n y R u n t i m e / D a f n y R u n t i m e . c s p r o j "
" S o u r c e / D a f n y L a n g u a g e S e r v e r / D a f n y L a n g u a g e S e r v e r . c s p r o j "
] ;
executables = [ " D a f n y " ] ;
# Help Dafny find z3
makeWrapperArgs = [ " - - p r e f i x P A T H : ${ lib . makeBinPath [ z3 ] } " ] ;
postFixup = ''
ln - s " $ o u t / b i n / D a f n y " " $ o u t / b i n / d a f n y " || true
'' ;
meta = with lib ; {
description = " A p r o g r a m m i n g l a n g u a g e w i t h b u i l t - i n s p e c i f i c a t i o n c o n s t r u c t s " ;
homepage = " h t t p s : / / r e s e a r c h . m i c r o s o f t . c o m / d a f n y " ;
maintainers = with maintainers ; [ layus ] ;
license = licenses . mit ;
platforms = with platforms ; ( linux ++ darwin ) ;
} ;
}