Nix Build + Monorepo Structure (#1196)

This commit is contained in:
benjamin-tlon 2019-03-04 16:43:53 -08:00 committed by GitHub
parent 19a53f97c7
commit aee35d6d20
335 changed files with 2229 additions and 1422 deletions

40
.gitignore vendored
View File

@ -1,35 +1,7 @@
# subrepositories, downloaded pills
/arvo/
*.pill
# autoconf
/.MAKEFILE-VERSION
/make.conf
/.make.conf
# intermediate
*.swo
*.swp
*.o
/outside/**/*.a
/outside/re2/obj
# build
/bin/
/vere.pkg
.tags
.etags
GPATH
GTAGS
GRTAGS
# scratch
/zod/
# dependencies
node_modules/
.sass-cache
# OS
.DS_Store
# ??
/inst
cscope.*
build/
TAGS
/fakezod
/out
/result
/result-*
/work
/zod
/fakezod*
tags

42
.gitmodules vendored
View File

@ -1,30 +1,12 @@
[submodule "subprojects/argon2"]
path = subprojects/argon2
url = https://github.com/urbit/argon2.git
[submodule "subprojects/ed25519"]
path = subprojects/ed25519
url = https://github.com/urbit/ed25519.git
[submodule "subprojects/h2o"]
path = subprojects/libh2o
url = https://github.com/urbit/h2o.git
[submodule "subprojects/libent"]
path = subprojects/libent
url = https://github.com/urbit/libent.git
[submodule "subprojects/libuv"]
path = subprojects/libuv
url = https://github.com/urbit/libuv.git
[submodule "subprojects/libscrypt"]
path = subprojects/libscrypt
url = https://github.com/urbit/libscrypt.git
[submodule "subprojects/libsni"]
path = subprojects/libsni
url = https://github.com/urbit/sniproxy
[submodule "subprojects/murmur3"]
path = subprojects/murmur3
url = https://github.com/urbit/murmur3.git
[submodule "subprojects/secp256k1"]
path = subprojects/secp256k1
url = https://github.com/urbit/secp256k1.git
[submodule "subprojects/softfloat3"]
path = subprojects/softfloat3
url = https://github.com/urbit/berkeley-softfloat-3.git
[submodule "nix/nixcrpkgs"]
path = nix/nixcrpkgs
url = https://github.com/urbit/nixcrpkgs
[submodule "pkg/urb"]
path = pkg/urb
url = https://github.com/urbit/urb.git
[submodule "pkg/ent"]
path = pkg/ent
url = https://github.com/urbit/libent
[submodule "pkg/arvo"]
path = pkg/arvo
url = https://github.com/urbit/arvo.git

View File

@ -1,62 +1,16 @@
dist: xenial
language: node_js
node_js:
- 4
# Uncomment me if this gets annoying
#
# notifications:
# email: false
before_install:
# try to get pill early, so configuration errors will be quickly caught
- cd .travis
- bash check-trailing-whitespace.sh
- bash get-brass-pill.sh
- cd ..
- wget https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip
- unzip ninja-linux.zip
- sudo mv ninja /usr/bin/
language: nix
nix: 2.1.3
install:
# pwd: ~/urbit
- pip3 install --user -I meson
# nix-env -iA cachix -f https://cachix.org/api/v1/install
before_install:
- git lfs pull
script:
- meson . ./build --buildtype=debugoptimized -Dgc=true -Dprof=true
- cd ./build
- ninja
- ninja test
- sudo ninja install
- cd ../.travis
- npm install
- ulimit -c unlimited -S
- npm run -s test; bash print-core-backtrace.sh $?
addons:
apt:
packages:
- python3
- python3-pip
- python3-setuptools
- python3-wheel
- libgmp3-dev
- libsigsegv-dev
- openssl
- libssl-dev
- libncurses5-dev
- gcc
- libcurl4-gnutls-dev
- unzip
- gdb
# before_deploy: "make deb" # TODO
# deploy:
# skip_cleanup: true
# provider: releases
# prerelease: true # turn this off for official releases
# api_key:
# secure: XX
# file: ./build/urbit # TODO upload package from before_deploy
# on:
# repo: urbit/urbit
# tags: true
# cachix authtoken "$CACHIX_AUTH_TOKEN" >/dev/null
# cachix use urbit
- make
- make test
- sh/update-brass-pill # To verify that this works.
# ./sh/cachix

25
Makefile Normal file
View File

@ -0,0 +1,25 @@
PKGS = minima extrema rusthello prog
################################################################################
.PHONY: build all install release test clean
build:
nix-build --no-out-link
all: build release test
install:
nix-env -f . -iA urbit -iA urbit-debug -iA urb
release:
sh/release urbit linux32
sh/release urbit linux64
sh/release urbit darwin
test:
sh/test
clean:
rm -rf ./out ./work
rm -f result result-*

View File

@ -1,37 +1,8 @@
let
pkgs =
builtins.fetchGit {
name = "nixpkgs-2018-11-13";
url = https://github.com/nixos/nixpkgs/;
rev = "695a3d4254545968fc3015142c5299c0da5ca0a9";
};
pkgs = import ./nix/pkgs {};
deps = import ./nix/deps {};
in
with (import pkgs {});
let
osxdeps = lib.optionals stdenv.isDarwin (
with darwin.apple_sdk.frameworks;
[ Cocoa CoreServices ]);
deps = [ cmark curl gcc gmp libsigsegv meson ncurses ninja pkgconfig zlib
re2c openssl ];
isGitDir = (path: type: type != "directory" || baseNameOf path != ".git");
in
stdenv.mkDerivation {
name = "urbit";
src = builtins.filterSource isGitDir ./.;
buildInputs = osxdeps ++ deps;
mesonFlags = "-Dnix=true";
NIX_LDFLAGS = lib.optionalString stdenv.isDarwin "-framework CoreServices";
}
deps // pkgs

View File

@ -1,55 +0,0 @@
/* j/6/slot.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qf_slot(u3_atom axe,
u3_noun vax)
{
u3_noun fag = u3r_at(axe, u3t(vax));
fprintf(stderr, "slot axe %d\r\n", axe);
if ( u3_none == fag ) {
return u3m_bail(c3__exit);
}
else {
u3_noun typ = u3qfu_peek(
}
c3_w i_w, met_w = c3_min(u3r_met(3, axe), u3r_met(3, vax));
if ( c3n == _slot_fiz(axe, vax) ) {
return c3n;
}
for ( i_w = 0; i_w < met_w; i_w++ ) {
c3_y axe_y = u3r_byte(i_w, axe);
c3_y vax_y = u3r_byte(i_w, vax);
if ( (axe_y >= 'A') && (axe_y <= 'Z') ) axe_y = 0;
if ( (vax_y >= 'A') && (vax_y <= 'Z') ) vax_y = 0;
if ( axe_y && vax_y && (axe_y != vax_y) ) {
return c3n;
}
}
return c3y;
}
u3_noun
u3we_slot(u3_noun cor)
{
u3_noun axe, vax;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &axe, u3x_sam_3, &vax, 0)) ||
(c3n == u3ud(axe)) ||
(c3n == u3du(vax)) )
{
return u3m_bail(c3__fail);
} else {
return u3qf_slot(axe, vax);
}
}

View File

@ -1,45 +0,0 @@
/* j/6/type.c
**
*/
/* new template for type switching
*/
{
u3_noun p_sut, q_sut, r_sut;
if ( c3n == u3du(sut) ) switch ( sut ) {
default: return u3m_bail(c3__fail);
case c3__noun:
{
}
case c3__void:
{
}
}
else switch ( u3h(sut) ) {
default: return u3m_bail(c3__fail);
case c3__atom: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
}
case c3__cell: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
}
case c3__core: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
}
case c3__face: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
}
case c3__fork: p_sut = u3t(sut);
{
}
case c3__hint: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
}
case c3__hold: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
}
}
}

