diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command new file mode 100644 index 00000000000..d3afdb6ed5e --- /dev/null +++ b/.buildkite/hooks/pre-command @@ -0,0 +1,5 @@ +======= +set -x + +NIX_PATH="nixpkgs=$(nix-build fetch-nixpkgs.nix -o nixpkgs)" +export NIX_PATH diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index e0f45eb37f0..d58bd8de795 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -1,15 +1,15 @@ steps: - label: 'stack2nix' - command: 'scripts/ci/nix-shell.sh -p cabal2nix stack cabal-install ghc moreutils expect -Q -j 4 --run scripts/check-stack2nix.sh' + command: 'nix-shell -Q -j 4 --run scripts/check-stack2nix.sh' agents: system: x86_64-linux - label: 'release.nix' - command: 'scripts/ci/nix-shell.sh --run scripts/ci/check-hydra.sh' + command: 'nix-shell --run scripts/ci/check-hydra.sh' agents: system: x86_64-linux - label: 'explorer frontend: checking generated dependencies' - command: 'scripts/ci/nix-shell.sh --run "cd explorer/frontend && ./nix/generate-frontend-deps.hs --test"' + command: "cd explorer/frontend && ./nix/generate-frontend-deps.hs --test" agents: system: x86_64-linux diff --git a/pkgs/generate.sh b/pkgs/generate.sh index bb8765a6cf3..8225cd84fce 100755 --- a/pkgs/generate.sh +++ b/pkgs/generate.sh @@ -1,5 +1,5 @@ #!/usr/bin/env nix-shell -#!nix-shell -i bash -p bash +#!nix-shell -i bash -p bash cabal2nix stack cabal-install ghc # regenerate the `pkgs/default.nix` file based on the current contents of cardano-sl.cabal and stack.yaml diff --git a/scripts/check-stack2nix.sh b/scripts/check-stack2nix.sh index 5a4ebb3c14d..84435e7ed52 100755 --- a/scripts/check-stack2nix.sh +++ b/scripts/check-stack2nix.sh @@ -1,4 +1,5 @@ -#!/usr/bin/env bash +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p git bash # check and warn if `pkgs/default.nix` is out of date diff --git a/scripts/ci/nix-shell.sh b/scripts/ci/nix-shell.sh deleted file mode 100755 index 23a2eb5e89d..00000000000 --- a/scripts/ci/nix-shell.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# sh is really bash in this case -# shellcheck disable=SC2039 - -set -x - -case $(uname -s | tr '[:upper:]' '[:lower:]') in - linux ) NIX_PROFILE_BINPATH=/run/current-system/sw/bin/;; - darwin ) NIX_PROFILE_BINPATH=/nix/var/nix/profiles/default/bin;; - * ) echo "Unsupported OS: $OS_NAME" >&2; exit 1;; -esac - -# Bootstrap on OS X/NixOS: - -NIX_BUILD="$(type -P nix-build)" -NIX_BUILD="${NIX_BUILD:-$NIX_PROFILE_BINPATH/nix-build}" -NIX_SHELL="$(type -P nix-shell)" -NIX_SHELL="${NIX_SHELL:-$NIX_PROFILE_BINPATH/nix-shell}" -NIX_BUILD_SHELL="$(type -P bash)" -NIX_BUILD_SHELL="${NIX_BUILD_SHELL:-$NIX_PROFILE_BINPATH/bash}" - -export NIX_REMOTE=daemon -NIX_PATH="nixpkgs=$(${NIX_BUILD} fetch-nixpkgs.nix -o nixpkgs)" -export NIX_PATH -export NIX_BUILD_SHELL - -${NIX_SHELL} -p nix bash coreutils zlib gmp ncurses "$@"