diff --git a/ci/README.adoc b/ci/README.adoc deleted file mode 100644 index 1a7475dd6d..0000000000 --- a/ci/README.adoc +++ /dev/null @@ -1,14 +0,0 @@ -= CI (Continuous Integration) - -DFINITY uses https://nixos.org/hydra/[Hydra] for CI. Hydra's web-interface can -be reached via the VPN at: - -https://hydra.oregon.dfinity.build/ - -Hydra is organized into projects which can consist of multiple sets of jobs. We -currently have a single project `dfinity-ci-build` consisting of many jobsets. - -The https://github.com/dfinity-lab/hydra-jobsets[hydra-jobsets] repository -declaratively defines the jobsets that Hydra builds. As can be seen in that repo -`` is used to define to jobset of the `master` branch while -`` is used to define the jobset for each Pull-Request. diff --git a/ci/ci-pr.nix b/ci/ci-pr.nix deleted file mode 100644 index 49bdb1f084..0000000000 --- a/ci/ci-pr.nix +++ /dev/null @@ -1,3 +0,0 @@ -# This file is used to govern CI jobs for GitHub PRs -args@{ supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ], src ? builtins.fetchGit ../., ... }: -import ./ci.nix (args // { inherit supportedSystems src; isMaster = false; }) diff --git a/ci/ci.nix b/ci/ci.nix deleted file mode 100644 index 0f6cef0fe7..0000000000 --- a/ci/ci.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ] -, system ? builtins.currentSystem -, src ? builtins.fetchGit ../. -, RustSec-advisory-db ? pkgs.sources.advisory-db - -, isMaster ? true -, labels ? {} - - # The version of the release. Will be set to the right value in ./release.nix. -, releaseVersion ? "latest" - -, pkgs ? import ../nix { inherit system isMaster labels; } -}: -let - jobset = - pkgs.lib.mk-jobset { - inherit supportedSystems; - inherit (src) rev; - mkJobsetSpec = { system, pkgs, ... }: import ../. { - inherit system pkgs RustSec-advisory-db releaseVersion src; - }; - }; - - publish = import ./publish.nix { - inherit pkgs releaseVersion; - inherit (jobset) install; - }; -in -jobset // { inherit publish; } diff --git a/ci/publish.nix b/ci/publish.nix deleted file mode 100644 index 53b8971702..0000000000 --- a/ci/publish.nix +++ /dev/null @@ -1,56 +0,0 @@ -# Build a script to copy the dfx and install.sh release to the -# dfinity-download S3 bucket which is the origin of the -# download.dfinity.systems world-wide CDN. -# -# To run the dfx deployment script locally: -# * nix run -f ./ci/ci.nix publish.dfx -c activate -# and make sure that the environment variables -# "SLACK_CHANNEL_BUILD_NOTIFICATIONS_WEBHOOK" and "DFINITY_DOWNLOAD_DOMAIN" are -# set and that the environment variable "DFINITY_DOWNLOAD_BUCKET" is set and -# that you have access to the bucket. -# -# To run the install deployment script locally: -# * nix run -f ./ci/ci.nix publish.install-sh -c activate -# and make sure your AWS credentials are set, that the environment variable -# "DFINITY_DOWNLOAD_BUCKET" is set and that you have access to the bucket. -# -# This script will be executed by DFINITY's Continuous Deployment -# system. That system will also set the correct AWS credentials and the -# DFINITY_DOWNLOAD_BUCKET environment variable. -{ pkgs, releaseVersion, install }: -let - s3cp = pkgs.lib.writeCheckedShellScriptBin "s3cp" [] '' - set -eu - PATH="${pkgs.lib.makeBinPath [ pkgs.awscli ]}" - src="$1"; dst="$2"; contentType="$3"; cacheControl="$4" - dstUrl="s3://$DFINITY_DOWNLOAD_BUCKET/$dst" - if [ -d "$src" ]; then - echo "Can't copy $src to $dstUrl because it's a directory. Please specify a file instead." 1>&2; exit 1; - fi - echo "Uploading $src to $dstUrl (--cache-control $cacheControl, --content-type $contentType)..." - aws s3 cp "$src" "$dstUrl" \ - --cache-control "$cacheControl" \ - --no-guess-mime-type --content-type "$contentType" \ - --no-progress - ''; - -in -rec { - install-sh = pkgs.lib.writeCheckedShellScriptBin "activate" [] '' - set -eu - PATH="${pkgs.lib.makeBinPath [ s3cp ]}" - - do_not_cache="max-age=0,no-cache" - - # TODO: publish the manifest.json and install.sh to content - # addressable paths which can be cached for a long time. Then publish - # uncached --website-redirects to redirect sdk/manifest.json and - # sdk/install.sh to their content addressable alternatives. This way the latest - # manifest.json and install.sh will be available in the CDN and won't have - # to be fetched from the origin bucket. - # See: https://dfinity.atlassian.net/browse/INF-1145 - - s3cp "${../public/manifest.json}" "sdk/manifest.json" "application/json" "$do_not_cache" - s3cp "${install.x86_64-linux}" "sdk/install.sh" "application/x-sh" "$do_not_cache" - ''; -} diff --git a/ci/release.nix b/ci/release.nix deleted file mode 100644 index 52df94b0f5..0000000000 --- a/ci/release.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ src ? null }: -let - # doRelease is true when the git tag is of the right release format like `0.1.2`. - doRelease = src != null && versionMatches != null; - - # versionMatch is `null` if `src.gitTag` is not of the right format like "1.23.456" - # and it's a list of matches like [ "1.23.456" ] when it is. - versionMatches = builtins.match "([0-9]+\.[0-9]+\.[0-9]+(-beta\.[0-9]+)?)" src.gitTag; - releaseVersion = if versionMatches == null then "latest" else builtins.head versionMatches; - - shortRev = src.shortRev or "unknown"; - - ci = import ./ci.nix { inherit src releaseVersion; }; -in -if src == null then {} -else if !doRelease then builtins.trace '' - notice: treating this as a non-release commit - the tag ${src.gitTag} (rev ${shortRev}) does not appear to be a release version -'' {} else { - publish.dfx = ci.publish.dfx; -} diff --git a/default.nix b/default.nix deleted file mode 100644 index 3361368e71..0000000000 --- a/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ system ? builtins.currentSystem -, pkgs ? import ./nix { inherit system isMaster labels; } -, src ? builtins.fetchGit ./. -, releaseVersion ? "latest" -, RustSec-advisory-db ? pkgs.sources.advisory-db -, isMaster ? true -, labels ? {} -}: -rec { - inherit (pkgs) nix-fmt nix-fmt-check; - - install = import ./public { inherit pkgs src; }; -} diff --git a/nix/default.nix b/nix/default.nix deleted file mode 100644 index 5c8c0a8ded..0000000000 --- a/nix/default.nix +++ /dev/null @@ -1,95 +0,0 @@ -# Returns the nixpkgs set overridden and extended with DFINITY specific -# packages. -{ system ? builtins.currentSystem, isMaster ? true, labels ? {} }: -let - # The `common` repo provides code (mostly Nix) that is used in the - # `infra`, `dfinity` and `sdk` repositories. - # - # To conveniently test changes to a local `common` repo you set the `COMMON` - # environment variable to an absolute path of it. For example: - # - # COMMON="$(realpath ../common)" nix-build -A rust-workspace - commonSrc = let - localCommonSrc = builtins.getEnv "COMMON"; - in - if localCommonSrc != "" then localCommonSrc else sources.common; - - sources = import sourcesnix { - sourcesFile = ./sources.json; - inherit pkgs; - }; - - sourcesnix = builtins.fetchurl { - url = - "https://raw.githubusercontent.com/nmattia/niv/d13bf5ff11850f49f4282d59b25661c45a851936/nix/sources.nix"; - sha256 = "0a2rhxli7ss4wixppfwks0hy3zpazwm9l3y2v9krrnyiska3qfrw"; - }; - - pkgs = import (commonSrc + "/pkgs") { - inherit system isMaster labels; - extraSources = sources; - repoRoot = ../.; - overlays = [ - ( - self: super: - let - nixFmt = self.lib.nixFmt {}; - in - { - agent-rs = self.naersk.buildPackage { - name = "agent-rs"; - root = self.sources.agent-rs; - cargoBuildOptions = x: x ++ [ "-p" "icx" ]; - cargoTestOptions = x: x ++ [ "-p" "icx" ]; - buildInputs = self.lib.optional self.stdenv.isDarwin pkgs.libiconv; - override = attrs: { - OPENSSL_STATIC = "1"; - OPENSSL_LIB_DIR = "${self.pkgsStatic.openssl.out}/lib"; - OPENSSL_INCLUDE_DIR = "${self.pkgsStatic.openssl.dev}/include"; - }; - }; - dfinity = - (import self.sources.dfinity { inherit (self) system; }).dfinity.rs; - napalm = self.callPackage self.sources.napalm { - pkgs = self // { nodejs = self.nodejs-12_x; }; - }; - - ic-ref = pkgs.runCommandNoCCLocal "ic-ref" { - src = self.sources."ic-ref-${self.system}"; - } '' - mkdir -p $out/bin - tar -C $out/bin/ -xf $src - ''; - motoko = pkgs.runCommandNoCCLocal "motoko" { - src = self.sources."motoko-${self.system}"; - } '' - mkdir -p $out/bin - tar -C $out/bin -xf $src - ''; - icx-proxy = pkgs.runCommandNoCCLocal "icx-proxy" { - src = self.sources."icx-proxy-${pkgs.system}"; - } '' - mkdir -p $out/bin - tar -C $out/bin -xf $src - ''; - - nix-fmt = nixFmt.fmt; - nix-fmt-check = nixFmt.check; - - # An attribute set mapping every supported system to a nixpkgs evaluated for - # that system. Special care is taken not to reevaluate nixpkgs for the current - # system because we already did that in self. - pkgsForSystem = super.lib.genAttrs [ "x86_64-linux" "x86_64-darwin" ] - ( - supportedSystem: - if supportedSystem == system then - self - else - import ./. { system = supportedSystem; } - ); - } - ) - ]; - }; -in -pkgs diff --git a/nix/sources.json b/nix/sources.json index 56541e2e2c..5b584e60e0 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -12,25 +12,6 @@ "url": "https://github.com/RustSec/advisory-db/archive/b4ed9228470b76218f4618ed46d9690ac41af09c.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, - "agent-rs": { - "branch": "main", - "repo": "https://github.com/dfinity/agent-rs", - "rev": "00fe152af028e196e18bedb30fc226f85c4dfe31", - "type": "git" - }, - "bats-support": { - "branch": "v0.3.0", - "builtin": false, - "description": "Supporting library for Bats test helpers", - "homepage": null, - "owner": "ztombol", - "repo": "bats-support", - "rev": "24a72e14349690bcbf7c151b9d2d1cdd32d36eb1", - "sha256": "1sm1y752jrz41qm4bxivk1363ac5zpkyshkk156aqf2p5qjxgpp0", - "type": "tarball", - "url": "https://github.com/ztombol/bats-support/archive/24a72e14349690bcbf7c151b9d2d1cdd32d36eb1.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, "canister-sandbox-x86_64-darwin": { "builtin": false, "description": "The canister-sandbox binary. It must be updated together with the replica binary.", @@ -49,12 +30,6 @@ "url": "https://download.dfinity.systems/blessed/ic/75327e7e84d2c89770a49e775c7fd9e3e0af8e79/sdk-release/x86_64-linux/canister_sandbox.gz", "url_template": "https://download.dfinity.systems/blessed/ic//sdk-release/x86_64-linux/canister_sandbox.gz" }, - "common": { - "branch": "master", - "repo": "ssh://git@github.com/dfinity-lab/common", - "rev": "be8e4f53543be65cfbaa7738adf2c728fbc4cbda", - "type": "git" - }, "ic-btc-adapter-x86_64-darwin": { "builtin": false, "rev": "75327e7e84d2c89770a49e775c7fd9e3e0af8e79", @@ -165,19 +140,6 @@ "url_template": "https://github.com/dfinity/motoko/releases/download//motoko-linux64-.tar.gz", "version": "0.6.29" }, - "napalm": { - "branch": "master", - "builtin": false, - "description": "Support for building npm packages in Nix and lightweight npm registry", - "homepage": "", - "owner": "nmattia", - "repo": "napalm", - "rev": "4db4f253c78cfa8d8e8defb45dfe25e04409142a", - "sha256": "1rzj7a3r6wcsfjlzs5fj1min3rk8d8k9g9v00kmygdl1696mnkrb", - "type": "tarball", - "url": "https://github.com/nmattia/napalm/archive/4db4f253c78cfa8d8e8defb45dfe25e04409142a.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, "replica-x86_64-darwin": { "builtin": false, "description": "The replica binary. It must be updated together with the canister-sandbox binary.", diff --git a/public/default.nix b/public/default.nix deleted file mode 100644 index d92900a3c6..0000000000 --- a/public/default.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ pkgs ? import ../nix { inherit system; } -, system ? builtins.currentSystem -, src ? builtins.fetchGit ../. -}: -let - install = - pkgs.runCommandNoCC "install.sh.template" { - src = pkgs.lib.gitOnlySource ./install; - preferLocalBuild = true; - allowSubstitutes = false; - nativeBuildInputs = [ pkgs.shfmt pkgs.shellcheck ]; - allowedReferences = []; - } '' - echo "Running shellcheck..." - shellcheck --shell=sh $src/*.sh \ - --exclude SC2034,SC2154,SC3003,SC3014,SC3043 - - echo "Running shfmt..." - shfmt -d -p -i 4 -ci -bn -s $src/*.sh - - echo "Creating output..." - cat $src/*.sh > $out - - echo "Fixing up..." - # Get rid of comments that don't start with '##' or '#!'. - sed -i " - /#!.*/p - /##.*/p - /^ *$/d - /^ *#/d - s/ *#.*// - " $out - ''; -in -pkgs.lib.linuxOnly ( - pkgs.runCommandNoCC "install.sh" { - # `revision` will be printed by `install.sh` as follows: - # - # log "Executing DFX install script, commit: @revision@" - revision = src.rev; - preferLocalBuild = true; - allowSubstitutes = false; - inherit install; - } '' - # we stamp the file with the revision - substitute $install $out --subst-var revision - chmod +x $out - '' -) diff --git a/shell.nix b/shell.nix deleted file mode 100644 index aba6d4689a..0000000000 --- a/shell.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ pkgs ? import ./nix {} }: -let - packages = import ./. { inherit pkgs; }; -in -pkgs.mkCompositeShell { - name = "dfinity-sdk-env"; - inputsFrom = pkgs.lib.attrValues packages.shells; - nativeBuildInputs = [ pkgs.nix-fmt ]; -}