From 46a438f26eab547563786c887621a3f50c908eef Mon Sep 17 00:00:00 2001 From: Jared Tobin Date: Thu, 30 Jan 2020 11:14:30 +0400 Subject: [PATCH 1/2] build: use generic builder in urbit derivation 'installPhase' captures all the important stuff that builder.sh previously did, and use of the generic builder allows stages of the build to be more easily overridden. --- nix/pkgs/urbit/builder.sh | 15 --------------- nix/pkgs/urbit/default.nix | 10 +++++++++- 2 files changed, 9 insertions(+), 16 deletions(-) delete mode 100644 nix/pkgs/urbit/builder.sh diff --git a/nix/pkgs/urbit/builder.sh b/nix/pkgs/urbit/builder.sh deleted file mode 100644 index 3bd7155383..0000000000 --- a/nix/pkgs/urbit/builder.sh +++ /dev/null @@ -1,15 +0,0 @@ -source $stdenv/setup - -cp -r $src ./src -chmod -R u+w ./src -cd src - -bash ./configure - -make clean -make all -j8 -make test - -mkdir -p $out/bin -cp ./build/urbit $out/bin/$exename -cp ./build/urbit-worker $out/bin/$exename-worker diff --git a/nix/pkgs/urbit/default.nix b/nix/pkgs/urbit/default.nix index 2617f9afca..328b17f55e 100644 --- a/nix/pkgs/urbit/default.nix +++ b/nix/pkgs/urbit/default.nix @@ -27,9 +27,17 @@ let inherit name meta; exename = name; src = ../../../pkg/urbit; - builder = ./builder.sh; nativeBuildInputs = deps ++ vendor; + installPhase = '' + make all -j8 + make test + + mkdir -p $out/bin + cp ./build/urbit $out/bin/$exename + cp ./build/urbit-worker $out/bin/$exename-worker + ''; + # See https://github.com/NixOS/nixpkgs/issues/18995 hardeningDisable = if debug then [ "all" ] else []; From a6e15c9418d550654b8c43fc1a7b9110dccb2f47 Mon Sep 17 00:00:00 2001 From: Jared Tobin Date: Thu, 30 Jan 2020 11:27:19 +0400 Subject: [PATCH 2/2] build: add urbit-large-log derivation Adds a derivation that uses a patched pkg/urbit/vere/lmdb.c that employs a sixty gigabyte log limit, instead of the default forty. This is useful for ships e.g. ~zod that receive a lot of traffic on mainnet. --- nix/pkgs/default.nix | 9 ++++++++- nix/pkgs/urbit/patches/large-log-limit.patch | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 nix/pkgs/urbit/patches/large-log-limit.patch diff --git a/nix/pkgs/default.nix b/nix/pkgs/default.nix index 2f29144a7b..bdd999d4cf 100644 --- a/nix/pkgs/default.nix +++ b/nix/pkgs/default.nix @@ -24,6 +24,13 @@ let urbit = mkUrbit { debug = false; }; urbit-debug = mkUrbit { debug = true; }; + urbit-large-log = pkgs.stdenv.lib.overrideDerivation urbit (_: { + patches = [ ./urbit/patches/large-log-limit.patch ]; + patchFlags = "-p3"; + }); + in -{ inherit ent ge-additions arvo arvo-ropsten herb urbit urbit-debug; } +{ inherit ent ge-additions arvo arvo-ropsten herb; + inherit urbit urbit-debug urbit-large-log; +} diff --git a/nix/pkgs/urbit/patches/large-log-limit.patch b/nix/pkgs/urbit/patches/large-log-limit.patch new file mode 100644 index 0000000000..7d88d0d52d --- /dev/null +++ b/nix/pkgs/urbit/patches/large-log-limit.patch @@ -0,0 +1,15 @@ +diff --git a/pkg/urbit/vere/lmdb.c b/pkg/urbit/vere/lmdb.c +index b46cc66ee..b8f647dde 100644 +--- a/pkg/urbit/vere/lmdb.c ++++ b/pkg/urbit/vere/lmdb.c +@@ -44,8 +44,8 @@ MDB_env* u3_lmdb_init(const char* log_path) + // TODO: Start with forty gigabytes for the maximum event log size. We'll + // need to do something more sophisticated for real in the long term, though. + // +- const size_t forty_gigabytes = 42949672960; +- ret_w = mdb_env_set_mapsize(env, forty_gigabytes); ++ const size_t sixty_gigabytes = 64424509440; ++ ret_w = mdb_env_set_mapsize(env, sixty_gigabytes); + if (ret_w != 0) { + u3l_log("lmdb: failed to set database size: %s\n", mdb_strerror(ret_w)); + return 0;