View File

@ -1,424 +0,0 @@
project('urbit', 'c', meson_version: '>=0.29.0')
legacy_meson = false
detect_meson_version = run_command('meson', '--version')
meson_ver = detect_meson_version.stdout()
if(meson_ver == '0.29.0\n')
legacy_meson = true
elif(not meson.version().version_compare('>=0.40.0'))
error('Meson 0.29.0 is last legacy version supported. Otherwise please upgrade to 0.40.0 or higher.')
endif
jets_a_src = [
'jets/a/add.c',
'jets/a/dec.c',
'jets/a/div.c',
'jets/a/gte.c',
'jets/a/gth.c',
'jets/a/lte.c',
'jets/a/lth.c',
'jets/a/mod.c',
'jets/a/mul.c',
'jets/a/sub.c',]
jets_b_src = [
'jets/b/bind.c',
'jets/b/clap.c',
'jets/b/drop.c',
'jets/b/flop.c',
'jets/b/lent.c',
'jets/b/levy.c',
'jets/b/lien.c',
'jets/b/murn.c',
'jets/b/need.c',
'jets/b/reap.c',
'jets/b/reel.c',
'jets/b/roll.c',
'jets/b/skid.c',
'jets/b/skim.c',
'jets/b/skip.c',
'jets/b/scag.c',
'jets/b/slag.c',
'jets/b/snag.c',
'jets/b/sort.c',
'jets/b/turn.c',
'jets/b/weld.c' ]
jets_c_src = [
'jets/c/bex.c',
'jets/c/xeb.c',
'jets/c/can.c',
'jets/c/cap.c',
'jets/c/cat.c',
'jets/c/con.c',
'jets/c/cut.c',
'jets/c/dor.c',
'jets/c/dvr.c',
'jets/c/dis.c',
'jets/c/end.c',
'jets/c/gor.c',
'jets/c/lsh.c',
'jets/c/mas.c',
'jets/c/met.c',
'jets/c/mix.c',
'jets/c/mor.c',
'jets/c/mug.c',
'jets/c/muk.c',
'jets/c/peg.c',
'jets/c/po.c',
'jets/c/pow.c',
'jets/c/rap.c',
'jets/c/rep.c',
'jets/c/rev.c',
'jets/c/rip.c',
'jets/c/ripn.c',
'jets/c/rsh.c',
'jets/c/swp.c',
'jets/c/sqt.c'
]
jets_d_src = [
'jets/d/in_has.c',
'jets/d/in_int.c',
'jets/d/in_gas.c',
'jets/d/in_mer.c',
'jets/d/in_put.c',
'jets/d/in_tap.c',
'jets/d/in_uni.c',
'jets/d/in_wyt.c',
'jets/d/in_bif.c',
'jets/d/in_dif.c',
'jets/d/in_del.c',
'jets/d/by_del.c',
'jets/d/by_gas.c',
'jets/d/by_get.c',
'jets/d/by_has.c',
'jets/d/by_int.c',
'jets/d/by_jab.c',
'jets/d/by_put.c',
'jets/d/by_uni.c',
'jets/d/by_bif.c',
'jets/d/by_dif.c'
]
jets_e_src = [
'jets/e/aes_ecb.c',
'jets/e/aes_cbc.c',
'jets/e/aesc.c',
'jets/e/argon2.c',
'jets/e/blake.c',
'jets/e/cue.c',
'jets/e/fl.c',
'jets/e/hmac.c',
'jets/e/jam.c',
'jets/e/mat.c',
'jets/e/mink.c',
'jets/e/mule.c',
'jets/e/parse.c',
'jets/e/rd.c',
'jets/e/rq.c',
'jets/e/rs.c',
'jets/e/rh.c',
'jets/e/rub.c',
'jets/e/scr.c',
'jets/e/secp.c',
'jets/e/shax.c',
'jets/e/sha1.c',
'jets/e/lore.c',
'jets/e/loss.c',
'jets/e/lune.c',
'jets/e/trip.c',
'jets/e/ripe.c'
]
jets_e_ed_src = [
'jets/e/ed_puck.c',
'jets/e/ed_sign.c',
'jets/e/ed_veri.c',
'jets/e/ed_shar.c'
]
jets_f_src = [
'jets/f/ap.c',
'jets/f/cell.c',
'jets/f/comb.c',
'jets/f/cons.c',
'jets/f/core.c',
'jets/f/face.c',
'jets/f/fitz.c',
'jets/f/flan.c',
'jets/f/flip.c',
'jets/f/flor.c',
'jets/f/fork.c',
'jets/f/hint.c',
'jets/f/hike.c',
'jets/f/look.c',
'jets/f/loot.c'
]
jets_f_ut_src = [
'jets/f/ut.c',
'jets/f/ut_buss.c',
'jets/f/ut_crop.c',
'jets/f/ut_find.c',
'jets/f/ut_fire.c',
'jets/f/ut_fish.c',
'jets/f/ut_fuse.c',
'jets/f/ut_gain.c',
'jets/f/ut_lose.c',
'jets/f/ut_mint.c',
'jets/f/ut_mull.c',
'jets/f/ut_nest.c',
'jets/f/ut_peek.c',
'jets/f/ut_peel.c',
'jets/f/ut_play.c',
'jets/f/ut_repo.c',
'jets/f/ut_rest.c',
'jets/f/ut_tack.c',
'jets/f/ut_toss.c',
'jets/f/ut_wrap.c'
]
jets_src = [
'jets/tree.c'
]
jets_all_src = [
jets_a_src, jets_b_src,
jets_c_src, jets_d_src,
jets_e_src, jets_e_ed_src,
jets_f_src, jets_f_ut_src,
jets_src
]
noun_src = [
'noun/allocate.c',
'noun/events.c',
'noun/hashtable.c',
'noun/imprison.c',
'noun/jets.c',
'noun/manage.c',
'noun/nock.c',
'noun/retrieve.c',
'noun/trace.c',
'noun/vortex.c',
'noun/xtract.c',
'noun/zave.c'
]
vere_lib_src = [
'vere/ames.c',
'vere/behn.c',
'vere/cttp.c',
'vere/dawn.c',
'vere/foil.c',
#'vere/fuse.c',
'vere/http.c',
'vere/ivory.c',
'vere/king.c',
'vere/newt.c',
'vere/pier.c',
'vere/reck.c',
'vere/save.c',
'vere/term.c',
'vere/time.c',
'vere/unix.c',
'vere/walk.c'
]
incdir = include_directories('include/')
conf_data = configuration_data()
conf_data.set('URBIT_VERSION', '"0.7.2"')
conf_data.set('U3_MEMORY_DEBUG', get_option('gc'))
conf_data.set('U3_CPU_DEBUG', get_option('prof'))
conf_data.set('U3_EVENT_TIME_DEBUG', get_option('event-time'))
conf_data.set('U3_MEMORY_LOG', get_option('memory-log'))
osdet = host_machine.system()
cc = meson.get_compiler('c')
os_c_flags = ['-funsigned-char','-ffast-math']
os_deps = [dependency('threads')]
os_link_flags = []
if osdet == 'linux'
conf_data.set('U3_OS_linux', true)
ncurses_dep = dependency('ncurses')
os_deps = os_deps + [ncurses_dep]
elif osdet == 'darwin'
conf_data.set('U3_OS_osx', true)
# os_c_flags = os_c_flags + ['-bind_at_load']
# os_link_flags = ['-framework CoreServices', '-framework CoreFoundation']
if(legacy_meson)
ncurses_dep = find_library('ncurses')
else
ncurses_dep = cc.find_library('ncurses')
endif
os_deps = os_deps + [ncurses_dep]
elif osdet == 'bsd' or osdet == 'freebsd'
conf_data.set('U3_OS_bsd', true)
kvm_dep = cc.find_library('kvm')
ncurses_dep = dependency('ncurses')
os_deps = os_deps + [kvm_dep, ncurses_dep]
elif osdet == 'openbsd'
conf_data.set('U3_OS_bsd', true)
os_link_flags = ['-L/usr/local/lib', '-lgmp', '-lsigsegv', '-lcurses']
gmp_dep = []
sigsegv_dep = []
else
error('Unsupported OS detected:' + osdet)
endif
endian = host_machine.endian()
if endian == 'little'
conf_data.set('U3_OS_ENDIAN_little', true)
else
error('Little endian encoding required')
endif
configure_file(input : 'include/config.h.in',
output : 'config.h',
configuration : conf_data)
# We expect these libs to supplied with the distribution
curl_dep = dependency('libcurl', version: '>=7.19.0')
if (osdet == 'darwin' and not get_option('nix') and
run_command('test', '-d', '/usr/local/opt/openssl/lib').returncode() == 0)
libcrypto = cc.find_library('crypto', dirs: [ '/usr/local/opt/openssl/lib/' ])
libssl = cc.find_library('ssl', dirs: [ '/usr/local/opt/openssl/lib/' ])
openssl_dep = declare_dependency(dependencies: [libcrypto, libssl], include_directories: include_directories('/usr/local/opt/openssl/include'))
else
openssl_dep = dependency('openssl', version: '>=1.0.0')
endif
if(legacy_meson)
gmp_dep = find_library('gmp')
sigsegv_dep = find_library('sigsegv')
elif osdet != 'openbsd'
# XX on OS X with MacPorts, set LIBRARY_PATH=/opt/local/lib to get meson to
# find these.
gmp_dep = cc.find_library('gmp')
sigsegv_dep = cc.find_library('sigsegv')
endif
# For these libs we provide fallback bundle
#
argon2_dep = dependency('argon2', version: '>=1', fallback: ['argon2', 'argon2_dep'])
ed25519_dep = dependency('ed25519', version: '>=0.1.0', fallback: ['ed25519', 'ed25519_dep'])
libscrypt_dep = dependency('libscrypt', version: '>=0.1.21', fallback: ['libscrypt', 'libscrypt_dep'])
murmur3_dep = dependency('murmur3', version: '>=0.1.0', fallback: ['murmur3', 'murmur3_dep'])
secp256k1_dep = dependency('libsecp256k1', version: '>=0.1.0', fallback: ['secp256k1', 'secp256k1_dep'])
softfloat3_dep = dependency('softfloat3', version: '>=3.0.0', fallback: ['softfloat3', 'softfloat3_dep'])
# XX temporary, should only be needed in vere
#
libh2o_dep = dependency('libh2o', version: '>=0.13.3', fallback: ['libh2o', 'libh2o_dep'])
libuv_dep = dependency('libuv', version: '>=1.8.0', fallback:['libuv', 'libuv_dep'])
noun_deps = [argon2_dep,
ed25519_dep,
gmp_dep,
libscrypt_dep,
murmur3_dep,
openssl_dep,
secp256k1_dep,
sigsegv_dep,
softfloat3_dep,
libh2o_dep,
libuv_dep]
libnoun = static_library('noun',
sources: [noun_src, jets_all_src],
include_directories: incdir,
c_args : os_c_flags,
link_args: os_link_flags,
dependencies: noun_deps + os_deps,
install: false
)
# For these two libs we provide fallback bundle
libent_dep = dependency(
'libent',
version: '>=0.2.1',
fallback: ['libent', 'libent_dep'],
)
libsni_dep = dependency(
'libsni',
version: '>=0.5.0',
fallback: ['libsni', 'libsni_dep'],
)
vere_deps = [
curl_dep,
libent_dep,
libh2o_dep,
libsni_dep,
libuv_dep,
openssl_dep,
]
executable('urbit',
sources : vere_lib_src + [ 'vere/main.c' ],
include_directories : incdir,
c_args : os_c_flags,
link_args: os_link_flags,
dependencies: vere_deps + os_deps,
link_with: libnoun,
install: true)
executable('urbit-worker',
sources : vere_lib_src + [ 'vere/serf.c' ],
include_directories : incdir,
c_args : os_c_flags,
link_args: os_link_flags,
dependencies: vere_deps + os_deps,
link_with: libnoun,
install: true)
test_hashtable = executable('test-hashtable',
sources : vere_lib_src + ['tests/hashtable_tests.c'],
include_directories : incdir,
c_args : os_c_flags,
link_args: os_link_flags,
dependencies: vere_deps + os_deps,
link_with: libnoun,
install: false)
test('test-hashtable', test_hashtable)
test_mem = executable('test-mem',
sources : vere_lib_src + ['tests/test.c'],
include_directories : incdir,
c_args : os_c_flags,
link_args: os_link_flags,
dependencies: vere_deps + os_deps,
link_with: libnoun,
install: false)
test('test-mem', test_mem, should_fail: true)
test_hash = executable('test-hash',
sources : vere_lib_src + ['tests/hash_tests.c'],
include_directories : incdir,
c_args : os_c_flags,
link_args: os_link_flags,
dependencies: vere_deps + os_deps,
link_with: libnoun,
install: false)
test('test-hash', test_hash)

