Skip to content

Instantly share code, notes, and snippets.

@kalbasit
Last active September 25, 2018 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kalbasit/935c49f2799d27c6983f24719f339934 to your computer and use it in GitHub Desktop.
Save kalbasit/935c49f2799d27c6983f24719f339934 to your computer and use it in GitHub Desktop.
let
hostPkgs = import <nixpkgs> {};
# Look here for information about how to generate `nixpkgs-version.json`.
# → https://nixos.wiki/wiki/FAQ/Pinning_Nixpkgs
pinnedVersion = hostPkgs.lib.importJSON ./.nixpkgs-version.json;
pinnedPkgs = import (hostPkgs.fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs";
inherit (pinnedVersion) rev sha256;
}) {};
minikube_0_25_2 = pinnedPkgs.minikube.overrideAttrs (oldAttrs: rec {
version = "0.25.2";
src = pinnedPkgs.fetchFromGitHub {
owner = "kubernetes";
repo = "minikube";
rev = "v${version}";
sha256 = "1h8sxs6xxmli7xkb33kdl4nyn1sgq2b8b2d6aj5wim11ric3l7pb";
};
});
bazel = pinnedPkgs.bazel.overrideAttrs (oa: rec {
patches = oa.patches ++ pinnedPkgs.lib.optional pinnedPkgs.stdenv.isDarwin [
# On Mac, we are getting an error when we invoke Bazel, it seems that it's
# confused as to which C++ compiler to use, and as a consequence we are getting
# the following error:
# gcc: error: unrecognized command line option '-fobjc-link-runtime'; did you mean '-fgnu-runtime'
# To solve this, we ask Bazel to use the same CC toolchain as Linux: See
# http://bit.ly/2LGALi7 for the specific code in Bazel that parses this.
#
# I believe the root cause of this is that we are running Bazel on Mac which
# makes it choose the OSX compiler (hence the -fobjc-link-runtime), but we are
# providing Bazel through Nix which makes GNU C++ compiler the only one
# available for it.
#
# Nixpkgs fixed this in https://github.com/NixOS/nixpkgs/pull/44181, so remove
# this environment variable once we upgrade Bazel to 0.16 or above.
./lib/nix/bazel-disable-osx-toolchain.patch
];
});
in
# This allows overriding nixpkgs by passing `--arg nixpkgs ...`
{ pkgs ? pinnedPkgs, lib ? pkgs.lib }:
with pkgs;
with lib;
gccStdenv.mkDerivation rec {
name = "publica-development-environment";
buildInputs = [
awscli
bazel
delve
dep
go
go-jira
jq
kubectl
kubernetes-helm
minikube_0_25_2
python27Packages.docker_compose
] ++ optional stdenv.isLinux [
python3Full
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment