From 0c7520e80eeb97260b082b3badfa380411724332 Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Thu, 17 Feb 2022 16:15:09 +0400 Subject: [PATCH 1/3] Bump nixpkgs to 21.11 Current nixpkgs doesn't support macOS Big Sur (11). Its support landed in nixpkgs in 21.11, but that also broke support for Catalina (10.15), so switch CI workflow to use "macos-11" runner. Fixes #175 --- .github/workflows/workflow.yaml | 7 +++++-- WORKSPACE | 4 ++-- nixpkgs.json | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index 0ba01fc33..bcb6b5275 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -6,7 +6,9 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-10.15] # TODO: this job does not yet work on more recent macOS (macos-11) + os: + - ubuntu-latest + - macos-11 runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2.4.0 @@ -32,7 +34,8 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest] # TODO: this job does not yet work on any version of macOS + os: + - ubuntu-latest # TODO: this job does not yet work on any version of macOS runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2.4.0 diff --git a/WORKSPACE b/WORKSPACE index 27a2706f7..da8457af3 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -41,8 +41,8 @@ bazel_skylib_workspace() nixpkgs_git_repository( name = "remote_nixpkgs", remote = "https://github.com/NixOS/nixpkgs", - revision = "18.09", - sha256 = "6451af4083485e13daa427f745cbf859bc23cb8b70454c017887c006a13bd65e", + revision = "21.11", + sha256 = "c77bb41cf5dd82f4718fa789d49363f512bb6fa6bc25f8d60902fe2d698ed7cc", ) nixpkgs_local_repository( diff --git a/nixpkgs.json b/nixpkgs.json index 4b6e9203f..72056c155 100644 --- a/nixpkgs.json +++ b/nixpkgs.json @@ -2,6 +2,6 @@ "owner": "NixOS", "repo": "nixpkgs", "branch": "nixpkgs-unstable", - "rev": "ad4db3f4d8ae54482c63c31c14921cb73953548d", - "sha256": "1fwl898f6wznkjpwq11brgadz6iff5w5f4lwj2l7ax2rz7r03mnn" + "rev": "506445d88e183bce80e47fc612c710eb592045ed", + "sha256": "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02" } From d3ecfd70a7e2ada4798fa952664d52e54a66e696 Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Thu, 17 Feb 2022 18:26:00 +0400 Subject: [PATCH 2/3] Add nixpkgs.nix to all examples On CI we set NIX_PATH to "nixpkgs=./nixpkgs.nix", so nix-shell tries to use it from within the example's directory and fails, it tries to use builtin bash. On macOS it is too old, so we should make sure that the one from nixpkgs is used. Related to #176 --- examples/toolchains/cc/nixpkgs.json | 7 +++++++ examples/toolchains/cc/nixpkgs.nix | 9 +++++++++ examples/toolchains/cc/shell.nix | 5 +---- examples/toolchains/cc_with_deps/nixpkgs.json | 7 +++++++ examples/toolchains/cc_with_deps/nixpkgs.nix | 9 +++++++++ examples/toolchains/cc_with_deps/shell.nix | 5 +---- examples/toolchains/go/nixpkgs.json | 7 +++++++ examples/toolchains/go/nixpkgs.nix | 9 +++++++++ examples/toolchains/go/shell.nix | 5 +---- examples/toolchains/python/nixpkgs.json | 7 +++++++ examples/toolchains/python/nixpkgs.nix | 9 +++++++++ examples/toolchains/python/shell.nix | 5 +---- examples/toolchains/rust/nixpkgs.json | 7 +++++++ examples/toolchains/rust/nixpkgs.nix | 9 +++++++++ examples/toolchains/rust/shell.nix | 5 +---- 15 files changed, 85 insertions(+), 20 deletions(-) create mode 100644 examples/toolchains/cc/nixpkgs.json create mode 100644 examples/toolchains/cc/nixpkgs.nix create mode 100644 examples/toolchains/cc_with_deps/nixpkgs.json create mode 100644 examples/toolchains/cc_with_deps/nixpkgs.nix create mode 100644 examples/toolchains/go/nixpkgs.json create mode 100644 examples/toolchains/go/nixpkgs.nix create mode 100644 examples/toolchains/python/nixpkgs.json create mode 100644 examples/toolchains/python/nixpkgs.nix create mode 100644 examples/toolchains/rust/nixpkgs.json create mode 100644 examples/toolchains/rust/nixpkgs.nix diff --git a/examples/toolchains/cc/nixpkgs.json b/examples/toolchains/cc/nixpkgs.json new file mode 100644 index 000000000..a7e06e9e9 --- /dev/null +++ b/examples/toolchains/cc/nixpkgs.json @@ -0,0 +1,7 @@ +{ + "owner": "NixOS", + "repo": "nixpkgs", + "branch": "21.11", + "rev": "506445d88e183bce80e47fc612c710eb592045ed", + "sha256": "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02" +} diff --git a/examples/toolchains/cc/nixpkgs.nix b/examples/toolchains/cc/nixpkgs.nix new file mode 100644 index 000000000..b06b74462 --- /dev/null +++ b/examples/toolchains/cc/nixpkgs.nix @@ -0,0 +1,9 @@ +let + # nixpkgs-unstable as of 2021-02-19 + spec = builtins.fromJSON (builtins.readFile ./nixpkgs.json); + nixpkgs = fetchTarball { + url = "https://github.com/${spec.owner}/${spec.repo}/archive/${spec.rev}.tar.gz"; + sha256 = spec.sha256; + }; +in +import nixpkgs diff --git a/examples/toolchains/cc/shell.nix b/examples/toolchains/cc/shell.nix index 8443bdce4..8f4baf9ce 100644 --- a/examples/toolchains/cc/shell.nix +++ b/examples/toolchains/cc/shell.nix @@ -1,6 +1,3 @@ -{ pkgs ? import (builtins.fetchTarball { - url = "https://github.com/NixOS/nixpkgs/archive/21.11.tar.gz"; - sha256 = "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02"; -}) { } }: +{ pkgs ? import ./nixpkgs.nix { } }: pkgs.mkShell { nativeBuildInputs = [ pkgs.bazel_4 ]; } diff --git a/examples/toolchains/cc_with_deps/nixpkgs.json b/examples/toolchains/cc_with_deps/nixpkgs.json new file mode 100644 index 000000000..a7e06e9e9 --- /dev/null +++ b/examples/toolchains/cc_with_deps/nixpkgs.json @@ -0,0 +1,7 @@ +{ + "owner": "NixOS", + "repo": "nixpkgs", + "branch": "21.11", + "rev": "506445d88e183bce80e47fc612c710eb592045ed", + "sha256": "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02" +} diff --git a/examples/toolchains/cc_with_deps/nixpkgs.nix b/examples/toolchains/cc_with_deps/nixpkgs.nix new file mode 100644 index 000000000..b06b74462 --- /dev/null +++ b/examples/toolchains/cc_with_deps/nixpkgs.nix @@ -0,0 +1,9 @@ +let + # nixpkgs-unstable as of 2021-02-19 + spec = builtins.fromJSON (builtins.readFile ./nixpkgs.json); + nixpkgs = fetchTarball { + url = "https://github.com/${spec.owner}/${spec.repo}/archive/${spec.rev}.tar.gz"; + sha256 = spec.sha256; + }; +in +import nixpkgs diff --git a/examples/toolchains/cc_with_deps/shell.nix b/examples/toolchains/cc_with_deps/shell.nix index 8443bdce4..8f4baf9ce 100644 --- a/examples/toolchains/cc_with_deps/shell.nix +++ b/examples/toolchains/cc_with_deps/shell.nix @@ -1,6 +1,3 @@ -{ pkgs ? import (builtins.fetchTarball { - url = "https://github.com/NixOS/nixpkgs/archive/21.11.tar.gz"; - sha256 = "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02"; -}) { } }: +{ pkgs ? import ./nixpkgs.nix { } }: pkgs.mkShell { nativeBuildInputs = [ pkgs.bazel_4 ]; } diff --git a/examples/toolchains/go/nixpkgs.json b/examples/toolchains/go/nixpkgs.json new file mode 100644 index 000000000..a7e06e9e9 --- /dev/null +++ b/examples/toolchains/go/nixpkgs.json @@ -0,0 +1,7 @@ +{ + "owner": "NixOS", + "repo": "nixpkgs", + "branch": "21.11", + "rev": "506445d88e183bce80e47fc612c710eb592045ed", + "sha256": "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02" +} diff --git a/examples/toolchains/go/nixpkgs.nix b/examples/toolchains/go/nixpkgs.nix new file mode 100644 index 000000000..b06b74462 --- /dev/null +++ b/examples/toolchains/go/nixpkgs.nix @@ -0,0 +1,9 @@ +let + # nixpkgs-unstable as of 2021-02-19 + spec = builtins.fromJSON (builtins.readFile ./nixpkgs.json); + nixpkgs = fetchTarball { + url = "https://github.com/${spec.owner}/${spec.repo}/archive/${spec.rev}.tar.gz"; + sha256 = spec.sha256; + }; +in +import nixpkgs diff --git a/examples/toolchains/go/shell.nix b/examples/toolchains/go/shell.nix index 8443bdce4..8f4baf9ce 100644 --- a/examples/toolchains/go/shell.nix +++ b/examples/toolchains/go/shell.nix @@ -1,6 +1,3 @@ -{ pkgs ? import (builtins.fetchTarball { - url = "https://github.com/NixOS/nixpkgs/archive/21.11.tar.gz"; - sha256 = "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02"; -}) { } }: +{ pkgs ? import ./nixpkgs.nix { } }: pkgs.mkShell { nativeBuildInputs = [ pkgs.bazel_4 ]; } diff --git a/examples/toolchains/python/nixpkgs.json b/examples/toolchains/python/nixpkgs.json new file mode 100644 index 000000000..a7e06e9e9 --- /dev/null +++ b/examples/toolchains/python/nixpkgs.json @@ -0,0 +1,7 @@ +{ + "owner": "NixOS", + "repo": "nixpkgs", + "branch": "21.11", + "rev": "506445d88e183bce80e47fc612c710eb592045ed", + "sha256": "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02" +} diff --git a/examples/toolchains/python/nixpkgs.nix b/examples/toolchains/python/nixpkgs.nix new file mode 100644 index 000000000..b06b74462 --- /dev/null +++ b/examples/toolchains/python/nixpkgs.nix @@ -0,0 +1,9 @@ +let + # nixpkgs-unstable as of 2021-02-19 + spec = builtins.fromJSON (builtins.readFile ./nixpkgs.json); + nixpkgs = fetchTarball { + url = "https://github.com/${spec.owner}/${spec.repo}/archive/${spec.rev}.tar.gz"; + sha256 = spec.sha256; + }; +in +import nixpkgs diff --git a/examples/toolchains/python/shell.nix b/examples/toolchains/python/shell.nix index 8443bdce4..8f4baf9ce 100644 --- a/examples/toolchains/python/shell.nix +++ b/examples/toolchains/python/shell.nix @@ -1,6 +1,3 @@ -{ pkgs ? import (builtins.fetchTarball { - url = "https://github.com/NixOS/nixpkgs/archive/21.11.tar.gz"; - sha256 = "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02"; -}) { } }: +{ pkgs ? import ./nixpkgs.nix { } }: pkgs.mkShell { nativeBuildInputs = [ pkgs.bazel_4 ]; } diff --git a/examples/toolchains/rust/nixpkgs.json b/examples/toolchains/rust/nixpkgs.json new file mode 100644 index 000000000..a7e06e9e9 --- /dev/null +++ b/examples/toolchains/rust/nixpkgs.json @@ -0,0 +1,7 @@ +{ + "owner": "NixOS", + "repo": "nixpkgs", + "branch": "21.11", + "rev": "506445d88e183bce80e47fc612c710eb592045ed", + "sha256": "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02" +} diff --git a/examples/toolchains/rust/nixpkgs.nix b/examples/toolchains/rust/nixpkgs.nix new file mode 100644 index 000000000..b06b74462 --- /dev/null +++ b/examples/toolchains/rust/nixpkgs.nix @@ -0,0 +1,9 @@ +let + # nixpkgs-unstable as of 2021-02-19 + spec = builtins.fromJSON (builtins.readFile ./nixpkgs.json); + nixpkgs = fetchTarball { + url = "https://github.com/${spec.owner}/${spec.repo}/archive/${spec.rev}.tar.gz"; + sha256 = spec.sha256; + }; +in +import nixpkgs diff --git a/examples/toolchains/rust/shell.nix b/examples/toolchains/rust/shell.nix index 8443bdce4..8f4baf9ce 100644 --- a/examples/toolchains/rust/shell.nix +++ b/examples/toolchains/rust/shell.nix @@ -1,6 +1,3 @@ -{ pkgs ? import (builtins.fetchTarball { - url = "https://github.com/NixOS/nixpkgs/archive/21.11.tar.gz"; - sha256 = "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02"; -}) { } }: +{ pkgs ? import ./nixpkgs.nix { } }: pkgs.mkShell { nativeBuildInputs = [ pkgs.bazel_4 ]; } From 5110ff1cb403b3c5d3ebd48a925bdfcd39442d1f Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Thu, 17 Feb 2022 16:46:57 +0400 Subject: [PATCH 3/3] Add macos-11 runner to examples job All examples are already using 21.11 nixpkgs, so that shouldn't prevent them from working on Big Sur. Python example is broken because of #186 and Rust one because of #187, so skip them for now. Fixes #176 --- .github/workflows/workflow.yaml | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index bcb6b5275..15fc47c8a 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -35,7 +35,8 @@ jobs: fail-fast: false matrix: os: - - ubuntu-latest # TODO: this job does not yet work on any version of macOS + - ubuntu-latest + - macos-11 runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2.4.0 @@ -52,8 +53,25 @@ jobs: EOF - name: Build & test run: | + skip() { + echo "Will skip $(head -n1 $2/README.md) ${1%_nix} Nix" + local p="$1[@]" + read -a ${1} <<< $(echo ${!p//$2}) + } + cd examples/toolchains - for dir in *; do + with_nix=( $(ls) ) + without_nix=( cc go rust ) + + if [ "${{ runner.os }}" == "macOS" ]; then + # Python - https://github.com/tweag/rules_nixpkgs/issues/186 + skip with_nix python + # Rust - https://github.com/tweag/rules_nixpkgs/issues/187 + skip with_nix rust + skip without_nix rust + fi + + for dir in "${with_nix[@]}"; do cd "$dir" echo echo Running $(head -n1 README.md) with Nix @@ -61,7 +79,7 @@ jobs: # TODO: all toolchains should run without Nixpkgs cd .. done - for dir in cc go rust; do + for dir in "${without_nix[@]}"; do cd "$dir" echo echo Running $(head -n1 README.md) without Nix