View File

@ -1,10 +0,0 @@
option('gc', type : 'boolean', value : false,
description : 'Add debugging information to heap. Run with -g. Breaks image.')
option('prof', type : 'boolean', value : false,
description : 'Activate profiling. Run with -P.')
option('event-time', type : 'boolean', value : false,
description : 'Print timing information per event.')
option('memory-log', type : 'boolean', value : false,
description : 'Write memory usage to a logfile.')
option('nix', type: 'boolean', value: false,
description: 'Build using nix.')

13
nix/crossdeps.nix Normal file
View File

@ -0,0 +1,13 @@
crossenv:
rec {
argon2 = import ./deps/argon2/cross.nix { inherit crossenv; };
murmur3 = import ./deps/murmur3/cross.nix { inherit crossenv; };
uv = import ./deps/uv/cross.nix { inherit crossenv; };
ed25519 = import ./deps/ed25519/cross.nix { inherit crossenv; };
sni = import ./deps/sni/cross.nix { inherit crossenv; };
scrypt = import ./deps/scrypt/cross.nix { inherit crossenv; };
softfloat3 = import ./deps/softfloat3/cross.nix { inherit crossenv; };
secp256k1 = import ./deps/secp256k1/cross.nix { inherit crossenv; };
h2o = import ./deps/h2o/cross.nix { inherit crossenv uv; };
}

