diff --git a/.github/workflows/shared.yml b/.github/workflows/shared.yml index cae262c6c..8c8e8a507 100644 --- a/.github/workflows/shared.yml +++ b/.github/workflows/shared.yml @@ -55,7 +55,9 @@ jobs: runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + with: + lfs: true # We only want the extra nix config on linux, where it is necessary # for the docker build. We don't want in on Mac, where it isn't but @@ -77,7 +79,6 @@ jobs: - if: ${{ matrix.os == 'ubuntu-latest' }} name: run urbit-tests run: | - cp -RL tests pkg/arvo/tests if [[ "${{ inputs.next }}" == "next/kelvin/"* ]]; then next=$(echo ${{ inputs.next }} | sed 's/[^0-9]//g') base="https://bootstrap.urbit.org/vere/next/kelvin/${next}" @@ -91,7 +92,8 @@ jobs: url="$(echo ${base}/v${vere}/vere-v${vere}-linux-x86_64)" echo $vere echo $url - # put in .jam so it doesn't crash when it gets -A'd in - curl -Lo pkg/arvo/vere.jam "$url" - chmod +x pkg/arvo/vere.jam - nix-build -A urbit-tests + curl -Lo urbit "$url" + chmod +x urbit + git add urbit + + nix flake check --keep-build-log -L diff --git a/bin/solid.pill b/bin/solid.pill index 05746d8bf..13883ce06 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8c0fb3cb223a884bb10dc2877c2dcbc597d7ba54392c8cdc73ac152626888cc9 -size 6379473 +oid sha256:feaae0eece54db3e92122263706c283674af581d14ffde8a29fb24e1873a35b1 +size 6453015 diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..58df27369 --- /dev/null +++ b/flake.lock @@ -0,0 +1,76 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1687709756, + "narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1688465017, + "narHash": "sha256-xzFcCnzPOgQaX7Acprfqo+tqHJ2UKWC38pXrcqvdXHU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0d5682acc109add20f70440269587a1b169cc2fe", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "tools": "tools" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "tools": { + "flake": false, + "locked": { + "lastModified": 1687273483, + "narHash": "sha256-41X9PWXGM7lFzPiIj4dw3i8bgMvpT85iYHSeyIxPJcc=", + "owner": "urbit", + "repo": "tools", + "rev": "2ad116fdb539e4116dc18d86772a241415cc1ef4", + "type": "github" + }, + "original": { + "owner": "urbit", + "repo": "tools", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..5f11eca88 --- /dev/null +++ b/flake.nix @@ -0,0 +1,75 @@ +{ + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + tools = { + flake = false; + url = "github:urbit/tools"; + }; + }; + + outputs = { self, nixpkgs, flake-utils, tools }: + flake-utils.lib.eachDefaultSystem (system: + let + usableTools = pkgs.runCommand "patched-tools" { } '' + cp -r ${tools} $out + chmod +w -R $out + patchShebangs $out + ''; + pkgs = import nixpkgs { inherit system; }; + bootFakeShip = { pill, arvo }: + pkgs.runCommand "fake-pier" { } '' + ${./urbit} --pier $out -F zod -B ${pill} -l -x -t -A ${arvo} + ''; + fakePier = bootFakeShip { + pill = ./bin/solid.pill; + arvo = "${./pkg}/arvo"; + }; + testPier = bootFakeShip { + pill = ./bin/solid.pill; + arvo = pkgs.runCommand "test-arvo" {} '' + cp -r ${./pkg} $out + chmod +w -R $out + cp -r ${./tests} $out/arvo/tests + cp -r ${./test-desk.bill} $out/arvo/desk.bill + '' + "/arvo"; + }; + buildPillThread = pill: + pkgs.writeTextFile { + name = ""; + text = '' + =/ m (strand ,vase) + ;< [=ship =desk =case] bind:m get-beak + ;< ~ bind:m (poke [ship %dojo] %lens-command !>([%$ [%dojo '+${pill}'] [%output-pill '${pill}/pill']])) + ;< ~ bind:m (poke [ship %hood] %drum-exit !>(~)) + (pure:m !>(~)) + ''; + }; + buildPill = pill: + pkgs.runCommand ("${pill}.pill") { buildInputs = [ pkgs.netcat ]; } '' + cp -r ${fakePier} pier + chmod +w -R pier + ${./urbit} -d pier + ${usableTools}/pkg/click/click -k -p -i ${buildPillThread pill} pier + + # Sleep to let urbit spin down properly + sleep 5 + + cp pier/.urb/put/${pill}.pill $out + ''; + + in { + checks = { + testFakeShip = import ./nix/test-fake-ship.nix { + inherit pkgs; + pier = testPier; + click = usableTools + "/pkg/click/click"; + }; + }; + packages = { + inherit fakePier testPier; + brass = buildPill "brass"; + ivory = buildPill "ivory"; + solid = buildPill "solid"; + }; + }); +} diff --git a/nix/default.nix b/nix/default.nix deleted file mode 100644 index 627b3eba7..000000000 --- a/nix/default.nix +++ /dev/null @@ -1,34 +0,0 @@ -# The build system where packages will be _built_. -{ system ? builtins.currentSystem - # The host system where packages will _run_. -, crossSystem ? null - # Additional sources.json overrides. -, sources ? { } - # Additional nixpkgs.config overrides. -, config ? { } - # Additional nixpkgs.overlays. -, overlays ? [ ] - # Overlays to apply to the last package set in cross compilation. -, crossOverlays ? [ ] }: - -let - - finalSources = import ./sources.nix { } // sources; - - pkgs = import finalSources.nixpkgs { - inherit system config crossSystem crossOverlays; - - overlays = [ - # Make prev.sources available to subsequent overlays. - (_final: _prev: { sources = finalSources; }) - # General unguarded (native) overrides for nixpkgs. - (import ./overlays/native.nix) - # Specific overrides guarded by the host platform. - (import ./overlays/musl.nix) - (import ./overlays/arm.nix) - ]; - }; - -in pkgs // { - pkgsStatic = pkgs.pkgsStatic.extend (import ./overlays/static.nix); -} diff --git a/nix/lib/boot-fake-ship.nix b/nix/lib/boot-fake-ship.nix deleted file mode 100644 index d67f16f58..000000000 --- a/nix/lib/boot-fake-ship.nix +++ /dev/null @@ -1,72 +0,0 @@ -{ lib, stdenvNoCC, curl }: - -{ arvo ? null, pill, ship, arguments ? [ "-l" ] }: - -let - - args = arguments ++ [ "-d" "-F" "${ship}" "-B" "${pill}" ] - ++ lib.optionals (arvo != null) [ "-A" "${arvo}" ]; - -in stdenvNoCC.mkDerivation { - name = "fake-${ship}"; - - buildInputs = [ curl ]; - - phases = [ "buildPhase" "installPhase " ]; - - buildPhase = '' - set -xeuo pipefail - - ${arvo}/vere.jam ${lib.concatStringsSep " " args} -c ./pier - - cleanup () { - if [ -f ./pier/.vere.lock ]; then - kill $(< ./pier/.vere.lock) || true - fi - - set +x - } - - trap cleanup EXIT - - port=$(cat ./pier/.http.ports | grep loopback | tr -s ' ' '\n' | head -n 1) - - lensd() { - curl -f -s \ - --data "{\"source\":{\"dojo\":\"$1\"},\"sink\":{\"stdout\":null}}" \ - "http://localhost:$port" | xargs printf %s | sed 's/\\n/\n/g' - } - - lensa() { - curl -f -s \ - --data "{\"source\":{\"dojo\":\"$2\"},\"sink\":{\"app\":\"$1\"}}" \ - "http://localhost:$port" | xargs printf %s | sed 's/\\n/\n/g' - } - - check () { - [ 3 -eq "$(lensd 3)" ] - } - - if check && sleep 10 && check; then - header "boot success" - lensa hood '+hood/exit' - while [ -f ./pier/.vere.lock ]; do - echo "waiting for pier to shut down" - sleep 5 - done - else - header "boot failure" - kill $(< ./pier/.vere.lock) || true - set +x - exit 1 - fi - - set +x - ''; - - installPhase = '' - ls - ls -a ./pier - mv ./pier $out - ''; -} diff --git a/nix/lib/default.nix b/nix/lib/default.nix deleted file mode 100644 index 270ddad1a..000000000 --- a/nix/lib/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -# Functions that are expected run on the native (non-cross) system. - -{ callPackage }: - -rec { - bootFakeShip = callPackage ./boot-fake-ship.nix { }; - - testFakeShip = callPackage ./test-fake-ship.nix { inherit bootFakeShip; }; - - fetchGitHubLFS = callPackage ./fetch-github-lfs.nix { }; - - makeReleaseTarball = callPackage ./make-release-tarball.nix { }; -} diff --git a/nix/lib/fetch-github-lfs.nix b/nix/lib/fetch-github-lfs.nix deleted file mode 100644 index a7f782a70..000000000 --- a/nix/lib/fetch-github-lfs.nix +++ /dev/null @@ -1,107 +0,0 @@ -{ lib, stdenvNoCC, runCommandLocal, cacert, curl, jq }: - -{ src -# `name` shouldn't use `baseNameOf` otherwise we'll -# get `is not allowed to refer to a store path` errors. -, name ? baseNameOf src, owner ? "urbit", repo ? "urbit" -, preferLocalBuild ? true }: - -assert builtins.isPath src; - -let - - # Parse the first 7 characters of the supplied `src` path for the required - # `version` key as defined by the lfs specification: - # https://github.com/git-lfs/git-lfs/blob/master/docs/spec.md - # - # If `version` exists we assume we're dealing with a lfs pointer and parse - # the `oid` and `size` from the pointer and write these into a JSON object. - # - # If the first 7 characters are unrecognised we assume the path is a binary - # file and set both `oid` and `size` to `null`. - # - # The `oid` and `size` are then JSON decoded into an expression to use - # as the fixed-output derivation's `sha256 = oid`, and to form a download - # operation payload to request the actual lfs blob's real url. - pointer = builtins.fromJSON (builtins.readFile - (runCommandLocal "lfs-pointer-${name}" { } '' - oid="null" - size="null" - - if [[ "$(head -c 7 "${src}")" != "version" ]]; then - header "lfs ${src} is a binary blob, skipping" - else - header "reading lfs pointer from ${src}" - - contents=($(awk '{print $2}' "${src}")) - oid="''${contents[1]#sha256:}" - size="''${contents[2]}" - fi - - cat < "$out" - {"oid": "$oid", "size": $size} - EOF - '')); - - downloadUrl = - "https://github.com/${owner}/${repo}.git/info/lfs/objects/batch"; - - # Encode `oid` and `size` into a download operation per: - # https://github.com/git-lfs/git-lfs/blob/master/docs/api/batch.md - # - # This is done using toJSON to avoid bash quotation issues. - downloadPayload = builtins.toJSON { - operation = "download"; - objects = [ pointer ]; - }; - - # Define a fixed-output derivation using the lfs pointer's `oid` as the - # expected sha256 output hash, if `oid` is not null. - # - - # 1. Request the actual url of the binary file from the lfs batch api. - # 2. Download the binary file contents to `$out`. - download = stdenvNoCC.mkDerivation { - name = "lfs-blob-${name}"; - nativeBuildInputs = [ curl jq ]; - phases = [ "installPhase" ]; - installPhase = '' - curl=( - curl - --location - --max-redirs 20 - --retry 3 - --disable-epsv - --cookie-jar cookies - $NIX_CURL_FLAGS - ) - - header "reading lfs metadata from ${downloadUrl}" - - href=$("''${curl[@]}" \ - -d '${downloadPayload}' \ - -H 'Accept: application/vnd.git-lfs+json' \ - '${downloadUrl}' \ - | jq -r '.objects[0].actions.download.href') - - header "download lfs data from remote" - - # Pozor/Achtung: the href contains credential and signature information, - # so we avoid echoing it to stdout/err. - "''${curl[@]}" -s --output "$out" "$href" - ''; - - impureEnvVars = lib.fetchers.proxyImpureEnvVars; - - SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt"; - - outputHashAlgo = "sha256"; - outputHashMode = "flat"; - outputHash = pointer.oid; - - inherit preferLocalBuild; - }; - - # If `pointer.oid` is null then supplied the `src` must be a binary - # blob and can be returned directly. -in if pointer.oid == null || pointer.size == null then src else download diff --git a/nix/lib/make-release-tarball.nix b/nix/lib/make-release-tarball.nix deleted file mode 100644 index 48ba1865d..000000000 --- a/nix/lib/make-release-tarball.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ lib, stdenvNoCC, coreutils }: - -{ name, extension ? "tgz", contents # { target = source, ... } -}: - -let - - transforms = builtins.concatStringsSep " " (lib.mapAttrsToList - (target: source: ''--transform "s,${source},${target},"'') contents); - - sources = builtins.concatStringsSep " " - (lib.mapAttrsToList (_target: source: "${source}") contents); - -in stdenvNoCC.mkDerivation { - name = "${name}.${extension}"; - phases = [ "buildPhase" ]; - - nativeBuildInputs = [ coreutils ]; - - buildPhase = '' - tar -vczf $out \ - --owner=0 --group=0 --mode=u+rw,uga+r \ - --absolute-names \ - --hard-dereference \ - ${transforms} \ - ${sources} - ''; - - preferLocalBuild = true; -} diff --git a/nix/lib/test-fake-ship.nix b/nix/lib/test-fake-ship.nix deleted file mode 100644 index a7cb31e33..000000000 --- a/nix/lib/test-fake-ship.nix +++ /dev/null @@ -1,188 +0,0 @@ -{ lib, stdenvNoCC, curl, python3, bootFakeShip }: - -{ arvo ? null, pill, ship ? "bus", doCheck ? true }: - -stdenvNoCC.mkDerivation { - name = "test-${ship}"; - - src = bootFakeShip { inherit arvo pill ship; }; - - phases = [ "unpackPhase" "buildPhase" "checkPhase" ]; - - buildInputs = [ curl python3 ]; - - unpackPhase = '' - cp -R $src ./pier - chmod -R u+rw ./pier - ''; - - buildPhase = '' - set -x - - ${arvo}/vere.jam -d ./pier 2> urbit-output - - # Sledge Hammer! - # See: https://github.com/travis-ci/travis-ci/issues/4704#issuecomment-348435959 - python3 -c $'import os\n[os.set_blocking(i, True) for i in range(3)]\n' - - port=$(cat ./pier/.http.ports | grep loopback | tr -s ' ' '\n' | head -n 1) - - lensd() { - # -f elided, this can hit server-side timeouts - curl -s \ - --data "{\"source\":{\"dojo\":\"$1\"},\"sink\":{\"stdout\":null}}" \ - "http://localhost:$port" | xargs printf %s | sed 's/\\n/\n/g' - } - - lensa() { - # -f elided, this can hit server-side timeouts - curl -s \ - --data "{\"source\":{\"dojo\":\"$2\"},\"sink\":{\"app\":\"$1\"}}" \ - "http://localhost:$port" | xargs printf %s | sed 's/\\n/\n/g' - } - - tail -F urbit-output >&2 & - - tailproc=$! - - cleanup () { - kill $(cat ./pier/.vere.lock) || true - kill "$tailproc" 2>/dev/null || true - - set +x - } - - trap cleanup EXIT - - # measure initial memory usage - # - lensd '~& ~ ~& %init-mass-start ~' - lensa hood '+hood/mass' - lensd '~& ~ ~& %init-mass-end ~' - - # run the unit tests - # - lensd '~& ~ ~& %test-unit-start ~' - lensd '-test %/tests ~' - lensd '~& ~ ~& %test-unit-end ~' - - # use the :test app to build all agents, generators, and marks - # - lensa hood '+hood/start %test' - - lensd '~& ~ ~& %test-agents-start ~' - lensa test '%agents' - lensd '~& ~ ~& %test-agents-end ~' - - lensd '~& ~ ~& %test-generators-start ~' - lensa test '%generators' - lensd '~& ~ ~& %test-generators-end ~' - - lensd '~& ~ ~& %test-marks-start ~' - lensa test '%marks' - lensd '~& ~ ~& %test-marks-end ~' - - # measure memory usage post tests - # - lensd '~& ~ ~& %test-mass-start ~' - lensa hood '+hood/mass' - lensd '~& ~ ~& %test-mass-end ~' - - # defragment the loom - # - lensd '~& ~ ~& %pack-start ~' - lensa hood '+hood/pack' - lensd '~& ~ ~& %pack-end ~' - - # reclaim space within arvo - # - lensd '~& ~ ~& %trim-start ~' - lensa hood '+hood/trim' - lensd '~& ~ ~& %trim-end ~' - - # measure memory usage pre |meld - # - lensd '~& ~ ~& %trim-mass-start ~' - lensa hood '+hood/mass' - lensd '~& ~ ~& %trim-mass-end ~' - - # globally deduplicate - # - lensd '~& ~ ~& %meld-start ~' - lensa hood '+hood/meld' - lensd '~& ~ ~& %meld-end ~' - - # measure memory usage post |meld - # - lensd '~& ~ ~& %meld-mass-start ~' - lensa hood '+hood/mass' - lensd '~& ~ ~& %meld-mass-end ~' - - lensa hood '+hood/exit' - - cleanup - - # Collect output - cp urbit-output test-output-unit - cp urbit-output test-output-agents - cp urbit-output test-output-generators - cp urbit-output test-output-marks - - sed -i '0,/test-unit-start/d' test-output-unit - sed -i '/test-unit-end/,$d' test-output-unit - - sed -i '0,/test-agents-start/d' test-output-agents - sed -i '/test-agents-end/,$d' test-output-agents - - sed -i '0,/test-generators-start/d' test-output-generators - sed -i '/test-generators-end/,$d' test-output-generators - - sed -i '0,/test-marks-start/d' test-output-marks - sed -i '/test-marks-end/,$d' test-output-marks - - mkdir -p $out - - cp test-output-* $out/ - - set +x - ''; - - checkPhase = '' - hdr () { - echo =====$(sed 's/./=/g' <<< "$1")===== - echo ==== $1 ==== - echo =====$(sed 's/./=/g' <<< "$1")===== - } - - for f in $(find "$out/" -type f); do - hdr "$(basename $f)" - cat "$f" - done - - fail=0 - - for f in $(find "$out/" -type f); do - if egrep "((FAILED|CRASHED)|warn:) " $f >/dev/null; then - if [[ $fail -eq 0 ]]; then - hdr "Test Failures" - fi - - echo "ERROR Test failure in $(basename $f)" - - ((fail++)) - fi - done - - if [[ $fail -eq 0 ]]; then - hdr "Success" - fi - - exit "$fail" - ''; - - inherit doCheck; - - # Fix 'bind: operation not permitted' when nix.useSandbox = true on darwin. - # See https://github.com/NixOS/nix/blob/5f6840fbb49ae5b534423bd8a4360646ee93dbaf/src/libstore/build.cc#L2961 - __darwinAllowLocalNetworking = true; -} diff --git a/nix/overlays/arm.nix b/nix/overlays/arm.nix deleted file mode 100644 index be0112296..000000000 --- a/nix/overlays/arm.nix +++ /dev/null @@ -1,14 +0,0 @@ -final: prev: - -let - - isAarch64 = prev.stdenv.hostPlatform.isAarch64; - isDarwin = prev.stdenv.isDarwin; - -in prev.lib.optionalAttrs (isAarch64 && !isDarwin) { - libsigsegv = prev.libsigsegv.overrideAttrs (attrs: { - preConfigure = (prev.preConfigure or "") + '' - sed -i 's/^CFG_FAULT=$/CFG_FAULT=fault-linux-arm.h/' configure - ''; - }); -} diff --git a/nix/overlays/musl.nix b/nix/overlays/musl.nix deleted file mode 100644 index 209d78298..000000000 --- a/nix/overlays/musl.nix +++ /dev/null @@ -1,26 +0,0 @@ -final: prev: - -let - - isMusl = prev.stdenv.hostPlatform.isMusl; - - optionalList = xs: if xs == null then [ ] else xs; - - overrideStdenv = pkg: pkg.override { stdenv = prev.gcc9Stdenv; }; - -in prev.lib.optionalAttrs isMusl { - libsigsegv = prev.libsigsegv.overrideAttrs (attrs: { - preConfigure = (attrs.preConfigure or "") + '' - sed -i 's/^CFG_FAULT=$/CFG_FAULT=fault-linux-i386.h/' configure - ''; - }); - - secp256k1 = prev.secp256k1.overrideAttrs (attrs: { - nativeBuildInputs = (attrs.nativeBuildInputs or [ ]) - ++ [ prev.buildPackages.stdenv.cc ]; - }); - - rhash = overrideStdenv prev.rhash; - - numactl = overrideStdenv prev.numactl; -} diff --git a/nix/overlays/native.nix b/nix/overlays/native.nix deleted file mode 100644 index 4f34fe136..000000000 --- a/nix/overlays/native.nix +++ /dev/null @@ -1,40 +0,0 @@ -final: prev: - -let - - optionalList = xs: if xs == null then [ ] else xs; - -in { - h2o = prev.h2o.overrideAttrs (_attrs: { - version = final.sources.h2o.rev; - src = final.sources.h2o; - outputs = [ "out" "dev" "lib" ]; - meta.platforms = prev.lib.platforms.linux ++ prev.lib.platforms.darwin; - }); - - libsigsegv = prev.libsigsegv.overrideAttrs (attrs: { - patches = optionalList attrs.patches ++ [ - ../pkgs/libsigsegv/disable-stackvma_fault-linux-arm.patch - ../pkgs/libsigsegv/disable-stackvma_fault-linux-i386.patch - ]; - }); - - curlUrbit = prev.curlMinimal.override { - http2Support = false; - scpSupport = false; - gssSupport = false; - ldapSupport = false; - brotliSupport = false; - }; - - # lies, all lies - openssl-static-osx = prev.openssl; - zlib-static-osx = prev.zlib; - - lmdb = prev.lmdb.overrideAttrs (attrs: { - patches = - optionalList attrs.patches ++ prev.lib.optional prev.stdenv.isDarwin [ - ../pkgs/lmdb/darwin-fsync.patch - ]; - }); -} diff --git a/nix/overlays/static.nix b/nix/overlays/static.nix deleted file mode 100644 index 1d364a598..000000000 --- a/nix/overlays/static.nix +++ /dev/null @@ -1,40 +0,0 @@ -final: prev: - -let - - # https://github.com/NixOS/nixpkgs/pull/97047/files - # Will make pkgs.stdenv.isStatic available indepedent of the platform. - # isStatic = prev.stdenv.hostPlatform.isStatic; - - configureFlags = attrs: { - configureFlags = (attrs.configureFlags or [ ]) - ++ [ "--disable-shared" "--enable-static" ]; - }; - - enableStatic = pkg: pkg.overrideAttrs configureFlags; - -in { - gmp = enableStatic prev.gmp; - - curlUrbit = enableStatic (prev.curlUrbit.override { openssl = final.openssl-static-osx; zlib = final.zlib-static-osx; }); - - libuv = enableStatic prev.libuv; - - libffi = enableStatic prev.libffi; - - openssl-static-osx = prev.openssl.override { - static = true; - withPerl = false; - }; - - zlib-static-osx = if final.stdenv.isDarwin then prev.zlib.static else prev.zlib; - - secp256k1 = enableStatic prev.secp256k1; - - lmdb = prev.lmdb.overrideAttrs (old: - configureFlags old // { - postPatch = '' - sed '/^ILIBS\t/s/liblmdb\$(SOEXT)//' -i Makefile - ''; - }); -} diff --git a/nix/pkgs/arvo/default.nix b/nix/pkgs/arvo/default.nix deleted file mode 100644 index 502d2847a..000000000 --- a/nix/pkgs/arvo/default.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ lib, stdenvNoCC, marsSources }: - -stdenvNoCC.mkDerivation { - name = "arvo"; - - src = marsSources; - - outputs = [ "out" "goerli" ]; - - phases = [ "mainnetPhase" "goerliPhase" ]; - - mainnetPhase = '' - ln -s ${marsSources.out}/arvo $out - ''; - - goerliPhase = '' - ln -s ${marsSources.goerli}/arvo $goerli - ''; - - preferLocalBuild = true; -} diff --git a/nix/pkgs/ca-bundle/default.nix b/nix/pkgs/ca-bundle/default.nix deleted file mode 100644 index ddef1fb3e..000000000 --- a/nix/pkgs/ca-bundle/default.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ stdenvNoCC, xxd, cacert }: - -stdenvNoCC.mkDerivation { - name = "ca-bundle"; - - nativeBuildInputs = [ cacert xxd ]; - - phases = [ "installPhase" ]; - - installPhase = '' - set -euo pipefail - - if ! [ -f "$SSL_CERT_FILE" ]; then - header "$SSL_CERT_FILE doesn't exist" - exit 1 - fi - - mkdir include - - cat $SSL_CERT_FILE > include/ca-bundle.crt - xxd -i include/ca-bundle.crt > ca-bundle.h - - mkdir -p $out/include - - mv ca-bundle.h $out/include - ''; - - preferLocalBuild = true; -} diff --git a/nix/pkgs/docker-image/default.nix b/nix/pkgs/docker-image/default.nix deleted file mode 100644 index 6c200a00e..000000000 --- a/nix/pkgs/docker-image/default.nix +++ /dev/null @@ -1,112 +0,0 @@ -{ urbit, curl, libcap, coreutils, bashInteractive, dockerTools, writeScriptBin, amesPort ? 34343 }: -let - startUrbit = writeScriptBin "start-urbit" '' - #!${bashInteractive}/bin/bash - - set -eu - - # set defaults - amesPort=${toString amesPort} - - # check args - for i in "$@" - do - case $i in - -p=*|--port=*) - amesPort="''${i#*=}" - shift - ;; - esac - done - - # If the container is not started with the `-i` flag - # then STDIN will be closed and we need to start - # Urbit/vere with the `-t` flag. - ttyflag="" - if [ ! -t 0 ]; then - echo "Running with no STDIN" - ttyflag="-t" - fi - - # Check if there is a keyfile, if so boot a ship with its name, and then remove the key - if [ -e *.key ]; then - # Get the name of the key - keynames="*.key" - keys=( $keynames ) - keyname=''${keys[0]} - mv $keyname /tmp - - # Boot urbit with the key, exit when done booting - urbit $ttyflag -w $(basename $keyname .key) -k /tmp/$keyname -c $(basename $keyname .key) -p $amesPort -x - - # Remove the keyfile for security - rm /tmp/$keyname - rm *.key || true - elif [ -e *.comet ]; then - cometnames="*.comet" - comets=( $cometnames ) - cometname=''${comets[0]} - rm *.comet - - urbit $ttyflag -c $(basename $cometname .comet) -p $amesPort -x - fi - - # Find the first directory and start urbit with the ship therein - dirnames="*/" - dirs=( $dirnames ) - dirname=''${dirnames[0]} - - exec urbit $ttyflag -p $amesPort $dirname - ''; - - getUrbitCode = writeScriptBin "get-urbit-code" '' - #!${bashInteractive}/bin/bash - - raw=$(curl -s -X POST -H "Content-Type: application/json" \ - -d '{ "source": { "dojo": "+code" }, "sink": { "stdout": null } }' \ - http://127.0.0.1:12321) - - # trim \n" from the end - trim="''${raw%\\n\"}" - - # trim " from the start - code="''${trim#\"}" - - echo "$code" - ''; - - resetUrbitCode = writeScriptBin "reset-urbit-code" '' - #!${bashInteractive}/bin/bash - - curl=$(curl -s -X POST -H "Content-Type: application/json" \ - -d '{ "source": { "dojo": "+hood/code %reset" }, "sink": { "app": "hood" } }' \ - http://127.0.0.1:12321) - - if [[ $? -eq 0 ]] - then - echo "OK" - else - echo "Curl error: $?" - fi - ''; - -in dockerTools.buildImage { - name = "urbit"; - tag = "v${urbit.version}"; - contents = [ bashInteractive urbit curl startUrbit getUrbitCode resetUrbitCode coreutils ]; - runAsRoot = '' - #!${bashInteractive} - mkdir -p /urbit - mkdir -p /tmp - ${libcap}/bin/setcap 'cap_net_bind_service=+ep' /bin/urbit - ''; - config = { - Cmd = [ "/bin/start-urbit" ]; - Env = [ "PATH=/bin" ]; - WorkingDir = "/urbit"; - Volumes = { - "/urbit" = {}; - }; - Expose = [ "80/tcp" "${toString amesPort}/udp" ]; - }; -} diff --git a/nix/pkgs/ent/default.nix b/nix/pkgs/ent/default.nix deleted file mode 100644 index ee13758f5..000000000 --- a/nix/pkgs/ent/default.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ lib, stdenv, enableParallelBuilding ? true }: - -stdenv.mkDerivation { - name = "ent"; - src = lib.cleanSource ../../../pkg/ent; - - postPatch = '' - patchShebangs ./configure - ''; - - installFlags = [ "PREFIX=$(out)" ]; - - inherit enableParallelBuilding; -} diff --git a/nix/pkgs/herb/default.nix b/nix/pkgs/herb/default.nix deleted file mode 100644 index 0dc620944..000000000 --- a/nix/pkgs/herb/default.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ lib, stdenvNoCC, python }: - -# Avoid using `python.withPackages` as it creates a wrapper script to set -# PYTHONPATH, and the script is used verbatim as a python shebang. -# -# Unfortunately Darwin does not allow scripts as a shebang - so to get a -# cross platform python interpreter with appropriate site-packages setup -# we use `wrapPython/Packages` which handles these cases correctly. - -stdenvNoCC.mkDerivation { - name = "herb"; - src = ../../../pkg/herb/herb; - - nativeBuildInputs = [ python.pkgs.wrapPython ]; - buildInputs = [ python python.pkgs.requests ]; - pythonPath = [ python.pkgs.requests ]; - - phases = [ "installPhase" "fixupPhase" ]; - - installPhase = '' - mkdir -p $out/bin - cp $src $out/bin/herb - chmod +x $out/bin/herb - ''; - - postFixup = '' - wrapPythonPrograms - ''; -} diff --git a/nix/pkgs/libaes_siv/cmakefiles_static.patch b/nix/pkgs/libaes_siv/cmakefiles_static.patch deleted file mode 100644 index 7b7c71b25..000000000 --- a/nix/pkgs/libaes_siv/cmakefiles_static.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -5,6 +5,8 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "") - set(CMAKE_BUILD_TYPE Release) - endif("${CMAKE_BUILD_TYPE}" STREQUAL "") - -+option(BUILD_SHARED_LIBS "Build shared libraries" ON) -+ - include(GNUInstallDirs) - - # Warning: don't use the UB sanitizer in production builds. It can introduce timing side-channels -@@ -31,10 +33,12 @@ endif(NOT DISABLE_DOCS) - configure_file(config.h.in config.h) - include_directories(${CMAKE_CURRENT_BINARY_DIR}) - -+if(BUILD_SHARED_LIBS) - add_library(aes_siv SHARED aes_siv.c) - target_include_directories(aes_siv PUBLIC ${OPENSSL_INCLUDE_DIR}) - target_link_libraries(aes_siv ${OPENSSL_CRYPTO_LIBRARY}) - set_target_properties(aes_siv PROPERTIES VERSION "1.0.1" SOVERSION 1) -+endif() - - add_library(aes_siv_static STATIC aes_siv.c) - target_include_directories(aes_siv_static PUBLIC ${OPENSSL_INCLUDE_DIR}) -@@ -63,7 +67,9 @@ endif(ENABLE_SANITIZER) - add_executable(bench EXCLUDE_FROM_ALL bench.c) - target_link_libraries(bench aes_siv_static) - -+if(BUILD_SHARED_LIBS) - install(TARGETS aes_siv LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+endif() - install(TARGETS aes_siv_static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - install(FILES aes_siv.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) - diff --git a/nix/pkgs/libaes_siv/default.nix b/nix/pkgs/libaes_siv/default.nix deleted file mode 100644 index 287083351..000000000 --- a/nix/pkgs/libaes_siv/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ stdenv, sources, cmake, openssl, enableParallelBuilding ? true }: - -stdenv.mkDerivation { - name = "libaes_siv"; - version = sources.libaes_siv.rev; - src = sources.libaes_siv; - patches = [ ./cmakefiles_static.patch ]; - - nativeBuildInputs = [ cmake ]; - buildInputs = [ openssl ]; - - cmakeFlags = [ - "-DBUILD_SHARED_LIBS=OFF" - ]; - - inherit enableParallelBuilding; -} diff --git a/nix/pkgs/libsigsegv/disable-stackvma_fault-linux-arm.patch b/nix/pkgs/libsigsegv/disable-stackvma_fault-linux-arm.patch deleted file mode 100644 index 56d2b4b75..000000000 --- a/nix/pkgs/libsigsegv/disable-stackvma_fault-linux-arm.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/src/fault-linux-arm.h -+++ b/src/fault-linux-arm.h -@@ -17,6 +17,8 @@ - - #include "fault-posix-ucontext.h" - -+#define HAVE_STACKVMA 0 -+ - #if defined(__aarch64__) || defined(__ARM_64BIT_STATE) || defined(__ARM_PCS_AAPCS64) /* 64-bit */ - - /* See glibc/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h. diff --git a/nix/pkgs/libsigsegv/disable-stackvma_fault-linux-i386.patch b/nix/pkgs/libsigsegv/disable-stackvma_fault-linux-i386.patch deleted file mode 100644 index 9d7d03bd1..000000000 --- a/nix/pkgs/libsigsegv/disable-stackvma_fault-linux-i386.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/src/fault-linux-i386.h -+++ b/src/fault-linux-i386.h -@@ -18,6 +18,8 @@ - - #include "fault-posix-ucontext.h" - -+#define HAVE_STACKVMA 0 -+ - #if defined __x86_64__ - /* 64 bit registers */ - diff --git a/nix/pkgs/lmdb/darwin-fsync.patch b/nix/pkgs/lmdb/darwin-fsync.patch deleted file mode 100644 index 961b8a1ff..000000000 --- a/nix/pkgs/lmdb/darwin-fsync.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c -index fe65e30..0070215 100644 ---- a/libraries/liblmdb/mdb.c -+++ b/libraries/liblmdb/mdb.c -@@ -2526,7 +2526,7 @@ mdb_env_sync(MDB_env *env, int force) - rc = ErrCode(); - } else - #endif -- if (MDB_FDATASYNC(env->me_fd)) -+ if (fcntl(env->me_fd, F_FULLFSYNC, 0)) - rc = ErrCode(); - } - } diff --git a/nix/pkgs/marsSources/default.nix b/nix/pkgs/marsSources/default.nix deleted file mode 100644 index 5811e19e5..000000000 --- a/nix/pkgs/marsSources/default.nix +++ /dev/null @@ -1,46 +0,0 @@ -{ lib, stdenvNoCC, bc }: - -stdenvNoCC.mkDerivation { - name = "sources"; - src = lib.cleanSource ../../../pkg; - - buildInputs = [ bc ]; - - outputs = [ "out" "goerli" ]; - - phases = [ "mainnetPhase" "goerliPhase" ]; - - mainnetPhase = '' - cp -r $src $out - chmod -R u+w $out - ''; - - goerliPhase = '' - cp -r $src tmp - chmod -R u+w tmp - - ZUSE=tmp/arvo/sys/zuse.hoon - AMES=tmp/arvo/sys/vane/ames.hoon - ACME=tmp/arvo/app/acme.hoon - - # Replace the mainnet azimuth contract with the goerli contract - sed --in-place \ - 's/\(\+\+ contracts \)mainnet\-contracts/\1goerli-contracts/' \ - $ZUSE - - # Increment the %ames protocol version - sed -r --in-place \ - 's_^(=/ protocol\-version=\?\(.*\) %)([0-7])_echo "\1$(echo "(\2+1) % 8" | bc)"_e' \ - $AMES - - # Use the staging API in :acme - sed --in-place \ - 's_https://acme-v02.api.letsencrypt.org/directory_https://acme-staging-v02.api.letsencrypt.org/directory_' \ - $ACME - - cp -r tmp $goerli - chmod -R u+w $goerli - ''; - - preferLocalBuild = true; -} diff --git a/nix/pkgs/murmur3/default.nix b/nix/pkgs/murmur3/default.nix deleted file mode 100644 index abac84c95..000000000 --- a/nix/pkgs/murmur3/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ stdenv, sources }: - -stdenv.mkDerivation { - pname = "murmur3"; - version = sources.murmur3.rev; - src = sources.murmur3; - - buildPhase = '' - $CC -fPIC -O3 -o murmur3.o -c $src/murmur3.c - ''; - - installPhase = '' - mkdir -p $out/{lib,include} - $AR rcs $out/lib/libmurmur3.a murmur3.o - cp $src/*.h $out/include/ - ''; -} diff --git a/nix/pkgs/pill/brass.nix b/nix/pkgs/pill/brass.nix deleted file mode 100644 index 6aa1c5dcf..000000000 --- a/nix/pkgs/pill/brass.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ lib, stdenvNoCC, fetchGitHubLFS, bootFakeShip, solid, urbit, arvo, curl -, withGoerli ? false }: - -let - - lfs = fetchGitHubLFS { src = ../../../bin/brass.pill; }; - -in { - build = import ./builder.nix { - inherit stdenvNoCC urbit curl; - - name = "brass" + lib.optionalString withGoerli "-goerli"; - builder = ./brass.sh; - arvo = if withGoerli then arvo.goerli else arvo; - pier = bootFakeShip { - inherit urbit; - - pill = solid.lfs; - ship = "zod"; - }; - }; -} // lib.optionalAttrs (!withGoerli) { inherit lfs; } diff --git a/nix/pkgs/pill/brass.sh b/nix/pkgs/pill/brass.sh deleted file mode 100644 index f158750ee..000000000 --- a/nix/pkgs/pill/brass.sh +++ /dev/null @@ -1,40 +0,0 @@ -source $stdenv/setup - -set -euo pipefail - -cp -r $src ./pier -chmod -R u+rw ./pier - -urbit -d ./pier - -cleanup () { - if [ -f ./pier/.vere.lock ]; then - kill $(< ./pier/.vere.lock) || true - fi -} - -trap cleanup EXIT - -header "running +brass" - -port=$(cat ./pier/.http.ports | grep loopback | tr -s ' ' '\n' | head -n 1) - -lensa() { - # -f elided, this can hit server-side timeouts - curl -s \ - --data "{\"source\":{\"dojo\":\"$2\"},\"sink\":{\"app\":\"$1\"}}" \ - "http://localhost:$port" | xargs printf %s | sed 's/\\n/\n/g' -} - -lensf() { - # -f elided, this can hit server-side timeouts - d=$(echo $1 | sed 's/\./\//g') - curl -sJO \ - --data "{\"source\":{\"dojo\":\"$2\"},\"sink\":{\"output-pill\":\"$d\"}}" \ - "http://localhost:$port" -} - -lensf brass.pill '+brass' -lensa hood '+hood/exit' - -stopNest diff --git a/nix/pkgs/pill/builder.nix b/nix/pkgs/pill/builder.nix deleted file mode 100644 index e5860bc12..000000000 --- a/nix/pkgs/pill/builder.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ stdenvNoCC, urbit, arvo, curl, name, builder, pier }: - -stdenvNoCC.mkDerivation { - name = "${name}.pill"; - src = pier; - buildInputs = [ curl urbit ]; - dontUnpack = true; - - buildPhase = builtins.readFile builder; - - installPhase = '' - mv ${name}.pill $out - ''; - - ARVO = arvo; -} diff --git a/nix/pkgs/pill/ivory.nix b/nix/pkgs/pill/ivory.nix deleted file mode 100644 index b4881909c..000000000 --- a/nix/pkgs/pill/ivory.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ lib, stdenvNoCC, fetchGitHubLFS, bootFakeShip, solid, urbit, arvo, curl, xxd -, withGoerli ? false }: - -let - - lfs = fetchGitHubLFS { src = ../../../bin/ivory.pill; }; - -in { - build = import ./builder.nix { - inherit stdenvNoCC urbit curl; - - name = "ivory" + lib.optionalString withGoerli "-goerli"; - builder = ./ivory.sh; - arvo = if withGoerli then arvo.goerli else arvo; - pier = bootFakeShip { - inherit urbit; - - pill = solid.lfs; - ship = "zod"; - }; - }; - - # The hexdump of the `.lfs` pill contents as a C header. - header = stdenvNoCC.mkDerivation { - name = "ivory-header"; - src = lfs; - nativeBuildInputs = [ xxd ]; - phases = [ "installPhase" ]; - - installPhase = '' - file=u3_Ivory.pill - - header "writing $file" - - mkdir -p $out/include - cat $src > $file - xxd -i $file > $out/include/ivory_impl.h - ''; - - preferLocalBuild = true; - }; -} // lib.optionalAttrs (!withGoerli) { inherit lfs; } diff --git a/nix/pkgs/pill/ivory.sh b/nix/pkgs/pill/ivory.sh deleted file mode 100644 index cd44c52fa..000000000 --- a/nix/pkgs/pill/ivory.sh +++ /dev/null @@ -1,40 +0,0 @@ -source $stdenv/setup - -set -euo pipefail - -cp -r $src ./pier -chmod -R u+rw ./pier - -urbit -d ./pier - -cleanup () { - if [ -f ./pier/.vere.lock ]; then - kill $(< ./pier/.vere.lock) || true - fi -} - -trap cleanup EXIT - -header "running +ivory" - -port=$(cat ./pier/.http.ports | grep loopback | tr -s ' ' '\n' | head -n 1) - -lensa() { - # -f elided, this can hit server-side timeouts - curl -s \ - --data "{\"source\":{\"dojo\":\"$2\"},\"sink\":{\"app\":\"$1\"}}" \ - "http://localhost:$port" | xargs printf %s | sed 's/\\n/\n/g' -} - -lensf() { - # -f elided, this can hit server-side timeouts - d=$(echo $1 | sed 's/\./\//g') - curl -sJO \ - --data "{\"source\":{\"dojo\":\"$2\"},\"sink\":{\"output-pill\":\"$d\"}}" \ - "http://localhost:$port" -} - -lensf ivory.pill '+ivory' -lensa hood '+hood/exit' - -stopNest diff --git a/nix/pkgs/pill/solid.nix b/nix/pkgs/pill/solid.nix deleted file mode 100644 index 7f4977173..000000000 --- a/nix/pkgs/pill/solid.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ stdenvNoCC, fetchGitHubLFS, bootFakeShip, solid, urbit, arvo, curl }: - -let - - lfs = fetchGitHubLFS { src = ../../../bin/solid.pill; }; - -in { - inherit lfs; - - build = import ./builder.nix { - inherit stdenvNoCC urbit arvo curl; - - name = "solid"; - builder = ./solid.sh; - pier = bootFakeShip { - inherit urbit; - - arvo = null; - pill = solid.lfs; - ship = "zod"; - }; - }; -} diff --git a/nix/pkgs/pill/solid.sh b/nix/pkgs/pill/solid.sh deleted file mode 100644 index 778754071..000000000 --- a/nix/pkgs/pill/solid.sh +++ /dev/null @@ -1,99 +0,0 @@ -source $stdenv/setup - -set -euo pipefail - -ARVO=${ARVO?:ARVO location is unset} - -cp -r $src ./pier -chmod -R u+rw ./pier - -urbit -d ./pier - -cleanup () { - if [ -f ./pier/.vere.lock ]; then - kill $(< ./pier/.vere.lock) || true - fi -} - -trap cleanup EXIT - -port=$(cat ./pier/.http.ports | grep loopback | tr -s ' ' '\n' | head -n 1) - -lensa() { - # -f elided, this can hit server-side timeouts - curl -s \ - --data "{\"source\":{\"dojo\":\"$2\"},\"sink\":{\"app\":\"$1\"}}" \ - "http://localhost:$port" | xargs printf %s | sed 's/\\n/\n/g' -} - -lensf() { - # -f elided, this can hit server-side timeouts - d=$(echo $1 | sed 's/\./\//g') - curl -sJO \ - --data "{\"source\":{\"dojo\":\"$2\"},\"sink\":{\"output-pill\":\"$d\"}}" \ - "http://localhost:$port" -} - -header "updating %base" - -# Update pill strategy to ensure correct staging -lensa hood "+hood/mount /=base=" - -until [ -d ./pier/base ]; do - sleep 1 -done - -# Update :lens, :dojo and dependencies -# FIXME: reduce this list -cp $ARVO/app/lens.hoon ./pier/base/app/ -cp $ARVO/app/dojo.hoon ./pier/base/app/ -cp $ARVO/lib/plume.hoon ./pier/base/lib/ -cp $ARVO/lib/server.hoon ./pier/base/lib/ -cp $ARVO/lib/sole.hoon ./pier/base/lib/ -cp $ARVO/lib/xray.hoon ./pier/base/lib/ -cp $ARVO/lib/pprint.hoon ./pier/base/lib/ - -mkdir -p ./pier/base/mar/lens/ - -cp $ARVO/mar/lens/* ./pier/base/mar/lens/ - -cp $ARVO/sur/lens.hoon ./pier/base/sur/ -cp $ARVO/sur/plum.hoon ./pier/base/sur/ -cp $ARVO/sur/sole.hoon ./pier/base/sur/ -cp $ARVO/sur/xray.hoon ./pier/base/sur/ - -# Update +solid and its dependencies -cp $ARVO/lib/pill.hoon ./pier/base/lib/ -cp $ARVO/gen/solid.hoon ./pier/base/gen/ - -chmod -R u+rw ./pier/base/ - -lensa hood "+hood/commit %base" -lensa hood "+hood/unmount %base" - -# FIXME: horrible hack to ensure the update is applied first -sleep 10 - -header "updating %stage" - -# Stage new desk for pill contents -lensa hood '+hood/merge %stage our %base' -lensa hood "+hood/mount /=stage=" - -until [ -d ./pier/stage ]; do - sleep 1 -done - -rm -rf ./pier/stage -cp -r $ARVO ./pier/stage -chmod -R u+rw ./pier/stage - -lensa hood "+hood/commit %stage" -lensa hood "+hood/unmount %stage" - -header "running +solid" - -lensf solid.pill '+solid /=stage=/sys, =dub &' -lensa hood '+hood/exit' - -stopNest diff --git a/nix/pkgs/softfloat3/default.nix b/nix/pkgs/softfloat3/default.nix deleted file mode 100644 index cae76a366..000000000 --- a/nix/pkgs/softfloat3/default.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ stdenv, sources, enableParallelBuilding ? true }: - -stdenv.mkDerivation { - pname = "softfloat3"; - version = sources.softfloat3.rev; - src = sources.softfloat3; - - postPatch = '' - for f in $(find build -type f -name 'Makefile'); do - substituteInPlace $f \ - --replace 'gcc' '$(CC)' \ - --replace 'ar crs' '$(AR) crs' - done - ''; - - preBuild = '' - cd build/Linux-x86_64-GCC - ''; - - installPhase = '' - mkdir -p $out/{lib,include} - cp $src/source/include/*.h $out/include/ - cp softfloat.a $out/lib/libsoftfloat3.a - ''; - - inherit enableParallelBuilding; -} - diff --git a/nix/pkgs/urbit/default.nix b/nix/pkgs/urbit/default.nix deleted file mode 100644 index e9da7b305..000000000 --- a/nix/pkgs/urbit/default.nix +++ /dev/null @@ -1,85 +0,0 @@ -{ lib, stdenv, coreutils, pkgconfig # build/env -, cacert, ca-bundle, ivory # codegen -, curlUrbit, ent, gmp, h2o, libsigsegv, libuv, lmdb # libs -, murmur3, openssl, openssl-static-osx, softfloat3 # -, urcrypt, zlib, zlib-static-osx # -, enableStatic ? stdenv.hostPlatform.isStatic # opts -, enableDebug ? false -, verePace ? "" -, doCheck ? true -, enableParallelBuilding ? true -, dontStrip ? true }: - -let - - src = lib.cleanSource ../../../pkg/urbit; - - version = builtins.readFile "${src}/version"; - - # See https://github.com/urbit/urbit/issues/5561 - oFlags = - if stdenv.isDarwin - then (if enableDebug then [ "-O0" "-g" ] else [ "-O3" ]) - else [ (if enableDebug then "-O0" else "-O3") "-g" ]; - -in stdenv.mkDerivation { - inherit src version; - - pname = "urbit" + lib.optionalString enableDebug "-debug" - + lib.optionalString enableStatic "-static"; - - nativeBuildInputs = [ pkgconfig ]; - - buildInputs = [ - cacert - ca-bundle - curlUrbit - ent - gmp - h2o - ivory.header - libsigsegv - libuv - lmdb - murmur3 - (if stdenv.isDarwin && enableStatic then openssl-static-osx else openssl) - softfloat3 - urcrypt - (if stdenv.isDarwin && enableStatic then zlib-static-osx else zlib) - ]; - - # Ensure any `/usr/bin/env bash` shebang is patched. - postPatch = '' - patchShebangs ./configure - ''; - - checkTarget = "test"; - - installPhase = '' - mkdir -p $out/bin - cp ./build/urbit $out/bin/urbit - ''; - - dontDisableStatic = enableStatic; - - configureFlags = if enableStatic - then [ "--disable-shared" "--enable-static" ] - else []; - - CFLAGS = oFlags ++ lib.optionals (!enableDebug) [ "-Werror" ]; - - MEMORY_DEBUG = enableDebug; - CPU_DEBUG = enableDebug; - EVENT_TIME_DEBUG = false; - VERE_PACE = if enableStatic then verePace else ""; - - # See https://github.com/NixOS/nixpkgs/issues/18995 - hardeningDisable = lib.optionals enableDebug [ "all" ]; - - inherit enableParallelBuilding doCheck dontStrip; - - meta = { - debug = enableDebug; - arguments = lib.optionals enableDebug [ "-g" ]; - }; -} diff --git a/nix/pkgs/urcrypt/default.nix b/nix/pkgs/urcrypt/default.nix deleted file mode 100644 index 3aab6e91d..000000000 --- a/nix/pkgs/urcrypt/default.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ stdenv, autoreconfHook, pkgconfig -, libaes_siv, openssl, openssl-static-osx, secp256k1 -, enableStatic ? stdenv.hostPlatform.isStatic }: - -stdenv.mkDerivation rec { - name = "urcrypt"; - src = ../../../pkg/urcrypt; - - # XX why are these required for darwin? - dontDisableStatic = enableStatic; - - configureFlags = if enableStatic - then [ "--disable-shared" "--enable-static" ] - else []; - - nativeBuildInputs = - [ autoreconfHook pkgconfig ]; - - propagatedBuildInputs = - [ openssl secp256k1 libaes_siv ]; -} diff --git a/nix/sources-openssl.json b/nix/sources-openssl.json deleted file mode 100644 index 7f3f7fa5b..000000000 --- a/nix/sources-openssl.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "openssl": { - "branch": "1_1_1n", - "homepage": "https://www.openssl.org/", - "pmnsh": { - "include": "build/include", - "lib": "build", - "prepare": "./config --prefix=`mkdir -p build && readlink -f ./build` --libdir=. no-shared no-tests", - "make": "install_dev" - }, - "owner": "openssl", - "repo": "openssl", - "rev": "OpenSSL_1_1_1n", - "type": "tarball", - "url": "https://github.com/openssl/openssl/archive/refs/tags/OpenSSL_1_1_1n.tar.gz", - "url_template": "https://github.com///archive/refs/tags/.tar.gz" - } -} diff --git a/nix/sources-pmnsh.json b/nix/sources-pmnsh.json deleted file mode 100644 index ee7d64d2e..000000000 --- a/nix/sources-pmnsh.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "curl": { - "branch": "master", - "description": "A command line tool and library for transferring data with URL syntax", - "homepage": "http://curl.se/", - "pmnsh": { - "compat": { - "openbsd": { - "prepare": "autoreconf -vfi && ./configure --disable-shared --disable-ldap --disable-rtsp --without-brotli --without-libidn2 --without-libpsl --without-nghttp2 --with-openssl=`readlink -f ../openssl/build`" - } - }, - "include": "include", - "lib": "lib/.libs", - "prepare": "autoreconf -vfi && ./configure --disable-shared --disable-ldap --disable-rtsp --without-brotli --without-libidn2 --without-libpsl --without-nghttp2 --with-openssl", - "make": "-C lib libcurl.la" - }, - "owner": "curl", - "repo": "curl", - "rev": "curl-7_77_0", - "type": "tarball", - "url": "https://github.com/curl/curl/archive/curl-7_77_0.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "lmdb": { - "branch": "mdb.master", - "description": "LMDB library", - "homepage": "http://www.lmdb.tech/", - "pmnsh": { - "strip": 2, - "make": "liblmdb.a" - }, - "owner": "LMDB", - "repo": "lmdb", - "rev": "48a7fed59a8aae623deff415dda27097198ca0c1", - "type": "tarball", - "url": "https://github.com/LMDB/lmdb/archive/48a7fed59a8aae623deff415dda27097198ca0c1.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "secp256k1": { - "branch": "master", - "description": "Optimized C library for ECDSA signatures and secret/public key operations on curve secp256k1.", - "homepage": null, - "owner": "bitcoin-core", - "pmnsh": { - "include": "include", - "lib": ".libs", - "make": "libsecp256k1.la", - "prepare": "./autogen.sh && ./configure --disable-shared --enable-benchmark=no --enable-exhaustive-tests=no --enable-experimental --enable-module-ecdh --enable-module-recovery --enable-module-schnorrsig --enable-tests=yes CFLAGS=-DSECP256K1_API=" - }, - "repo": "secp256k1", - "rev": "5dcc6f8dbdb1850570919fc9942d22f728dbc0af", - "sha256": "x9qG2S6tBSRseWaFIN9N2fRpY1vkv8idT3d3rfJnmaU", - "type": "tarball", - "url": "https://github.com/bitcoin-core/secp256k1/archive/5dcc6f8dbdb1850570919fc9942d22f728dbc0af.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "uv": { - "branch": "v1.x", - "description": "Cross-platform asynchronous I/O", - "homepage": "http://libuv.org/", - "pmnsh": { - "include": "include", - "lib": ".libs", - "prepare": "./autogen.sh && ./configure --disable-shared", - "make": "libuv.la", - "compat": { - "m1brew": false - } - }, - "owner": "libuv", - "repo": "libuv", - "rev": "v1.40.0", - "type": "tarball", - "url": "https://github.com/libuv/libuv/archive/v1.40.0.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "ent": { - "pmnsh": { - "prepare": "./configure" - } - }, - "urcrypt": { - "pmnsh": { - "compat": { - "openbsd": { - "make": "install prefix=`readlink -f .` exec_prefix=`readlink -f .`", - "include": "include", - "lib": "lib" - } - }, - "prepare": "./autogen.sh && ./configure --disable-shared PKG_CONFIG_PATH=../secp256k1 CFLAGS=\"-I../secp256k1/include -I../libaes_siv\" LDFLAGS=-L../libaes_siv", - "make": "install" - } - } -} diff --git a/nix/sources.json b/nix/sources.json deleted file mode 100644 index 86a17da1e..000000000 --- a/nix/sources.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "h2o": { - "branch": "master", - "description": "H2O - the optimized HTTP/1, HTTP/2, HTTP/3 server", - "homepage": "https://h2o.examp1e.net", - "owner": "h2o", - "pmnsh": { - "compat": { - "mingw": { - "prepare": "cmake -G\"MSYS Makefiles\" -DCMAKE_INSTALL_PREFIX=. ." - }, - "openbsd": { - "prepare": "cmake -DOPENSSL_ROOT_DIR=`readlink -f ../openssl/build` ." - } - }, - "include": "include", - "make": "libh2o", - "prepare": "cmake ." - }, - "repo": "h2o", - "rev": "v2.2.6", - "sha256": "0qni676wqvxx0sl0pw9j0ph7zf2krrzqc1zwj73mgpdnsr8rsib7", - "type": "tarball", - "url": "https://github.com/h2o/h2o/archive/v2.2.6.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "libaes_siv": { - "branch": "master", - "description": null, - "homepage": null, - "owner": "dfoxfranke", - "pmnsh": { - "compat": { - "m1brew": { - "make": "install CFLAGS=$(pkg-config --cflags openssl)", - "prepare": "cmake ." - }, - "mingw": { - "make": "aes_siv_static", - "prepare": "cmake -G\"MSYS Makefiles\" -DDISABLE_DOCS:BOOL=ON ." - }, - "openbsd": { - "make": "aes_siv_static", - "prepare": "cmake -DDISABLE_DOCS:BOOL=ON -DOPENSSL_ROOT_DIR=`readlink -f ../openssl/build` ." - } - } - }, - "repo": "libaes_siv", - "rev": "9681279cfaa6e6399bb7ca3afbbc27fc2e19df4b", - "sha256": "1g4wy0m5wpqx7z6nillppkh5zki9fkx9rdw149qcxh7mc5vlszzi", - "type": "tarball", - "url": "https://github.com/dfoxfranke/libaes_siv/archive/9681279cfaa6e6399bb7ca3afbbc27fc2e19df4b.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "murmur3": { - "branch": "master", - "description": null, - "homepage": null, - "owner": "urbit", - "pmnsh": { - "make": "static" - }, - "repo": "murmur3", - "rev": "71a75d57ca4e7ca0f7fc2fd84abd93595b0624ca", - "sha256": "0k7jq2nb4ad9ajkr6wc4w2yy2f2hkwm3nkbj2pklqgwsg6flxzwg", - "type": "tarball", - "url": "https://github.com/urbit/murmur3/archive/71a75d57ca4e7ca0f7fc2fd84abd93595b0624ca.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "niv": { - "branch": "master", - "description": "Easy dependency management for Nix projects", - "homepage": "https://github.com/nmattia/niv", - "owner": "nmattia", - "repo": "niv", - "rev": "9d35b9e4837ab88517210b1701127612c260eccf", - "sha256": "0q50xhnm8g2yfyakrh0nly4swyygxpi0a8cb9gp65wcakcgvzvdh", - "type": "tarball", - "url": "https://github.com/nmattia/niv/archive/9d35b9e4837ab88517210b1701127612c260eccf.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "nixpkgs": { - "branch": "master", - "description": "Nix Packages collection", - "homepage": "", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "376d67e1cd05d5ac8a64a3f47f17b80fb6394792", - "sha256": "1l4ai1dppwdbkkjbvnavsivr5kx00b3q8640pilpnifskfmfc8mp", - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/376d67e1cd05d5ac8a64a3f47f17b80fb6394792.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "softfloat3": { - "branch": "master", - "description": null, - "homepage": null, - "owner": "urbit", - "pmnsh": { - "compat": { - "m1brew": { - "lib": "build/template-FAST_INT64", - "make": "-C build/template-FAST_INT64 libsoftfloat3.a" - }, - "mingw": { - "lib": "build/Win64-MinGW-w64", - "make": "-C build/Win64-MinGW-w64 libsoftfloat3.a" - }, - "openbsd": { - "lib": "build/template-FAST_INT64", - "make": "-C build/template-FAST_INT64 libsoftfloat3.a" - } - }, - "include": "source/include" - }, - "repo": "berkeley-softfloat-3", - "rev": "ec4c7e31b32e07aad80e52f65ff46ac6d6aad986", - "sha256": "1lz4bazbf7lns1xh8aam19c814a4n4czq5xsq5rmi9sgqw910339", - "type": "tarball", - "url": "https://github.com/urbit/berkeley-softfloat-3/archive/ec4c7e31b32e07aad80e52f65ff46ac6d6aad986.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - } -} diff --git a/nix/sources.nix b/nix/sources.nix deleted file mode 100644 index 1938409dd..000000000 --- a/nix/sources.nix +++ /dev/null @@ -1,174 +0,0 @@ -# This file has been generated by Niv. - -let - - # - # The fetchers. fetch_ fetches specs of type . - # - - fetch_file = pkgs: name: spec: - let - name' = sanitizeName name + "-src"; - in - if spec.builtin or true then - builtins_fetchurl { inherit (spec) url sha256; name = name'; } - else - pkgs.fetchurl { inherit (spec) url sha256; name = name'; }; - - fetch_tarball = pkgs: name: spec: - let - name' = sanitizeName name + "-src"; - in - if spec.builtin or true then - builtins_fetchTarball { name = name'; inherit (spec) url sha256; } - else - pkgs.fetchzip { name = name'; inherit (spec) url sha256; }; - - fetch_git = name: spec: - let - ref = - if spec ? ref then spec.ref else - if spec ? branch then "refs/heads/${spec.branch}" else - if spec ? tag then "refs/tags/${spec.tag}" else - abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!"; - in - builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; }; - - fetch_local = spec: spec.path; - - fetch_builtin-tarball = name: throw - ''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`. - $ niv modify ${name} -a type=tarball -a builtin=true''; - - fetch_builtin-url = name: throw - ''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`. - $ niv modify ${name} -a type=file -a builtin=true''; - - # - # Various helpers - # - - # https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695 - sanitizeName = name: - ( - concatMapStrings (s: if builtins.isList s then "-" else s) - ( - builtins.split "[^[:alnum:]+._?=-]+" - ((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name) - ) - ); - - # The set of packages used when specs are fetched using non-builtins. - mkPkgs = sources: system: - let - sourcesNixpkgs = - import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { inherit system; }; - hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath; - hasThisAsNixpkgsPath = == ./.; - in - if builtins.hasAttr "nixpkgs" sources - then sourcesNixpkgs - else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then - import {} - else - abort - '' - Please specify either (through -I or NIX_PATH=nixpkgs=...) or - add a package called "nixpkgs" to your sources.json. - ''; - - # The actual fetching function. - fetch = pkgs: name: spec: - - if ! builtins.hasAttr "type" spec then - abort "ERROR: niv spec ${name} does not have a 'type' attribute" - else if spec.type == "file" then fetch_file pkgs name spec - else if spec.type == "tarball" then fetch_tarball pkgs name spec - else if spec.type == "git" then fetch_git name spec - else if spec.type == "local" then fetch_local spec - else if spec.type == "builtin-tarball" then fetch_builtin-tarball name - else if spec.type == "builtin-url" then fetch_builtin-url name - else - abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}"; - - # If the environment variable NIV_OVERRIDE_${name} is set, then use - # the path directly as opposed to the fetched source. - replace = name: drv: - let - saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name; - ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}"; - in - if ersatz == "" then drv else - # this turns the string into an actual Nix path (for both absolute and - # relative paths) - if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}"; - - # Ports of functions for older nix versions - - # a Nix version of mapAttrs if the built-in doesn't exist - mapAttrs = builtins.mapAttrs or ( - f: set: with builtins; - listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set)) - ); - - # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295 - range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1); - - # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257 - stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1)); - - # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269 - stringAsChars = f: s: concatStrings (map f (stringToCharacters s)); - concatMapStrings = f: list: concatStrings (map f list); - concatStrings = builtins.concatStringsSep ""; - - # https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331 - optionalAttrs = cond: as: if cond then as else {}; - - # fetchTarball version that is compatible between all the versions of Nix - builtins_fetchTarball = { url, name ? null, sha256 }@attrs: - let - inherit (builtins) lessThan nixVersion fetchTarball; - in - if lessThan nixVersion "1.12" then - fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; })) - else - fetchTarball attrs; - - # fetchurl version that is compatible between all the versions of Nix - builtins_fetchurl = { url, name ? null, sha256 }@attrs: - let - inherit (builtins) lessThan nixVersion fetchurl; - in - if lessThan nixVersion "1.12" then - fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; })) - else - fetchurl attrs; - - # Create the final "sources" from the config - mkSources = config: - mapAttrs ( - name: spec: - if builtins.hasAttr "outPath" spec - then abort - "The values in sources.json should not have an 'outPath' attribute" - else - spec // { outPath = replace name (fetch config.pkgs name spec); } - ) config.sources; - - # The "config" used by the fetchers - mkConfig = - { sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null - , sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile) - , system ? builtins.currentSystem - , pkgs ? mkPkgs sources system - }: rec { - # The sources, i.e. the attribute set of spec name to spec - inherit sources; - - # The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers - inherit pkgs; - }; - -in -mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); } diff --git a/nix/test-fake-ship.nix b/nix/test-fake-ship.nix new file mode 100644 index 000000000..3a9a92a88 --- /dev/null +++ b/nix/test-fake-ship.nix @@ -0,0 +1,125 @@ +{ click, pier, pkgs }: + +let + poke = '' + => + |% + ++ take-poke-ack + |= =wire + =/ m (strand ,?) + ^- form:m + |= tin=strand-input:strand + ?+ in.tin `[%skip ~] + ~ `[%wait ~] + [~ %agent * %poke-ack *] + ?. =(wire wire.u.in.tin) + `[%skip ~] + ?~ p.sign.u.in.tin + `[%done %.y] + `[%done %.n] + == + ++ poke + |= [=dock =cage] + =/ m (strand ,?) + ^- form:m + =/ =card:agent:gall [%pass /poke %agent dock %poke cage] + ;< ~ bind:m (send-raw-card card) + (take-poke-ack /poke) + -- + + ''; + testThread = dojoCommand: + pkgs.writeTextFile { + name = "${dojoCommand}.hoon"; + text = '' + ${poke} + =/ m (strand ,vase) + ;< [=ship =desk =case] bind:m get-beak + ;< ok=? bind:m (poke [ship %dojo] %lens-command !>([%$ [%dojo '${dojoCommand}'] [%stdout ~]])) + (pure:m !>(ok)) + ''; + }; + appThread = generator: app: + pkgs.writeTextFile { + name = ":${app}|${generator}.hoon"; + text = '' + ${poke} + =/ m (strand ,vase) + ;< [=ship =desk =case] bind:m get-beak + ;< ok=? bind:m (poke [ship %dojo] %lens-command !>([%$ [%dojo '+${app}/${generator}'] [%app %${app}]])) + (pure:m !>(ok)) + ''; + }; + pokeApp = hoon: mark: app: + pkgs.writeTextFile { + name = ":${app} &${mark} ${hoon}.hoon"; + text = '' + ${poke} + =/ m (strand ,vase) + ;< [=ship =desk =case] bind:m get-beak + ;< ok=? bind:m (poke [ship %${app}] %${mark} !>(${hoon})) + (pure:m !>(ok)) + ''; + }; +in pkgs.stdenvNoCC.mkDerivation { + name = "test-urbit"; + + src = pier; + + phases = [ "unpackPhase" "buildPhase" "checkPhase" ]; + + nativeBuildInputs = [ pkgs.netcat ]; + + unpackPhase = '' + cp -R $src ./pier + chmod -R u+rw ./pier + ''; + + buildPhase = '' + set -x + set -e + + ${../urbit} -d ./pier 1>&2 2> $out + + tail -F $out >&2 & + + ${click} -k -p -i ${appThread "mass" "hood"} ./pier + + sleep 2 + + ${click} -k -p -i ${testThread "-test %/tests ~"} ./pier + + ${click} -k -p -i ${pokeApp "%agents" "noun" "test"} ./pier + ${click} -k -p -i ${pokeApp "%generators" "noun" "test"} ./pier + ${click} -k -p -i ${pokeApp "%marks" "noun" "test"} ./pier + + ${click} -k -p -i ${appThread "mass" "hood"} ./pier + sleep 2 + + ${click} -k -p -i ${pokeApp "~" "helm-pack" "hood"} ./pier + + ${click} -k -p -i ${appThread "trim" "hood"} ./pier + + ${click} -k -p -i ${appThread "mass" "hood"} ./pier + + ${click} -k -p -i ${appThread "meld" "hood"} ./pier + + ${click} -k -p -i ${appThread "mass" "hood"} ./pier + + ${click} -k -p -i ${appThread "exit" "hood"} ./pier + + set +x + ''; + + checkPhase = '' + if egrep "((FAILED|CRASHED|Failed)|warn:)" $out >/dev/null; then + exit 1 + fi + ''; + + doCheck = true; + + # Fix 'bind: operation not permitted' when nix.useSandbox = true on darwin. + # See https://github.com/NixOS/nix/blob/5f6840fbb49ae5b534423bd8a4360646ee93dbaf/src/libstore/build.cc#L2961 + __darwinAllowLocalNetworking = true; +} diff --git a/pkg/arvo/app/acme.hoon b/pkg/arvo/app/acme.hoon index 17ca28d3f..eea66b145 100644 --- a/pkg/arvo/app/acme.hoon +++ b/pkg/arvo/app/acme.hoon @@ -460,7 +460,7 @@ :- ~ ^- octs =; pro=json - (as-octt:mimes:html (en-json:html (sign:jws key.act pro bod))) + (as-octs:mimes:html (en:json:html (sign:jws key.act pro bod))) :- %o %- my :~ nonce+s+non url+s+(crip (en-purl:html url)) @@ -487,7 +487,7 @@ :: ?. =(400 p.rep) | ?~ r.rep | - =/ jon=(unit json) (de-json:html q.u.r.rep) + =/ jon=(unit json) (de:json:html q.u.r.rep) ?~ jon | =('urn:ietf:params:acme:error:badNonce' type:(error:grab u.jon)) :: +rate-limited: handle Acme service rate-limits @@ -496,7 +496,7 @@ |= [try=@ud act=@tas spur=wire bod=(unit octs)] ^+ this =/ jon=(unit json) - ?~(bod ~ (de-json:html q.u.bod)) + ?~(bod ~ (de:json:html q.u.bod)) ?~ jon :: no details, back way off :: XX specifically based on wire @@ -839,7 +839,7 @@ ?: (lth try 10) (retry:effect try %directory / (min ~m30 (backoff try))) (emil (notify (failure-message directory-base) [(sell !>(rep)) ~])) - =. dir (directory:grab (need (de-json:html q:(need r.rep)))) + =. dir (directory:grab (need (de:json:html q:(need r.rep)))) ?~(reg.act register:effect this) :: +nonce: accept new nonce and trigger next effect :: @@ -883,7 +883,7 @@ ?~ r.rep (scot %da now.bow) =/ bod=acct:body - (acct:grab (need (de-json:html q.u.r.rep))) + (acct:grab (need (de:json:html q.u.r.rep))) ?> ?=(%valid sas.bod) wen.bod =. reg.act `[wen loc] @@ -913,7 +913,7 @@ :: XX check status :: =/ bod=order:body - (order:grab (need (de-json:html q:(need r.rep)))) + (order:grab (need (de:json:html q:(need r.rep)))) =/ dom=(set turf) ~(key by dom.u.next-order) :: XX maybe generate key here? :: @@ -956,7 +956,7 @@ :: (emil (notify (failure-message ego.u.rod) [(sell !>(rep)) ~])) =/ bod=order:body - (order:grab (need (de-json:html q:(need r.rep)))) + (order:grab (need (de:json:html q:(need r.rep)))) ?+ sas.bod ~& [%check-order-status-unknown sas.bod] this @@ -1063,7 +1063,7 @@ :: (emil (notify (failure-message i.pending.aut.u.rod) [(sell !>(rep)) ~])) =/ bod=auth:body - (auth:grab (need (de-json:html q:(need r.rep)))) + (auth:grab (need (de:json:html q:(need r.rep)))) =/ cal=trial :: XX parse token to verify url-safe base64? :: @@ -1147,7 +1147,7 @@ :: XX get challenge, confirm urn:ietf:params:acme:error:connection :: :: =/ err=error:body - :: (error:grab (need (de-json:html q:(need r.rep)))) + :: (error:grab (need (de:json:html q:(need r.rep)))) :: ?: =('urn:ietf:params:acme:error:malformed' status.err) :: =< cancel-order:effect @@ -1155,7 +1155,7 @@ 'unable to finalize domain validation challenge' (emil (notify msg [(sell !>(rep)) ~])) =/ bod=challenge:body - (challenge:grab (need (de-json:html q:(need r.rep)))) + (challenge:grab (need (de:json:html q:(need r.rep)))) :: XX check for other possible values in 200 response :: note: may have already been validated :: diff --git a/pkg/arvo/app/aqua.hoon b/pkg/arvo/app/aqua.hoon index efe256f0e..5aac4fa42 100644 --- a/pkg/arvo/app/aqua.hoon +++ b/pkg/arvo/app/aqua.hoon @@ -615,7 +615,7 @@ :: ?: fake.ae ~ =+ [%raw-poke %noun %refresh-rate ~s30] - [/g/aqua/reduce-refresh-rate %deal [. .]:who.ae %azimuth -]~ + [/g/aqua/reduce-refresh-rate %deal [. . /]:who.ae %azimuth -]~ == == =. this diff --git a/pkg/arvo/app/azimuth-rpc.hoon b/pkg/arvo/app/azimuth-rpc.hoon index 832971233..9d69d49ba 100644 --- a/pkg/arvo/app/azimuth-rpc.hoon +++ b/pkg/arvo/app/azimuth-rpc.hoon @@ -45,7 +45,6 @@ |= [=mark =vase] ^- (quip card _this) |^ - ?> (team:title our.bowl src.bowl) ?+ mark (on-poke:def mark vase) %handle-http-request =+ !<([id=@ta req=inbound-request:eyre] vase) @@ -53,6 +52,7 @@ (handle-http-request id req) :: %azimuth-action + ?> (team:title our.bowl src.bowl) =+ !<([%disconnect bind=binding:eyre] vase) ~& >>> "disconnecting at {}" :_ this diff --git a/pkg/arvo/app/claz.hoon b/pkg/arvo/app/claz.hoon index 64c20abcc..356407702 100644 --- a/pkg/arvo/app/claz.hoon +++ b/pkg/arvo/app/claz.hoon @@ -269,7 +269,7 @@ |= reg=cord ^- (list [=ship rights]) ~| %registration-json-insane - =+ jon=(need (de-json:html reg)) + =+ jon=(need (de:json:html reg)) ~| %registration-json-invalid ?> ?=(%o -.jon) =. p.jon (~(del by p.jon) 'idCode') diff --git a/pkg/arvo/app/dbug.hoon b/pkg/arvo/app/dbug.hoon index 5e8e8e2d7..a14d1d3dc 100644 --- a/pkg/arvo/app/dbug.hoon +++ b/pkg/arvo/app/dbug.hoon @@ -361,16 +361,58 @@ :: [%eyre %authentication ~] %- some - :- %a - %+ turn - %+ sort ~(tap by sessions:auth-state:v-eyre) - |= [[@uv a=session:eyre] [@uv b=session:eyre]] - (gth expiry-time.a expiry-time.b) - |= [cookie=@uv session:eyre] + =/ auth auth-state:v-eyre %- pairs - :~ 'cookie'^s+(end [3 4] (rsh [3 2] (scot %x (shax cookie)))) - 'expiry'^(time expiry-time) - 'channels'^(numb ~(wyt in channels)) + :~ :- 'sessions' + :- %a + %+ turn + %+ sort ~(tap by sessions.auth) + |= [[@uv a=session:eyre] [@uv b=session:eyre]] + (gth expiry-time.a expiry-time.b) + |= [cookie=@uv session:eyre] + %- pairs + :~ 'cookie'^s+(scot %uv cookie) + 'identity'^(render-identity:v-eyre identity) + 'expiry'^(time expiry-time) + 'channels'^(numb ~(wyt in channels)) + == + :: + :- 'visitors' + :- %a + %+ turn + %+ sort ~(tap by visitors.auth) + |= [[@uv a=visitor:eyre] [@uv b=visitor:eyre]] + ?@ +.a & + ?@ +.b | + (aor (scot %p ship.a) (scot %p ship.b)) + |= [nonce=@uv v=visitor:eyre] + %- pairs + :+ 'nonce'^s+(scot %uv nonce) + 'duct'^?~(duct.v ~ a+(turn u.duct.v path)) + ?@ +.v ['sesh' s+(scot %uv sesh.v)]~ + :~ 'pend'^b+?=(^ pend.v) + 'ship'^(ship ship.v) + 'last'^s+last.v + 'toke'^?~(toke.v ~ s+(scot %uv u.toke.v)) + == + :: + :- 'visiting' + :- %a + %- zing + %+ turn + %+ sort ~(tap by visiting.auth) + |= [[a=@p *] [b=@p *]] + (aor (scot %p a) (scot %p b)) + |= [who=@p q=(qeu @uv) m=(map @uv portkey)] + %+ turn ~(tap by m) + |= [nonce=@uv p=portkey] + %- pairs + :+ 'who'^(ship who) + 'nonce'^s+(scot %uv nonce) + ?@ p ['made' (time made.p)]~ + :~ ['pend' b+?=(^ pend.p)] + ['toke' ?~(toke.p ~ s+(scot %uv u.toke.p))] + == == :: :: /eyre/channels.json @@ -383,6 +425,7 @@ |= [key=@t channel:eyre] %- pairs :~ 'session'^s+key + 'identity'^(render-identity:v-eyre identity) 'connected'^b+!-.state 'expiry'^?-(-.state %& (time date.p.state), %| ~) 'next-id'^(numb next-id) @@ -992,6 +1035,16 @@ ++ channel-state (scry ^channel-state %e %channel-state ~) :: + ++ render-identity + |= =identity + ^- json + %- ship:enjs:format + ?- -.identity + %ours our.bowl + %fake who.identity + %real who.identity + == + :: ++ render-action |= =action ^- json diff --git a/pkg/arvo/app/debug/js/index.js b/pkg/arvo/app/debug/js/index.js index 776d0a35a..613975082 100644 --- a/pkg/arvo/app/debug/js/index.js +++ b/pkg/arvo/app/debug/js/index.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("buffer")):"function"==typeof define&&define.amd?define("index",["buffer"],t):t((e=e||self).buffer)}(this,function(e){"use strict";e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;var t="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},n=t.performance||{},r=(n.now||n.mozNow||n.msNow||n.oNow||n.webkitNow,"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{});function i(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function a(e,t){return e(t={exports:{}},t.exports),t.exports}var s=Object.getOwnPropertySymbols,u=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable;var c=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,r,i=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),o=1;o1?t-1:0),r=1;r1?t-1:0),r=1;r0&&"string"==typeof n[n.length-1]&&0===n[n.length-1].indexOf("\n in"))){var r=A.ReactDebugCurrentFrame.getStackAddendum();""!==r&&(t+="%s",n=n.concat([r]))}var i=n.map(function(e){return""+e});i.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,i);try{var o=0,a="Warning: "+t.replace(/%s/g,function(){return n[o++]});throw new Error(a)}catch(e){}}e(A,{ReactDebugCurrentFrame:P,ReactComponentTreeHook:{}});var L={};function F(e,t){var n=e.constructor,r=n&&(n.displayName||n.name)||"ReactClass",i=r+"."+t;L[i]||(j("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",t,r),L[i]=!0)}var z={isMounted:function(e){return!1},enqueueForceUpdate:function(e,t,n){F(e,"forceUpdate")},enqueueReplaceState:function(e,t,n,r){F(e,"replaceState")},enqueueSetState:function(e,t,n,r){F(e,"setState")}},W={};function B(e,t,n){this.props=e,this.context=t,this.refs=W,this.updater=n||z}Object.freeze(W),B.prototype.isReactComponent={},B.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},B.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};var Y={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]},H=function(e,t){Object.defineProperty(B.prototype,e,{get:function(){I("%s(...) is deprecated in plain JavaScript React classes. %s",t[0],t[1])}})};for(var V in Y)Y.hasOwnProperty(V)&&H(V,Y[V]);function $(){}function q(e,t,n){this.props=e,this.context=t,this.refs=W,this.updater=n||z}$.prototype=B.prototype;var G=q.prototype=new $;G.constructor=q,e(G,B.prototype),G.isPureReactComponent=!0;var Q,K,Z,X=Object.prototype.hasOwnProperty,J={key:!0,ref:!0,__self:!0,__source:!0};function ee(e){if(X.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}function te(e){if(X.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}Z={};var ne=function(e,t,n,r,o,a,s){var u={$$typeof:i,type:e,key:t,ref:n,props:s,_owner:a,_store:{}};return Object.defineProperty(u._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(u,"_self",{configurable:!1,enumerable:!1,writable:!1,value:r}),Object.defineProperty(u,"_source",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.freeze&&(Object.freeze(u.props),Object.freeze(u)),u};function re(e,t,n){var r,i={},o=null,a=null,s=null,u=null;if(null!=t)for(r in ee(t)&&(a=t.ref,function(e){if("string"==typeof e.ref&&C.current&&e.__self&&C.current.stateNode!==e.__self){var t=R(C.current.type);Z[t]||(j('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://fb.me/react-strict-mode-string-ref',R(C.current.type),e.ref),Z[t]=!0)}}(t)),te(t)&&(o=""+t.key),s=void 0===t.__self?null:t.__self,u=void 0===t.__source?null:t.__source,t)X.call(t,r)&&!J.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(1===l)i.children=n;else if(l>1){for(var c=Array(l),f=0;f.")}return t}(t);if(!xe[n]){xe[n]=!0;var r="";e&&e._owner&&e._owner!==C.current&&(r=" It was passed a child from "+R(e._owner.type)+"."),D(e),j('Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',n,r),D(null)}}}function Se(e,t){if("object"==typeof e)if(Array.isArray(e))for(var n=0;n",u=" Did you accidentally export a JSX literal instead of a component?"):l=typeof e,j("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",l,u)}var f=re.apply(this,arguments);if(null==f)return f;if(s)for(var d=2;d1){for(var h=Array(d),p=0;p is not supported and will be removed in a future major release. Did you mean to render instead?")),n.Provider},set:function(e){n.Provider=e}},_currentValue:{get:function(){return n._currentValue},set:function(e){n._currentValue=e}},_currentValue2:{get:function(){return n._currentValue2},set:function(e){n._currentValue2=e}},_threadCount:{get:function(){return n._threadCount},set:function(e){n._threadCount=e}},Consumer:{get:function(){return r||(r=!0,j("Rendering is not supported and will be removed in a future major release. Did you mean to render instead?")),n.Consumer}}}),n.Consumer=o,n._currentRenderer=null,n._currentRenderer2=null,n},t.createElement=Oe,t.createFactory=Ae,t.createRef=function(){var e={current:null};return Object.seal(e),e},t.forwardRef=function(e){return null!=e&&e.$$typeof===g?j("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):"function"!=typeof e?j("forwardRef requires a render function but was given %s.",null===e?"null":typeof e):0!==e.length&&2!==e.length&&j("forwardRef render functions accept exactly two parameters: props and ref. %s",1===e.length?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),null!=e&&(null==e.defaultProps&&null==e.propTypes||j("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?")),{$$typeof:h,render:e}},t.isValidElement=ie,t.lazy=function(e){var t,n,r={$$typeof:v,_ctor:e,_status:-1,_result:null};return Object.defineProperties(r,{defaultProps:{configurable:!0,get:function(){return t},set:function(e){j("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),t=e,Object.defineProperty(r,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return n},set:function(e){j("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),n=e,Object.defineProperty(r,"propTypes",{enumerable:!0})}}}),r},t.memo=function(e,t){return _e(e)||j("memo: The first argument must be a component. Instead received: %s",null===e?"null":typeof e),{$$typeof:g,type:e,compare:void 0===t?null:t}},t.useCallback=function(e,t){return we().useCallback(e,t)},t.useContext=function(e,t){var n=we();if(void 0!==t&&j("useContext() second argument is reserved for future use in React. Passing it is not supported. You passed: %s.%s",t,"number"==typeof t&&Array.isArray(arguments[2])?"\n\nDid you call array.map(useContext)? Calling Hooks inside a loop is not supported. Learn more at https://fb.me/rules-of-hooks":""),void 0!==e._context){var r=e._context;r.Consumer===e?j("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"):r.Provider===e&&j("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return n.useContext(e,t)},t.useDebugValue=function(e,t){return we().useDebugValue(e,t)},t.useEffect=function(e,t){return we().useEffect(e,t)},t.useImperativeHandle=function(e,t,n){return we().useImperativeHandle(e,t,n)},t.useLayoutEffect=function(e,t){return we().useLayoutEffect(e,t)},t.useMemo=function(e,t){return we().useMemo(e,t)},t.useReducer=function(e,t,n){return we().useReducer(e,t,n)},t.useRef=function(e){return we().useRef(e)},t.useState=function(e){return we().useState(e)},t.version="16.14.0"}()}),S=(E.Children,E.Component,E.Fragment,E.Profiler,E.PureComponent,E.StrictMode,E.Suspense,E.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,E.cloneElement,E.createContext,E.createElement,E.createFactory,E.createRef,E.forwardRef,E.isValidElement,E.lazy,E.memo,E.useCallback,E.useContext,E.useDebugValue,E.useEffect,E.useImperativeHandle,E.useLayoutEffect,E.useMemo,E.useReducer,E.useRef,E.useState,E.version,a(function(e){e.exports=E})),T=S.Component,C=S.createRef,N=S.createElement,M=S.useState,R=S.useRef,P=S.useEffect,O=S.Fragment,D=a(function(e,t){var n,r,i,o,a;if("undefined"==typeof window||"function"!=typeof MessageChannel){var s=null,u=null,l=function(){if(null!==s)try{var e=t.unstable_now();s(!0,e),s=null}catch(e){throw setTimeout(l,0),e}},c=Date.now();t.unstable_now=function(){return Date.now()-c},n=function(e){null!==s?setTimeout(n,0,e):(s=e,setTimeout(l,0))},r=function(e,t){u=setTimeout(e,t)},i=function(){clearTimeout(u)},o=function(){return!1},a=t.unstable_forceFrameRate=function(){}}else{var f=window.performance,d=window.Date,h=window.setTimeout,p=window.clearTimeout;if("undefined"!=typeof console){var m=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!=typeof m&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")}if("object"==typeof f&&"function"==typeof f.now)t.unstable_now=function(){return f.now()};else{var g=d.now();t.unstable_now=function(){return d.now()-g}}var v=!1,y=null,b=-1,_=5,w=0;o=function(){return t.unstable_now()>=w},a=function(){},t.unstable_forceFrameRate=function(e){0>e||125>>1,i=e[r];if(!(void 0!==i&&0C(a,n))void 0!==u&&0>C(u,a)?(e[r]=u,e[s]=n,r=s):(e[r]=a,e[o]=n,r=o);else{if(!(void 0!==u&&0>C(u,n)))break e;e[r]=u,e[s]=n,r=s}}}return t}return null}function C(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var N=[],M=[],R=1,P=null,O=3,D=!1,A=!1,I=!1;function j(e){for(var t=S(M);null!==t;){if(null===t.callback)T(M);else{if(!(t.startTime<=e))break;T(M),t.sortIndex=t.expirationTime,E(N,t)}t=S(M)}}function U(e){if(I=!1,j(e),!A)if(null!==S(N))A=!0,n(L);else{var t=S(M);null!==t&&r(U,t.startTime-e)}}function L(e,n){A=!1,I&&(I=!1,i()),D=!0;var a=O;try{for(j(n),P=S(N);null!==P&&(!(P.expirationTime>n)||e&&!o());){var s=P.callback;if(null!==s){P.callback=null,O=P.priorityLevel;var u=s(P.expirationTime<=n);n=t.unstable_now(),"function"==typeof u?P.callback=u:P===S(N)&&T(N),j(n)}else T(N);P=S(N)}if(null!==P)var l=!0;else{var c=S(M);null!==c&&r(U,c.startTime-n),l=!1}return l}finally{P=null,O=a,D=!1}}function F(e){switch(e){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var z=a;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){A||D||(A=!0,n(L))},t.unstable_getCurrentPriorityLevel=function(){return O},t.unstable_getFirstCallbackNode=function(){return S(N)},t.unstable_next=function(e){switch(O){case 1:case 2:case 3:var t=3;break;default:t=O}var n=O;O=t;try{return e()}finally{O=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=z,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=O;O=e;try{return t()}finally{O=n}},t.unstable_scheduleCallback=function(e,o,a){var s=t.unstable_now();if("object"==typeof a&&null!==a){var u=a.delay;u="number"==typeof u&&0s?(e.sortIndex=u,E(M,e),null===S(N)&&e===S(M)&&(I?i():I=!0,r(U,u-s))):(e.sortIndex=a,E(N,e),A||D||(A=!0,n(L))),e},t.unstable_shouldYield=function(){var e=t.unstable_now();j(e);var n=S(N);return n!==P&&null!==P&&null!==n&&null!==n.callback&&n.startTime<=e&&n.expirationTime=x},o=function(){},t.unstable_forceFrameRate=function(e){e<0||e>125?console.error("forceFrameRate takes a positive int between 0 and 125, forcing framerates higher than 125 fps is not unsupported"):k=e>0?Math.floor(1e3/e):5};var E=new MessageChannel,S=E.port2;E.port1.onmessage=function(){if(null!==_){var e=t.unstable_now();x=e+k;try{_(!0,e)?S.postMessage(null):(b=!1,_=null)}catch(e){throw S.postMessage(null),e}}else b=!1},e=function(e){_=e,b||(b=!0,S.postMessage(null))},n=function(e,n){w=p(function(){e(t.unstable_now())},n)},r=function(){m(w),w=-1}}function T(e,t){var n=e.length;e.push(t),function(e,t,n){var r=n;for(;;){var i=r-1>>>1,o=e[i];if(!(void 0!==o&&M(o,t)>0))return;e[i]=t,e[r]=o,r=i}}(e,t,n)}function C(e){var t=e[0];return void 0===t?null:t}function N(e){var t=e[0];if(void 0!==t){var n=e.pop();return n!==t&&(e[0]=n,function(e,t,n){var r=n,i=e.length;for(;r$){if(($*=2)>V)return console.error("Scheduler Profiling: Event log exceeded maximum size. Don't forget to call `stopLoggingProfilingEvents()`."),void oe();var n=new Int32Array(4*$);n.set(G),q=n.buffer,G=n}G.set(e,t)}}function oe(){var e=q;return $=0,q=null,G=null,Q=0,e}function ae(e,t){F[Y]++,null!==G&&ie([K,1e3*t,e.id,e.priorityLevel])}function se(e,t){F[z]=R,F[W]=0,F[Y]--,null!==G&&ie([Z,1e3*t,e.id])}function ue(e,t){F[z]=R,F[W]=0,F[B]=0,null!==G&&ie([te,1e3*t,e.id,j])}var le=-1,ce=250,fe=5e3,de=1e4,he=1073741823,pe=[],me=[],ge=1,ve=null,ye=D,be=!1,_e=!1,we=!1;function ke(e){for(var t=C(me);null!==t;){if(null===t.callback)N(me);else{if(!(t.startTime<=e))return;N(me),t.sortIndex=t.expirationTime,T(pe,t),ae(t,e),t.isQueued=!0}t=C(me)}}function xe(t){if(we=!1,ke(t),!_e)if(null!==C(pe))_e=!0,e(Ee);else{var r=C(me);null!==r&&n(xe,r.startTime-t)}}function Ee(e,n){var i;i=n,null!==G&&ie([re,1e3*i,U]),_e=!1,we&&(we=!1,r()),be=!0;var o=ye;try{if(!s)return Se(e,n);try{return Se(e,n)}catch(e){if(null!==ve){var a=t.unstable_now();!function(e,t){F[z]=R,F[W]=0,F[Y]--,null!==G&&ie([X,1e3*t,e.id])}(ve,a),ve.isQueued=!1}throw e}}finally{ve=null,ye=o,be=!1,function(e){U++,null!==G&&ie([ne,1e3*e,U])}(t.unstable_now())}}function Se(e,r){var o,s,u=r;for(ke(u),ve=C(pe);null!==ve&&!a&&(!(ve.expirationTime>u)||e&&!i());){var l=ve.callback;if(null!==l){ve.callback=null,ye=ve.priorityLevel;var c=ve.expirationTime<=u;o=ve,s=u,j++,F[z]=o.priorityLevel,F[W]=o.id,F[B]=j,null!==G&&ie([ee,1e3*s,o.id,j]);var f=l(c);u=t.unstable_now(),"function"==typeof f?(ve.callback=f,ue(ve,u)):(se(ve,u),ve.isQueued=!1,ve===C(pe)&&N(pe)),ke(u)}else N(pe);ve=C(pe)}if(null!==ve)return!0;var d=C(me);return null!==d&&n(xe,d.startTime-u),!1}function Te(e){switch(e){case P:return le;case O:return ce;case I:return he;case A:return de;case D:default:return fe}}var Ce=o,Ne={startLoggingProfilingEvents:function(){$=H,q=new ArrayBuffer(4*$),G=new Int32Array(q),Q=0},stopLoggingProfilingEvents:oe,sharedProfilingBuffer:L};t.unstable_IdlePriority=I,t.unstable_ImmediatePriority=P,t.unstable_LowPriority=A,t.unstable_NormalPriority=D,t.unstable_Profiling=Ne,t.unstable_UserBlockingPriority=O,t.unstable_cancelCallback=function(e){e.isQueued&&(function(e,t){F[Y]--,null!==G&&ie([J,1e3*t,e.id])}(e,t.unstable_now()),e.isQueued=!1),e.callback=null},t.unstable_continueExecution=function(){_e||be||(_e=!0,e(Ee))},t.unstable_getCurrentPriorityLevel=function(){return ye},t.unstable_getFirstCallbackNode=function(){return C(pe)},t.unstable_next=function(e){var t;switch(ye){case P:case O:case D:t=D;break;default:t=ye}var n=ye;ye=t;try{return e()}finally{ye=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=Ce,t.unstable_runWithPriority=function(e,t){switch(e){case P:case O:case D:case A:case I:break;default:e=D}var n=ye;ye=e;try{return t()}finally{ye=n}},t.unstable_scheduleCallback=function(i,o,a){var s,u,l=t.unstable_now();if("object"==typeof a&&null!==a){var c=a.delay;s="number"==typeof c&&c>0?l+c:l,u="number"==typeof a.timeout?a.timeout:Te(i)}else u=Te(i),s=l;var f=s+u,d={id:ge++,callback:o,priorityLevel:i,startTime:s,expirationTime:f,sortIndex:-1,isQueued:!1};return s>l?(d.sortIndex=s,T(me,d),null===C(pe)&&d===C(me)&&(we?r():we=!0,n(xe,s-l))):(d.sortIndex=f,T(pe,d),ae(d,l),d.isQueued=!0,_e||be||(_e=!0,e(Ee))),d},t.unstable_shouldYield=function(){var e=t.unstable_now();ke(e);var n=C(pe);return n!==ve&&null!==ve&&null!==n&&null!==n.callback&&n.startTime<=e&&n.expirationTime