diff --git a/.gitignore b/.gitignore index e988502e..4176e8eb 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ ter.bat ver.bat .bsp/ logs/ +result diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..8f28e412 --- /dev/null +++ b/flake.lock @@ -0,0 +1,63 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1719531801, + "narHash": "sha256-EHrZuCNR1IJhq9H1m6PFnoYT8oz9JG0/mra22vvqYmU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "49f04c74c356bc1d6dbea4b1b109a4165daf3249", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "sbt": "sbt" + } + }, + "sbt": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1698464090, + "narHash": "sha256-Pnej7WZIPomYWg8f/CZ65sfW85IfIUjYhphMMg7/LT0=", + "owner": "zaninime", + "repo": "sbt-derivation", + "rev": "6762cf2c31de50efd9ff905cbcc87239995a4ef9", + "type": "github" + }, + "original": { + "owner": "zaninime", + "repo": "sbt-derivation", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..30c484eb --- /dev/null +++ b/flake.nix @@ -0,0 +1,37 @@ +{ + description = "HTTP server that manages verification requests to different tools from the Viper tool stack."; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs"; + sbt = { + url = "github:zaninime/sbt-derivation"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, sbt }: let + supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; + forAllSystems = function: nixpkgs.lib.genAttrs supportedSystems + (system: function (import nixpkgs { inherit system; })); + in { + packages = forAllSystems (pkgs: { + default = sbt.lib.mkSbtDerivation { + inherit pkgs; + overrides = { sbt = pkgs.sbt.override { jre = pkgs.jdk11_headless; }; }; + pname = "viperserver"; + src = ./.; + depsSha256 = "sha256-iJHPSJkxjFWVEmXFXX16OpqKOuSSE/qIxUpDfRbb/Fk="; + version = "${self.tag or "${self.lastModifiedDate}.${self.shortRev or "dirty"}"}"; + buildInputs = with pkgs; [ z3 boogie ]; + depsWarmupCommand = "sbt update"; + buildPhase = "sbt assembly"; + installPhase = ''mkdir -p $out/server && mkdir -p $out/boogie/Binaries/ && + cp target/scala-2.13/viperserver.jar $out/server/viperserver.jar && + cp -r ${pkgs.z3} $out/z3 && + cp ${pkgs.boogie}/bin/boogie $out/boogie/Binaries/Boogie''; + Z3_EXE = "${pkgs.z3}/bin/z3"; + BOOGIE_EXE = "${pkgs.boogie}/bin/boogie"; + }; + }); + }; +}