From d953a4ee09c221bbd956a1d0b96ec5602791bfb6 Mon Sep 17 00:00:00 2001 From: zimbatm Date: Tue, 25 Aug 2020 18:13:35 +0200 Subject: [PATCH] add failing test --- .github/workflows/test.yml | 18 ++++++++++++++++++ lib/install-nix.sh | 3 ++- test.nix | 7 +++++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7d18154..bb0898f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -52,3 +52,21 @@ jobs: nix_path: nixpkgs=channel:nixos-20.03 - run: test $NIX_PATH == "nixpkgs=channel:nixos-20.03" - run: nix-build test.nix + + extra-nix-config: + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - run: yarn install --frozen-lockfile + - run: yarn build + - name: Install Nix + uses: ./ + with: + extra_nix_config: | + hello = world + # sandbox = relaxed + - run: cat /etc/nix/nix.conf + - run: nix-build test.nix --arg noChroot true diff --git a/lib/install-nix.sh b/lib/install-nix.sh index 1cc2175..1f55958 100755 --- a/lib/install-nix.sh +++ b/lib/install-nix.sh @@ -5,8 +5,9 @@ set -euo pipefail sudo sh -c 'echo max-jobs = auto >> /tmp/nix.conf' # Allow binary caches for runner user sudo sh -c 'echo trusted-users = root runner >> /tmp/nix.conf' +# Append extra nix configuration if provided if [[ -n $INPUT_EXTRA_NIX_CONFIG ]]; then - echo "$INPUT_EXTRA_NIX_CONFIG" >> /tmp/nix.conf + echo "$INPUT_EXTRA_NIX_CONFIG" | sudo tee -a /tmp/nix.conf >/dev/null fi install_options=( diff --git a/test.nix b/test.nix index f95abdf..4f6ba38 100644 --- a/test.nix +++ b/test.nix @@ -2,14 +2,17 @@ { size ? 1 # MB , num ? 10 # count , currentTime ? builtins.currentTime +, noChroot ? false }: with import {}; let - drv = i: runCommand "${toString currentTime}-${toString i}" {} '' + drv = i: runCommand "${toString currentTime}-${toString i}" { + __noChroot = noChroot; + } '' dd if=/dev/zero of=$out bs=${toString size}MB count=1 ''; in writeText "empty-${toString num}-${toString size}MB" '' ${lib.concatMapStringsSep "" drv (lib.range 1 num)} -'' \ No newline at end of file +''