19
nix/dep-repos.nix Normal file
View File

@ -0,0 +1,19 @@
# This is a hack to give us access to the fetching of dependency repos
# as nix builds. We use this to cache those Cachix for faster rebuilds
# in CI.
with (import ./deps {});
{
argon2-src = argon2.src;
ed25519-src = ed25519.src;
ent-src = ent.src;
h2o-src = h2o.src;
murmur3-src = murmur3.src;
nodehello-src = nodehello.src;
scrypt-src = scrypt.src;
secp256k1-src = secp256k1.src;
sni-src = sni.src;
softfloat3-src = softfloat3.src;
uv-src = uv.src;
}

31
nix/deps-env.nix Normal file
View File

@ -0,0 +1,31 @@
let
pkgs = import ./nixpkgs.nix;
tlon = import ./pkgs { pkgs=pkgs; };
deps = import ./deps { pkgs=pkgs; };
tools =
with pkgs;
[ cargo rustc meson ninja pkgconfig libtool gdb ];
libs =
with pkgs;
[ openssl zlib curl gmp scrypt libsigsegv ncurses openssl zlib ];
osx =
with pkgs;
lib.optionals stdenv.isDarwin (
with darwin.apple_sdk.frameworks;
[ Cocoa CoreServices ]);
vendor =
with deps;
[ argon2 ed25519 h2o murmur3 scrypt secp256k1 sni softfloat3 uv ent ];
in
pkgs.stdenv.mkDerivation rec {
name = "urbit-deps-env";
env = pkgs.buildEnv { name = name; paths = buildInputs; };
buildInputs = tools ++ libs ++ osx ++ vendor;
}

View File

