-
Notifications
You must be signed in to change notification settings - Fork 75
[Chore] Add nix build #661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
de004ca
[Chore] Project build updates
mirkoAlic 8bd4f29
initial nix build
disassembler 792bef1
update dependencies
manveru bb9d9dd
Add release.nix
a597ef0
Fix build
sevanspowell cc285de
Merge resolved
mirkoAlic f00cade
Regen nix deps
dfdab1e
Regen nix deps pt 2
sevanspowell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,6 @@ project/plugins/project/ | |
*.log | ||
*.log.zip | ||
.evm-runner_history | ||
|
||
# Nix | ||
result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ system ? builtins.currentSystem, src ? ./. | ||
, pkgs ? (import ./nix { inherit system src; }).pkgs }: | ||
pkgs.mantis |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# this file must still be generated manually. | ||
{ | ||
"repos" = { | ||
"nix-public" = ""; | ||
"nix-typesafe-ivy-releases" = "[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]"; | ||
}; | ||
"artifacts" = { | ||
# dependencies so sbt can build the sbt-compiler-interface (http://www.scala-sbt.org/0.13/docs/Compiler-Interface.html) | ||
"nix-public/org/scala-lang/jline/2.10.6/jline-2.10.6.pom" = { | ||
url = "https://repo1.maven.org/maven2/org/scala-lang/jline/2.10.6/jline-2.10.6.pom"; | ||
sha256 = "16mg4b2c1m6gcq901wy6f6jpy8spw2yh909gi826xykq89ja94dg"; | ||
}; | ||
"nix-public/org/scala-lang/jline/2.10.6/jline-2.10.6.jar" = { | ||
url = "https://repo1.maven.org/maven2/org/scala-lang/jline/2.10.6/jline-2.10.6.jar"; | ||
sha256 = "1cfk6whncx2g87grwdfmz6f76bn807saqik91iwcfv099b1jngw1"; | ||
}; | ||
"nix-public/org/fusesource/jansi/jansi/1.4/jansi-1.4.pom" = { | ||
url = "https://repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.4/jansi-1.4.pom"; | ||
sha256 = "0rgprkbg4ljarf0x79snk2h1b0974glhl2fw1bxkxbw8k3ifda1s"; | ||
}; | ||
"nix-public/org/fusesource/jansi/jansi/1.4/jansi-1.4.jar" = { | ||
url = "https://repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.4/jansi-1.4.jar"; | ||
sha256 = "183ms545msn02fl0181rwbcifc8qy82rz4l6dglnhv9la8a1bnc2"; | ||
}; | ||
}; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ system ? builtins.currentSystem, sources ? import ./sources.nix, src ? ../. }: | ||
|
||
let | ||
overlay = final: prev: { | ||
inherit sources; | ||
inherit (import sources.gitignore { inherit (prev) lib; }) gitignoreSource; | ||
|
||
sbtix = prev.callPackage ../sbtix.nix { | ||
jdk = prev.openjdk8_headless; | ||
jre = prev.openjdk8_headless.jre; | ||
}; | ||
|
||
mantisPkgs = final.callPackage ./pkgs/mantis { | ||
inherit (prev.openjdk8_headless) jre; | ||
inherit src; | ||
}; | ||
|
||
inherit (final.mantisPkgs) mantis; | ||
|
||
inherit (final.mantisPkgs) mantis-unwrapped; | ||
}; | ||
in import sources.nixpkgs { | ||
inherit system; | ||
overlays = [ overlay ]; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ pkgs, lib, newScope, sources, src, impure ? false }: | ||
|
||
lib.makeScope newScope (self: | ||
with self; | ||
let callPackages = lib.callPackagesWith (pkgs // self); | ||
in { | ||
inherit sources src impure; | ||
jdk = prev.openjdk8_headless; | ||
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ src, lib, gitignoreSource, callPackage, jre }: rec { | ||
|
||
mkSrc = src: | ||
let | ||
isGit = builtins.pathExists (src + "/.git"); | ||
repo = builtins.fetchGit { url = src; submodules = true; }; | ||
dirty = repo.revCount == 0; | ||
filterSrc = src: | ||
lib.cleanSourceWith { | ||
inherit src; | ||
filter = path: _: !lib.hasSuffix "nix" path; | ||
}; | ||
in if isGit then | ||
if dirty then filterSrc (gitignoreSource src) else repo | ||
else | ||
src; | ||
|
||
mantis-source = mkSrc src; | ||
|
||
mantis-unwrapped = callPackage ./unwrapped.nix { src = mantis-source; }; | ||
|
||
mantis = callPackage ./wrapped.nix { | ||
mantis = mantis-unwrapped; | ||
inherit jre; | ||
}; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# this file originates from SBTix | ||
{ src, stdenv, writeShellScriptBin, bash, protobuf, sbtix | ||
, jdk, impure ? false }: | ||
|
||
let | ||
inherit (stdenv.lib) optionalString makeLibraryPath; | ||
inherit (stdenv) cc isDarwin; | ||
|
||
LD_LIBRARY_PATH = makeLibraryPath [ cc.cc.lib ]; | ||
|
||
unlessDarwin = optionalString (!stdenv.isDarwin); | ||
|
||
# sbt-protoc puts the scala plugin in /tmp/protobridge<some-random-number>. | ||
# it is in fact a shell script with a standard `#!/usr/bin/env sh` shebang | ||
# that makes the Nix sandbox ANGRY and breaks all the things in a cryptic, | ||
# hairpull-inducing way. So we gotta sed it out. Not the prettiest thing | ||
# but it works. | ||
protoc-wrapper = writeShellScriptBin "protoc" '' | ||
set -e | ||
|
||
for f in "$@"; do | ||
echo ''${f##*=} | ||
done | grep protocbridge | xargs sed -i "1s|.*|#!${bash}/bin/bash|" | ||
|
||
exec ${protobuf}/bin/protoc "$@" | ||
''; | ||
|
||
in sbtix.buildSbtProject { | ||
inherit src; | ||
|
||
name = "mantis"; | ||
sbtOptions = "-Dnix=true"; | ||
buildInputs = [ protoc-wrapper ]; | ||
sbtixBuildInputs = []; | ||
|
||
repo = [ | ||
(import ../../../repo.nix) | ||
(import ../../../project/repo.nix) | ||
(import ../../../manual-repo.nix) | ||
]; | ||
|
||
installPhase = '' | ||
sbt stage | ||
mkdir -p $out/ | ||
cp target/universal/stage/* $out/ -r | ||
mkdir -p $out/share/mantis | ||
mv $out/{LICENSE,RELEASE,mantis_config.txt} $_ | ||
''; | ||
|
||
dontPatchShebangs = impure; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ lib, stdenv, mantis, makeWrapper, jre, gawk }: | ||
let | ||
inherit (stdenv.lib) optionalString makeLibraryPath; | ||
inherit (stdenv) cc isDarwin; | ||
LD_LIBRARY_PATH = makeLibraryPath [ cc.cc.lib ]; | ||
PATH = lib.makeBinPath [ jre gawk ]; | ||
in stdenv.mkDerivation { | ||
pname = "mantis"; | ||
version = let | ||
buildSbt = builtins.readFile ../../../build.sbt; | ||
captures = builtins.match ''.*version := "([^"]+)".*'' buildSbt; | ||
in builtins.elemAt captures 0; | ||
|
||
nativeBuildInputs = [ makeWrapper ]; | ||
|
||
src = mantis; | ||
|
||
buildPhase = ":"; | ||
|
||
installPhase = '' | ||
cp -r $src $out | ||
chmod -R u+rw $out | ||
|
||
for p in $(find $out/bin/* -executable); do | ||
wrapProgram "$p" \ | ||
--prefix PATH : ${PATH} \ | ||
${ | ||
optionalString (!isDarwin) | ||
"--prefix LD_LIBRARY_PATH : ${LD_LIBRARY_PATH}" | ||
} | ||
done | ||
''; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"Sbtix": { | ||
"branch": "master", | ||
"description": "Generates Nix definitions for your SBT builds", | ||
"homepage": null, | ||
"owner": "input-output-hk", | ||
"repo": "Sbtix", | ||
"rev": "7b969a5641fce10500ca51cbe88af4ea160d7064", | ||
"sha256": "19pg7rm36b0v9y3ibq5cwsq38pwj3xw3d8srv78svmpnrzm1dh9g", | ||
"type": "tarball", | ||
"url": "https://github.com/input-output-hk/Sbtix/archive/7b969a5641fce10500ca51cbe88af4ea160d7064.tar.gz", | ||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" | ||
}, | ||
"gitignore": { | ||
"branch": "master", | ||
"description": "Nix function for filtering local git sources", | ||
"homepage": "", | ||
"owner": "hercules-ci", | ||
"repo": "gitignore", | ||
"rev": "ec5dd0536a5e4c3a99c797b86180f7261197c124", | ||
"sha256": "0k2r8y21rn4kr5dmddd3906x0733fs3bb8hzfpabkdav3wcy3klv", | ||
"type": "tarball", | ||
"url": "https://github.com/hercules-ci/gitignore/archive/ec5dd0536a5e4c3a99c797b86180f7261197c124.tar.gz", | ||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" | ||
}, | ||
"niv": { | ||
"branch": "master", | ||
"description": "Easy dependency management for Nix projects", | ||
"homepage": "https://github.com/nmattia/niv", | ||
"owner": "nmattia", | ||
"repo": "niv", | ||
"rev": "f73bf8d584148677b01859677a63191c31911eae", | ||
"sha256": "0jlmrx633jvqrqlyhlzpvdrnim128gc81q5psz2lpp2af8p8q9qs", | ||
"type": "tarball", | ||
"url": "https://github.com/nmattia/niv/archive/f73bf8d584148677b01859677a63191c31911eae.tar.gz", | ||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" | ||
}, | ||
"nixpkgs": { | ||
"branch": "nixos-20.03", | ||
"description": "Nixpkgs/NixOS branches that track the Nixpkgs/NixOS channels", | ||
"homepage": null, | ||
"owner": "NixOS", | ||
"repo": "nixpkgs-channels", | ||
"rev": "e2bb73ce5f786b83e984b80199112f86b8a6cc9d", | ||
"sha256": "0mpcdwhippvgsj3kj8vw35dgz94dnzgxgsfqqzcfpmvnzjc23vk7", | ||
"type": "tarball", | ||
"url": "https://github.com/NixOS/nixpkgs-channels/archive/e2bb73ce5f786b83e984b80199112f86b8a6cc9d.tar.gz", | ||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we improve the comment, i mean, this file is originates from SBTix but as far as i know we also added some stuff.