Skip to content

Commit

Permalink
Add nixpkgs.nix to all examples
Browse files Browse the repository at this point in the history
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 tweag#176
  • Loading branch information
YorikSar authored and ryanbujnowicz committed Mar 5, 2022
1 parent abac5fa commit ab67caa
Show file tree
Hide file tree
Showing 15 changed files with 85 additions and 20 deletions.
7 changes: 7 additions & 0 deletions examples/toolchains/cc/nixpkgs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"owner": "NixOS",
"repo": "nixpkgs",
"branch": "21.11",
"rev": "506445d88e183bce80e47fc612c710eb592045ed",
"sha256": "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02"
}
9 changes: 9 additions & 0 deletions examples/toolchains/cc/nixpkgs.nix
Original file line number Diff line number Diff line change
@@ -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
5 changes: 1 addition & 4 deletions examples/toolchains/cc/shell.nix
Original file line number Diff line number Diff line change
@@ -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 ]; }
7 changes: 7 additions & 0 deletions examples/toolchains/cc_with_deps/nixpkgs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"owner": "NixOS",
"repo": "nixpkgs",
"branch": "21.11",
"rev": "506445d88e183bce80e47fc612c710eb592045ed",
"sha256": "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02"
}
9 changes: 9 additions & 0 deletions examples/toolchains/cc_with_deps/nixpkgs.nix
Original file line number Diff line number Diff line change
@@ -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
5 changes: 1 addition & 4 deletions examples/toolchains/cc_with_deps/shell.nix
Original file line number Diff line number Diff line change
@@ -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 ]; }
7 changes: 7 additions & 0 deletions examples/toolchains/go/nixpkgs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"owner": "NixOS",
"repo": "nixpkgs",
"branch": "21.11",
"rev": "506445d88e183bce80e47fc612c710eb592045ed",
"sha256": "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02"
}
9 changes: 9 additions & 0 deletions examples/toolchains/go/nixpkgs.nix
Original file line number Diff line number Diff line change
@@ -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
5 changes: 1 addition & 4 deletions examples/toolchains/go/shell.nix
Original file line number Diff line number Diff line change
@@ -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 ]; }
7 changes: 7 additions & 0 deletions examples/toolchains/python/nixpkgs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"owner": "NixOS",
"repo": "nixpkgs",
"branch": "21.11",
"rev": "506445d88e183bce80e47fc612c710eb592045ed",
"sha256": "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02"
}
9 changes: 9 additions & 0 deletions examples/toolchains/python/nixpkgs.nix
Original file line number Diff line number Diff line change
@@ -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
5 changes: 1 addition & 4 deletions examples/toolchains/python/shell.nix
Original file line number Diff line number Diff line change
@@ -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 ]; }
7 changes: 7 additions & 0 deletions examples/toolchains/rust/nixpkgs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"owner": "NixOS",
"repo": "nixpkgs",
"branch": "21.11",
"rev": "506445d88e183bce80e47fc612c710eb592045ed",
"sha256": "162dywda2dvfj1248afxc45kcrg83appjd0nmdb541hl7rnncf02"
}
9 changes: 9 additions & 0 deletions examples/toolchains/rust/nixpkgs.nix
Original file line number Diff line number Diff line change
@@ -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
5 changes: 1 addition & 4 deletions examples/toolchains/rust/shell.nix
Original file line number Diff line number Diff line change
@@ -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 ]; }

0 comments on commit ab67caa

Please sign in to comment.