@ -0,0 +1,14 @@
source $stdenv/setup
cp -r $src ./src
chmod -R a+w ./src
cd ./src
sed -i 's|ar rcs|${AR} rcs|' Makefile
make libargon2.a -j4
mkdir -p $out/{lib,include}
cp libargon2.a $out/lib
cp include/argon2.h $out/include
cp ./src/blake2/*.h $out/include

17
nix/deps/argon2/cross.nix Normal file
View File

@ -0,0 +1,17 @@
{ crossenv }:
crossenv.make_derivation rec {
name = "argon2-4da94";
builder = ./builder.sh;
CC = "${crossenv.host}-gcc";
AR = "${crossenv.host}-ar";
NO_THREADS = true;
src = crossenv.nixpkgs.fetchFromGitHub {
owner = "urbit";
repo = "argon2";
rev = "4da94a611ee62bad87ab2b131ffda3bcc0723d9c";
sha256 = "0bqq1hg367l4jkb6cqhxlblpvdbwz3l586qsfakwzfd9wdvnm3yc";
};
}

View File

@ -0,0 +1,13 @@
{ pkgs }:
pkgs.stdenv.mkDerivation rec {
name = "argon2-4da94";
builder = ./builder.sh;
NO_THREADS = true;
src = pkgs.fetchFromGitHub {
owner = "urbit";
repo = "argon2";
rev = "4da94a611ee62bad87ab2b131ffda3bcc0723d9c";
sha256 = "0bqq1hg367l4jkb6cqhxlblpvdbwz3l586qsfakwzfd9wdvnm3yc";
};
}

13
nix/deps/default.nix Normal file
View File

@ -0,0 +1,13 @@
{ pkgs ? import ../nixpkgs.nix }:
rec {
argon2 = import ./argon2 { inherit pkgs; };
murmur3 = import ./murmur3 { inherit pkgs; };
uv = import ./uv { inherit pkgs; };
ed25519 = import ./ed25519 { inherit pkgs; };
sni = import ./sni { inherit pkgs; };
scrypt = import ./scrypt { inherit pkgs; };
softfloat3 = import ./softfloat3 { inherit pkgs; };
secp256k1 = import ./secp256k1 { inherit pkgs; };
h2o = import ./h2o { inherit pkgs uv; };
}

View File

@ -0,0 +1,29 @@
source $stdenv/setup
sources=" \
$src/src/add_scalar.c \
$src/src/seed.c \
$src/src/verify.c \
$src/src/add_scalar.c \
$src/src/sha512.c \
$src/src/ge.c \
$src/src/fe.c \
$src/src/keypair.c \
$src/src/sign.c \
$src/src/sc.c \
$src/src/key_exchange.c \
"
CFLAGS="-O3 -Wall -I$src/src"
for fn in $sources
do echo $CC $CFLAGS -c $fn -o $(basename $fn).o
$CC -O3 -Wall -I$src/src -c $fn -o $(basename $fn).o
done
mkdir -p $out/{lib,include}
$AR rcs $out/lib/libed25519.a *.o
echo $AR rcs $out/lib/libed25519.a *.o
cp $src/src/*.h $out/include

View File

@ -0,0 +1,16 @@
{ crossenv }:
crossenv.make_derivation rec {
name = "ed25519-76385";
builder = ./builder.sh;
CC = "${crossenv.host}-gcc";
AR = "${crossenv.host}-ar";
src = crossenv.nixpkgs.fetchFromGitHub {
owner = "urbit";
repo = "ed25519";
rev = "76385f2ebbbc9580a9c236952d68d11d73a6135c";
sha256 = "0s1spif4s9lgcwcny3fl2fvpbw6acqn3s8r6qxnrmkd9icgyw4cp";
};
}

View File

@ -0,0 +1,12 @@
{ pkgs }:
pkgs.stdenv.mkDerivation rec {
name = "ed25519-76385";
builder = ./builder.sh;
src = pkgs.fetchFromGitHub {
owner = "urbit";
repo = "ed25519";
rev = "76385f2ebbbc9580a9c236952d68d11d73a6135c";
sha256 = "0s1spif4s9lgcwcny3fl2fvpbw6acqn3s8r6qxnrmkd9icgyw4cp";
};
}

109
nix/deps/h2o/builder.sh Normal file
View File

@ -0,0 +1,109 @@
source $stdenv/setup
sources=" \
deps/cloexec/cloexec.c \
deps/libgkc/gkc.c \
deps/libyrmcds/close.c \
deps/libyrmcds/connect.c \
deps/libyrmcds/recv.c \
deps/libyrmcds/send.c \
deps/libyrmcds/send_text.c \
deps/libyrmcds/socket.c \
deps/libyrmcds/strerror.c \
deps/libyrmcds/text_mode.c \
deps/picohttpparser/picohttpparser.c \
lib/common/cache.c \
lib/common/file.c \
lib/common/filecache.c \
lib/common/hostinfo.c \
lib/common/http1client.c \
lib/common/memcached.c \
lib/common/memory.c \
lib/common/multithread.c \
lib/common/serverutil.c \
lib/common/socket.c \
lib/common/socketpool.c \
lib/common/string.c \
lib/common/time.c \
lib/common/timeout.c \
lib/common/url.c \
lib/core/config.c \
lib/core/configurator.c \
lib/core/context.c \
lib/core/headers.c \
lib/core/logconf.c \
lib/core/proxy.c \
lib/core/request.c \
lib/core/token.c \
lib/core/util.c \
lib/handler/access_log.c \
lib/handler/chunked.c \
lib/handler/compress.c \
lib/handler/compress/gzip.c \
lib/handler/errordoc.c \
lib/handler/expires.c \
lib/handler/fastcgi.c \
lib/handler/file.c \
lib/handler/headers.c \
lib/handler/mimemap.c \
lib/handler/proxy.c \
lib/handler/redirect.c \
lib/handler/reproxy.c \
lib/handler/throttle_resp.c \
lib/handler/status.c \
lib/handler/headers_util.c \
lib/handler/status/events.c \
lib/handler/status/requests.c \
lib/handler/http2_debug_state.c \
lib/handler/status/durations.c \
lib/handler/configurator/access_log.c \
lib/handler/configurator/compress.c \
lib/handler/configurator/errordoc.c \
lib/handler/configurator/expires.c \
lib/handler/configurator/fastcgi.c \
lib/handler/configurator/file.c \
lib/handler/configurator/headers.c \
lib/handler/configurator/proxy.c \
lib/handler/configurator/redirect.c \
lib/handler/configurator/reproxy.c \
lib/handler/configurator/throttle_resp.c \
lib/handler/configurator/status.c \
lib/handler/configurator/http2_debug_state.c \
lib/handler/configurator/headers_util.c \
lib/http1.c \
lib/tunnel.c \
lib/http2/cache_digests.c \
lib/http2/casper.c \
lib/http2/connection.c \
lib/http2/frame.c \
lib/http2/hpack.c \
lib/http2/scheduler.c \
lib/http2/stream.c \
lib/http2/http2_debug_state.c \
"
CFLAGS=" \
-O3 \
-Wall -Wno-unused-value -Wno-unused-function \
-I$src/include \
-I$src/deps/cloexec \
-I$src/deps/brotli/enc \
-I$src/deps/golombset \
-I$src/deps/libgkc \
-I$src/deps/libyrmcds \
-I$src/deps/klib \
-I$src/deps/neverbleed \
-I$src/deps/picohttpparser \
-I$src/deps/picotest \
-I$src/deps/yaml/include \
-I$src/deps/yoml
"
for s in $sources
do cc $CFLAGS -c $src/$s -o $(sed 's|/|_|g; s/.c$/.o/' <<< $s)
done
mkdir -p $out/{lib,include}
ar rcs $out/lib/libh2o.a *.o
cp -r $src/include/* $out/include
cp $src/deps/picohttpparser/picohttpparser.h $out/include

17
nix/deps/h2o/cross.nix Normal file
View File

@ -0,0 +1,17 @@
{ crossenv, uv }:
crossenv.make_derivation rec {
inherit (crossenv) openssl zlib;
inherit uv;
name = "h2o-0ed9a";
cross_inputs = [ uv crossenv.openssl crossenv.zlib ];
builder = ./cross.sh;
src = crossenv.nixpkgs.fetchFromGitHub {
owner = "urbit";
repo = "h2o";
rev = "0ed9ac70757a16ec45f91b8a347850d9699c3fb1";
sha256 = "16b5zbwdq371hhqga76dh7x4c0qr3xb5ah9r8hnm6rip460p6xpm";
};
}

26
nix/deps/h2o/cross.sh Normal file
View File

@ -0,0 +1,26 @@
source $stdenv/setup
cp -r $src src
chmod -R u+w src
cd src
cmake-cross . \
-DZLIB_LIBRARY=$zlib/lib/libz.a \
-DZLIB_INCLUDE_DIR=$zlib/include \
-DCMAKE_INSTALL_PREFIX=$out \
-DBUILD_SHARED_LIBS=off \
-DWITH_MRUBY=off \
-DWITH_BUNDLED_SSL=off \
-DWITH_PICOTLS=on
make libh2o
mkdir -p $out/{lib,lib/pkgconfig,include}
cp ./libh2o.a $out/lib
cp ./libh2o.pc $out/lib/pkgconfig
cp -r include/* $out/include
cp deps/picohttpparser/picohttpparser.h $out/include

13
nix/deps/h2o/default.nix Normal file
View File

@ -0,0 +1,13 @@
{ pkgs, uv }:
pkgs.stdenv.mkDerivation rec {
name = "h2o-0ed9a";
buildInputs = [ uv pkgs.openssl pkgs.zlib ];
builder = ./builder.sh;
src = pkgs.fetchFromGitHub {
owner = "urbit";
repo = "h2o";
rev = "0ed9ac70757a16ec45f91b8a347850d9699c3fb1";
sha256 = "16b5zbwdq371hhqga76dh7x4c0qr3xb5ah9r8hnm6rip460p6xpm";
};
}

View File

@ -0,0 +1,11 @@
source $stdenv/setup
echo $CC -fPIC -O3 -o murmur3.o -c $src/murmur3.c
$CC -fPIC -O3 -o murmur3.o -c $src/murmur3.c
mkdir -p $out/{lib,include}
echo $AR rcs $out/lib/libmurmur3.a murmur3.o
$AR rcs $out/lib/libmurmur3.a murmur3.o
cp $src/murmur3.h $out/include

View File

@ -0,0 +1,16 @@
{ crossenv }:
crossenv.make_derivation rec {
name = "murmur3-71a75";
builder = ./builder.sh;
CC = "${crossenv.host}-gcc";
AR = "${crossenv.host}-ar";
src = crossenv.nixpkgs.fetchFromGitHub {
owner = "urbit";
repo = "murmur3";
rev = "71a75d57ca4e7ca0f7fc2fd84abd93595b0624ca";
sha256 = "0k7jq2nb4ad9ajkr6wc4w2yy2f2hkwm3nkbj2pklqgwsg6flxzwg";
};
}

View File

@ -0,0 +1,12 @@
{ pkgs }:
pkgs.stdenv.mkDerivation rec {
name = "murmur3-71a75";
builder = ./builder.sh;
src = pkgs.fetchFromGitHub {
owner = "urbit";
repo = "murmur3";
rev = "71a75d57ca4e7ca0f7fc2fd84abd93595b0624ca";
sha256 = "0k7jq2nb4ad9ajkr6wc4w2yy2f2hkwm3nkbj2pklqgwsg6flxzwg";
};
}

View File

@ -0,0 +1,27 @@
source $stdenv/setup
sources=" \
crypto_scrypt-check \
crypto_scrypt-hash \
crypto_scrypt-hexconvert \
crypto_scrypt-nosse \
crypto-mcf \
crypto-scrypt-saltgen \
slowequals \
sha256 \
b64 \
"
CFLAGS="-I$src -Wall -ffast-math -O3 -D_FORTIFY_SOURCE=2 -fstack-protector"
for s in $sources
do echo $CC $CFLAGS -c $src/$s.c -o $s.o
$CC $CFLAGS -c $src/$s.c -o $s.o
done
echo $AR rcs libscrypt.a *.o
$AR rcs libscrypt.a *.o
mkdir -p $out/{lib,include}
cp libscrypt.a $out/lib
cp $src/*.h $out/include

16
nix/deps/scrypt/cross.nix Normal file
View File

@ -0,0 +1,16 @@
{ crossenv }:
crossenv.make_derivation rec {
name = "scrypt-02969";
builder = ./builder.sh;
CC = "${crossenv.host}-gcc";
AR = "${crossenv.host}-ar";
src = crossenv.nixpkgs.fetchFromGitHub {
owner = "urbit";
repo = "libscrypt";
rev = "029693ff1cbe4f69d3a2da87d0f4f034f92cc0c2";
sha256 = "17pcxypzjmmrvacw45cacvibm6mlr9ip30hy30l1appsnywx679n";
};
}

View File

@ -0,0 +1,12 @@
{ pkgs }:
pkgs.stdenv.mkDerivation rec {
name = "scrypt-02969";
builder = ./builder.sh;
src = pkgs.fetchFromGitHub {
owner = "urbit";
repo = "libscrypt";
rev = "029693ff1cbe4f69d3a2da87d0f4f034f92cc0c2";
sha256 = "17pcxypzjmmrvacw45cacvibm6mlr9ip30hy30l1appsnywx679n";
};
}

View File

@ -0,0 +1,11 @@
source $stdenv/setup
cp -r $src ./src
chmod -R u+w ./src
cd src
libtoolize
./autogen.sh
./configure --prefix=$out --host=$host $configureFlags
make
make install

View File

@ -0,0 +1,25 @@
{ crossenv }:
crossenv.make_derivation rec {
name = "secp256k1-b4e87";
builder = ./builder.sh;
CFLAGS = "-fPIC";
configureFlags = [
"--disable-shared"
"--enable-module-recovery"
];
cross_inputs = [ crossenv.libgmp ];
native_inputs =
with crossenv.nixpkgs;
[ autoconf automake libtool m4 ];
src = crossenv.nixpkgs.fetchFromGitHub {
owner = "bitcoin-core";
repo = "secp256k1";
rev = "e34ceb333b1c0e6f4115ecbb80c632ac1042fa49";
sha256 = "0as78s179hcr3ysk3fw98k5wzabgnwri7vkkc17wg31lyz6ids6c";
};
}

View File

@ -0,0 +1,25 @@
{ pkgs }:
pkgs.stdenv.mkDerivation rec {
name = "secp256k1-b4e87";
builder = ./builder.sh;
CFLAGS = "-fPIC";
configureFlags = [
"--disable-shared"
"--enable-module-recovery"
];
buildInputs = [ pkgs.gmp ];
nativeBuildInputs =
with pkgs;
[ autoconf automake libtool m4 ];
src = pkgs.fetchFromGitHub {
owner = "bitcoin-core";
repo = "secp256k1";
rev = "e34ceb333b1c0e6f4115ecbb80c632ac1042fa49";
sha256 = "0as78s179hcr3ysk3fw98k5wzabgnwri7vkkc17wg31lyz6ids6c";
};
}

13
nix/deps/sni/builder.sh Normal file
View File

@ -0,0 +1,13 @@
source $stdenv/setup
CFLAGS="-O3 -Wall -ffast-math -Wno-unused-const-variable"
echo $CC $CFLAGS -c $src/src/tls.c -o tls.o
$CC $CFLAGS -c $src/src/tls.c -o tls.o
echo $AR rcs libsni.a tls.o
$AR rcs libsni.a tls.o
mkdir -p $out/{lib,include}
cp libsni.a $out/lib/
cp $src/src/tls.h $out/include/

18
nix/deps/sni/cross.nix Normal file
View File

@ -0,0 +1,18 @@
{ crossenv }:
crossenv.make_derivation rec {
name = "sni";
builder = ./builder.sh;
CC = "${crossenv.host}-gcc";
AR = "${crossenv.host}-ar";
src = crossenv.nixpkgs.fetchFromGitHub {
owner = "urbit";
repo = "sniproxy";
rev = "173beb88ee62bddd13874ca04ab338cdec704928";
sha256 = "1ib6p7vhpvbg6d5a2aimppsb09kjg4px4vlw5h3ys9zf9c1if5z4";
};
}

12
nix/deps/sni/default.nix Normal file
View File

@ -0,0 +1,12 @@
{ pkgs }:
pkgs.stdenv.mkDerivation rec {
name = "sni";
builder = ./builder.sh;
src = pkgs.fetchFromGitHub {
owner = "urbit";
repo = "sniproxy";
rev = "173beb88ee62bddd13874ca04ab338cdec704928";
sha256 = "1ib6p7vhpvbg6d5a2aimppsb09kjg4px4vlw5h3ys9zf9c1if5z4";
};
}

View File

@ -0,0 +1,15 @@
source $stdenv/setup
cp -r $src $TMP/$name
chmod -R u+w $TMP/$name
cd $TMP/$name
cd ./build/Linux-386-SSE2-GCC
sed -i 's|gcc|$(CC)|' Makefile
sed -i 's/ar crs/$(AR) crs/' Makefile
make -j4
mkdir -p $out/{lib,include}
cp $src/source/include/*.h $out/include
cp softfloat.a $out/lib/libsoftfloat3.a

View File

@ -0,0 +1,16 @@
{ crossenv }:
crossenv.make_derivation rec {
name = "softfloat3-ec4c7";
builder = ./builder.sh;
CC = "${crossenv.host}-gcc";
AR = "${crossenv.host}-ar";
src = crossenv.nixpkgs.fetchFromGitHub {
owner = "urbit";
repo = "berkeley-softfloat-3";
rev = "ec4c7e31b32e07aad80e52f65ff46ac6d6aad986";
sha256 = "1lz4bazbf7lns1xh8aam19c814a4n4czq5xsq5rmi9sgqw910339";
};
}

View File

@ -0,0 +1,12 @@
{ pkgs }:
pkgs.stdenv.mkDerivation rec {
name = "softfloat3-ec4c7";
builder = ./builder.sh;
src = pkgs.fetchFromGitHub {
owner = "urbit";
repo = "berkeley-softfloat-3";
rev = "ec4c7e31b32e07aad80e52f65ff46ac6d6aad986";
sha256 = "1lz4bazbf7lns1xh8aam19c814a4n4czq5xsq5rmi9sgqw910339";
};
}

9
nix/deps/uv/builder.sh Normal file
View File

@ -0,0 +1,9 @@
source $stdenv/setup
cp -r $src ./src
chmod -R a+w ./src
cd ./src
LIBTOOLIZE=libtoolize ./autogen.sh
./configure --prefix=$out --host=$host $configureFlags
make install

17
nix/deps/uv/cross.nix Normal file
View File

@ -0,0 +1,17 @@
{ crossenv }:
crossenv.make_derivation rec {
name = "uv-64294";
native_inputs = with crossenv.nixpkgs; [ autoconf automake libtool m4 ];
builder = ./builder.sh;
configureFlags = [ "--disable-shared" ];
CFLAGS = "-fPIC";
src = crossenv.nixpkgs.fetchFromGitHub {
owner = "urbit";
repo = "libuv";
rev = "6429495dc9a80aaf1c243038b381451f12bc7dcf";
sha256 = "07m2m4v9mds0wihzjxjwswwfj3rnk2ycr3vgwfcrvnb5xjz7rs15";
};
}

27
nix/deps/uv/default.nix Normal file
View File

@ -0,0 +1,27 @@
{ pkgs }:
let
osx =
with pkgs;
lib.optionals stdenv.isDarwin (
with darwin.apple_sdk.frameworks;
[ Cocoa CoreServices ]);
in
pkgs.stdenv.mkDerivation rec {
name = "uv-64294";
buildInputs = osx ++ (with pkgs; [ autoconf automake libtool m4 ]);
builder = ./builder.sh;
CFLAGS = "-fPIC";
configureFlags = [ "--disable-shared" ];
src = pkgs.fetchFromGitHub {
owner = "urbit";
repo = "libuv";
rev = "6429495dc9a80aaf1c243038b381451f12bc7dcf";
sha256 = "07m2m4v9mds0wihzjxjwswwfj3rnk2ycr3vgwfcrvnb5xjz7rs15";
};
}

1
nix/nixcrpkgs Submodule

@ -0,0 +1 @@
Subproject commit 59c86f2709001a62e1d82e3c41fd01c4f236bdd7

7
nix/nixcrpkgs.nix Normal file
View File

@ -0,0 +1,7 @@
let
nixpkgs = import ./nixpkgs.nix;
in
import ./nixcrpkgs/top.nix { inherit nixpkgs; }

13
nix/nixpkgs.nix Normal file
View File

@ -0,0 +1,13 @@
let
rev = "61c3169a0e17d789c566d5b241bfe309ce4a6275";
hash = "0qbycg7wkb71v20rchlkafrjfpbk2fnlvvbh3ai9pyfisci5wxvq";
pkgs = builtins.fetchTarball {
name = "nixpkgs-2019-01-15";
url = "https://github.com/nixos/nixpkgs/archive/${rev}.tar.gz";
sha256 = hash;
};
in
import pkgs {}

27
nix/ops/brass/builder.sh Executable file
View File

@ -0,0 +1,27 @@
source $stdenv/setup
set -ex
cp -r $FAKEZOD ./zod
chmod -R u+rw ./zod
urbit -d ./zod
cleanup () {
if [ -e ./zod/.vere.lock ]
then kill $(< ./zod/.vere.lock) || true;
fi
}
trap cleanup EXIT
urb ./zod -p hood -d '+hood/autoload |'
urb ./zod -p hood -d "+hood/mount %"
rm -r ./zod/home
cp -r $ARVO ./zod/home
urb ./zod -p hood -d "+hood/commit %home"
urb ./zod -P brass.pill -d '+brass'
mv brass.pill $out

10
nix/ops/brass/default.nix Normal file
View File

@ -0,0 +1,10 @@
{ pkgs, tlon, deps, urbit, fakezod, arvo }:
pkgs.stdenv.mkDerivation rec {
name = "brass";
builder = ./builder.sh;
buildInputs = [ urbit tlon.urb pkgs.coreutils ];
FAKEZOD = fakezod;
ARVO = arvo;
}

46
nix/ops/default.nix Normal file
View File

@ -0,0 +1,46 @@
{ pkgs ? import ../nixpkgs.nix }:
let
deps = import ../deps { inherit pkgs; };
tlon = import ../pkgs { inherit pkgs; };
arvo = tlon.arvo;
urbit = tlon.urbit;
in
rec {
bootzod = import ./fakeship {
inherit pkgs tlon deps urbit;
brass = ../../bin/brass.pill;
ship = "zod";
};
bootbus = import ./fakeship {
inherit pkgs tlon deps urbit;
brass = ../../bin/brass.pill;
ship = "bus";
};
test = import ./test {
inherit pkgs tlon deps urbit arvo;
ship = bootzod;
};
solid = import ./solid {
inherit arvo pkgs tlon deps urbit;
fakezod = bootzod;
};
brass = import ./brass {
inherit arvo pkgs tlon deps urbit;
fakezod = bootzod;
};
fakezod = import ./fakeship {
inherit pkgs tlon deps urbit brass;
ship = "zod";
};
}

19
nix/ops/fakeship/builder.sh Executable file
View File

@ -0,0 +1,19 @@
source $stdenv/setup
set -ex
urbit -d -F $SHIP -B "$PILL" $out
check () {
[ 3 -eq "$(urb $out -d 3)" ]
}
if check
then
echo "Boot success." >&2
urb $out -p hood -d '+hood/exit' || true
else
echo "Boot failure." >&2
kill $(< $out/.vere.lock) || true
exit 1
fi

View File

@ -0,0 +1,9 @@
{ pkgs, tlon, deps, urbit, brass, ship ? "zod" }:
pkgs.stdenv.mkDerivation rec {
name = "fake" + ship;
builder = ./builder.sh;
buildInputs = [ urbit tlon.urb ];
PILL = brass;
SHIP = ship;
}

31
nix/ops/solid/builder.sh Executable file
View File

@ -0,0 +1,31 @@
source $stdenv/setup
set -ex
cp -r $FAKEZOD ./zod
chmod -R u+rw ./zod
urbit -d ./zod
cleanup () {
if [ -e ./zod/.vere.lock ]
then kill $(< ./zod/.vere.lock) || true;
fi
}
trap cleanup EXIT
urb ./zod -p hood -d '+hood/autoload |'
urb ./zod -p hood -d "+hood/mount %"
rm -r ./zod/home
cp -r $ARVO ./zod/home
# cp -r $ARVO/sys ./zod/home/
# cp $ARVO/gen/solid.hoon ./zod/home/gen/
# cp $ARVO/lib/pill.hoon ./zod/home/lib/
urb ./zod -p hood -d "+hood/commit %home"
urb ./zod -P urbit.pill -d '+solid, =dub &'
mv urbit.pill $out

10
nix/ops/solid/default.nix Normal file
View File

@ -0,0 +1,10 @@
{ pkgs, tlon, deps, urbit, fakezod, arvo }:
pkgs.stdenv.mkDerivation rec {
name = "solid";
builder = ./builder.sh;
buildInputs = [ urbit tlon.urb pkgs.coreutils ];
FAKEZOD = fakezod;
ARVO = arvo;
}

65
nix/ops/test/builder.sh Normal file
View File

@ -0,0 +1,65 @@
source $stdenv/setup
set -ex
cp -r $SHIP ./ship
chmod -R u+rw ./ship
urbit -d ./ship 2> urbit-output
tail -f urbit-output >&2 &
tailproc=$!
shutdown () {
if [ -e ./ship/.vere.lock ]
then kill $(< ./ship/.vere.lock) || true;
fi
kill "$tailproc" || true;
}
trap shutdown EXIT
urb ./ship -p hood -d '+hood/autoload |'
urb ./ship -p hood -d '+hood/mount %'
rm -r ./ship/home
cp -r $ARVO ./ship/home
urb ./ship -p hood -d '+hood/commit %home'
# Start the test app
urb ./ship -p hood -d '+hood/start %test'
# Run the %cores tests
urb ./ship -d '~& ~ ~& %start-test-cores ~'
urb ./ship -p test -d ':- %cores /'
urb ./ship -d '~& %finish-test-cores ~'
# Run the %renders tests
urb ./ship -d '~& ~ ~& %start-test-renders ~'
urb ./ship -p test -d ':- %renders /'
urb ./ship -d '~& %finish-test-renders ~'
# Run the test generator
urb ./ship -d '+test' | tee test-generator-output
shutdown
# Collect output
cp urbit-output test-cores-output
cp urbit-output test-renders-output
rm urbit-output
sed -i '0,/start-test-renders/d' test-renders-output
sed -i '/finish-test-renders/,$d' test-renders-output
sed -i '0,/start-test-cores/d' test-cores-output
sed -i '/finish-test-cores/,$d' test-cores-output
mkdir $out
cp test-renders-output $out/renders
cp test-cores-output $out/cores
cp test-generator-output $out/generator

10
nix/ops/test/default.nix Normal file
View File

@ -0,0 +1,10 @@
{ pkgs, tlon, deps, urbit, ship, arvo }:
pkgs.stdenv.mkDerivation rec {
name = "test";
builder = ./builder.sh;
buildInputs = [ urbit tlon.urb pkgs.coreutils ];
SHIP = ship;
ARVO = arvo;
}

3
nix/pkgs/arvo/builder.sh Normal file
View File

@ -0,0 +1,3 @@
source $stdenv/setup
cp -r $src $out

View File

@ -0,0 +1,7 @@
{ pkgs }:
pkgs.stdenv.mkDerivation {
name = "arvo";
builder = ./builder.sh;
src = pkgs.buildRustCrateHelpers.exclude [ ".git" ] ../../../pkg/arvo;
}

29
nix/pkgs/default.nix Normal file
View File

@ -0,0 +1,29 @@
{ pkgs ? import ../nixpkgs.nix }:
let
deps = import ../deps { inherit pkgs; };
in
rec {
arvo = import ./arvo { inherit pkgs; };
ent = import ./ent { inherit pkgs; };
urb = import ../../pkg/urb { inherit pkgs; };
urbit = import ./urbit {
inherit pkgs ent;
inherit (deps) argon2 murmur3 uv ed25519 sni scrypt softfloat3;
inherit (deps) secp256k1 h2o;
name = "urbit";
debug = false;
};
urbit-debug = import ./urbit {
inherit pkgs ent;
inherit (deps) argon2 murmur3 uv ed25519 sni scrypt softfloat3;
inherit (deps) secp256k1 h2o;
name = "urbit-debug";
debug = true;
};
}

8
nix/pkgs/ent/builder.sh Normal file
View File

@ -0,0 +1,8 @@
source $stdenv/setup
cp -r $src ./src
chmod -R u+w ./src
cd ./src
./configure
PREFIX=$out make install

10
nix/pkgs/ent/cross.nix Normal file
View File

@ -0,0 +1,10 @@
{ env_name, env, deps }:
env.make_derivation rec {
name = "ent-7506f";
builder = ./builder.sh;
src = ../../../pkg/ent;
CC = "${env.host}-gcc";
AR = "${env.host}-ar";
}

7
nix/pkgs/ent/default.nix Normal file
View File

@ -0,0 +1,7 @@
{ pkgs }:
pkgs.stdenv.mkDerivation rec {
name = "ent-7506f";
builder = ./builder.sh;
src = ../../../pkg/ent;
}

13
nix/pkgs/urbit/builder.sh Normal file
View File

@ -0,0 +1,13 @@
source $stdenv/setup
cp -r $src ./src
chmod -R u+w ./src
cd src
./configure
make urbit urbit-worker -j8
mkdir -p $out/bin
cp urbit $out/bin/$exename
cp urbit-worker $out/bin/$exename-worker

View File

@ -0,0 +1,44 @@
{
pkgs,
name ? "urbit",
debug ? false,
argon2, ed25519, ent, h2o, murmur3, scrypt, secp256k1, sni, softfloat3, uv
}:
let
deps =
with pkgs;
[ curl gmp libsigsegv ncurses openssl zlib ];
vendor =
[ argon2 softfloat3 ed25519 ent h2o scrypt uv murmur3 secp256k1 sni ];
# osx =
# with pkgs;
# lib.optionals stdenv.isDarwin (
# with darwin.apple_sdk.frameworks;
# [ Cocoa CoreServices ]);
# NIX_LDFLAGS =
# pkgs.lib.optionalString pkgs.stdenv.isDarwin
# "-framework CoreServices -framework CoreFoundation";
in
pkgs.stdenv.mkDerivation {
name = name;
exename = name;
src = ../../../pkg/urbit;
builder = ./builder.sh;
nativeBuildInputs = deps ++ vendor;
# See https://github.com/NixOS/nixpkgs/issues/18995
hardeningDisable = if debug then [ "all" ] else [];
CFLAGS = if debug then "-O0 -g" else "-O3";
MEMORY_DEBUG = debug;
CPU_DEBUG = debug;
EVENT_TIME_DEBUG = false;
}

View File

@ -0,0 +1,29 @@
{ env_name, env, deps }:
{ ent, name ? "urbit", debug ? false }:
let
crossdeps =
with env;
[ curl libgmp libsigsegv ncurses openssl zlib ];
vendor =
with deps;
[ argon2 softfloat3 ed25519 h2o scrypt uv murmur3 secp256k1 sni ];
in
env.make_derivation {
CFLAGS = if debug then "-O0 -g" else "-O3";
LDFLAGS = if debug then "" else "-s";
MEMORY_DEBUG = debug;
CPU_DEBUG = debug;
EVENT_TIME_DEBUG = false;
name = "${name}-${env_name}";
exename = name;
src = ../../../pkg/urbit;
cross_inputs = crossdeps ++ vendor ++ [ ent ];
builder = ./release.sh;
}

21
nix/pkgs/urbit/release.sh Normal file
View File

@ -0,0 +1,21 @@
source $setup
cp -r $src ./src
chmod -R u+w ./src
cd src
for dep in $cross_inputs; do
export CFLAGS="${CFLAGS-} -I$dep/include"
export LDFLAGS="${LDFLAGS-} -L$dep/lib"
done
CC=$host-gcc \
PKG_CONFIG=pkg-config-cross \
HOST=$host \
./configure
make urbit urbit-worker -j8
mkdir -p $out/bin
cp urbit $out/bin/$exename
cp urbit-worker $out/bin/$exename-worker

14
nix/pkgs/urbit/shell.nix Normal file
View File

@ -0,0 +1,14 @@
let
pkgs = import ../../nixpkgs.nix;
deps = import ../../deps { inherit pkgs; };
tlon = import ../../pkgs { inherit pkgs; };
in
import ./default.nix {
inherit pkgs;
inherit (tlon) ent;
inherit (deps)
argon2 ed25519 h2o murmur3 scrypt secp256k1 sni softfloat3 uv;
}

51
nix/release.nix Normal file
View File

@ -0,0 +1,51 @@
let
nixpkgs = import ./nixpkgs.nix;
nixcrpkgs = import ./nixcrpkgs.nix;
crossdeps = import ./crossdeps.nix;
release =
env_name: env: {
inherit env env_name;
deps = crossdeps env;
};
linux32 = release "linux32" nixcrpkgs.linux32;
linux64 = release "linux64" nixcrpkgs.linux64;
darwin = release "darwin" nixcrpkgs.mac;
ent = env:
import ./pkgs/ent/cross.nix env;
urbit = env:
import ./pkgs/urbit/release.nix env
{ ent = ent env; debug = false; name = "urbit"; };
urbit-debug = env:
import ./pkgs/urbit/release.nix env
{ ent = ent env; debug = true; name = "urbit-debug"; };
in
{
linux32-env = linux32.env;
linux32 = linux32.deps // {
ent = ent linux32;
urbit = urbit linux32;
urbit-debug = urbit-debug linux32;
};
linux64-env = linux64.env;
linux64 = linux64.deps // {
ent = ent linux64;
urbit = urbit linux64;
urbit-debug = urbit-debug linux64;
};
darwin-env = darwin.env;
darwin = darwin.deps // {
ent = ent darwin;
urbit = urbit darwin;
urbit-debug = urbit-debug darwin;
};
}

1
pkg/ent Submodule

@ -0,0 +1 @@
Subproject commit 31ac2913f14c6f7631f5792ad942605fb2d9fb87

Some files were not shown because too many files have changed in this diff Show More