diff --git a/.circleci/config.yml b/.circleci/config.yml index 8c947f76e0e2a30e4b4267eb26e903c8171644dd..65a5f37affc425adc1e236c8a84ce65d4c198783 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,21 +17,38 @@ version: 2.1 jobs: build: docker: - # Run in a highly Nix-capable environment. This lets us use Stack's nix - # integration and other useful Nix features to specify and run the - # build. - - image: "nixorg/nix:circleci" + # Run in a highly Nix-capable environment. This lets build with Nix + # directly. + - image: "nixos/nix:2.3.16" resource_class: "xlarge" - steps: - - run: - name: "Setup Environment Variables" - command: | - # Set XDG_CONFIG_DIRS to point at the source directory, so that nix - # will pickup nix/nix.conf as a configuration file from there. - echo "export XDG_CONFIG_DIRS=$CIRCLE_WORKING_DIRECTORY" >> $BASH_ENV + environment: + # Add privatestorage's and haskell.nix[1] nix caches for builds. [1] + # https://input-output-hk.github.io/haskell.nix/tutorials/getting-started/#setting-up-the-binary-cache + # + # - iohk gives us lots of excellent cached Haskell-related objects + # - saxtons gives us a lot of other nice stuff such as Rust crates and any + # more Haskell libraries we might need + # + # Note the use of `>-` - YAML "folded-style chomping-strip block string" + # style to keep the list orderly in the source file yet represent a + # single line string with no trailing newline. + # https://stackoverflow.com/questions/3790454/how-do-i-break-a-string-in-yaml-over-multiple-lines/21699210 + # is an excellent resource on yaml strings. + EXTRA_SUBSTITUTERS: >- + https://hydra.iohk.io/ + http://saxtons.private.storage/ + # We needed to explictly specify the key for cache.nixos.org until we + # are using a version of nix that has + # https://github.com/NixOS/nix/commit/ff4dea63c9403880500f82ce273713ecf793d2d9 + TRUSTED_PUBLIC_KEYS: >- + cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= + hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= + saxtons.private.storage:MplOcEH8G/6mRlhlKkbA8GdeFR3dhCFsSszrspE/ZwY= + + steps: # Get *our* source code. - "checkout" - restore_cache: @@ -57,13 +74,15 @@ jobs: # If nixpkgs changes then potentially a lot of cached packages for # the base system will be invalidated so we may as well drop them # and make a new cache with the new packages. - - paymentserver-nix-store-v6-{{ checksum "nix/sources.json" }} - - paymentserver-nix-store-v6- + - paymentserver-nix-store-v7-{{ checksum "nix/sources.json" }} + - paymentserver-nix-store-v7- - run: name: "Building with Nix" command: | nix-build \ + --option extra-substituters "${EXTRA_SUBSTITUTERS}" \ + --option trusted-public-keys "${TRUSTED_PUBLIC_KEYS}" \ -j 4 \ ./nix/ \ -A PaymentServer.components.exes."PaymentServer-exe" @@ -72,6 +91,8 @@ jobs: name: "Building Tests" command: | nix-build \ + --option extra-substituters "${EXTRA_SUBSTITUTERS}" \ + --option trusted-public-keys "${TRUSTED_PUBLIC_KEYS}" \ -j 4 \ ./nix/ \ -A PaymentServer.components.tests."PaymentServer-tests" @@ -83,7 +104,7 @@ jobs: - save_cache: name: "Cache Nix Store Paths" - key: paymentserver-nix-store-v6-{{ checksum "nix/sources.json" }} + key: paymentserver-nix-store-v7-{{ checksum "nix/sources.json" }} paths: - "/nix" diff --git a/nix/nix.conf b/nix/nix.conf deleted file mode 100644 index 021bd60958ae4c441a26574778100c3864032963..0000000000000000000000000000000000000000 --- a/nix/nix.conf +++ /dev/null @@ -1,8 +0,0 @@ -# nix.conf for usage in CI. - -# Add privatestorage's and haskell.nix[1] nix caches for builds. -# [1] https://input-output-hk.github.io/haskell.nix/tutorials/getting-started/#setting-up-the-binary-cache -extra-substituters = http://saxtons.private.storage/ https://hydra.iohk.io/ -# We needed to explictly specify the key for cache.nixos.org until we are using a version of nix -# that has https://github.com/NixOS/nix/commit/ff4dea63c9403880500f82ce273713ecf793d2d9 -trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= saxtons.private.storage:MplOcEH8G/6mRlhlKkbA8GdeFR3dhCFsSszrspE/ZwY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=