Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
let

nixpkgs = (import <nixpkgs> {}).pkgs.fetchFromGitHub {
owner = "NixOS"; repo = "nixpkgs";
rev = "0011f9065a1ad1da4db67bec8d535d91b0a78fba"; # nixos-unstable
sha256 = "0m662mibyxqmp83zdhsi084p2h90268h3i8bfk3b2q8pbjz89yx2";
};

in with import nixpkgs {}; {
main = let
dnsimple = python27Packages.buildPythonPackage rec {
name = "dnsimple-${version}";
version = "0.3.6";

src = pkgs.fetchurl {
url = "mirror://pypi/d/dnsimple/${name}.tar.gz";
sha256 = "0cc7v6wn246n3gjpzy8aq8v3xbrxl9a423b84i2z2cjjbq8b7fvf";
};

propagatedBuildInputs = [ python27Packages.requests ];
};
in (buildFHSUserEnv {
name = "main";
targetPkgs = pkgs: (with pkgs; [ ansible2 curl dnsimple docker gnumake git google-cloud-sdk openssh python27Full python27Packages.libcloud python27Packages.pycrypto python27Packages.requests rsync ] ++ python27Packages.libcloud.propagatedBuildInputs ++ python27Packages.pycrypto.propagatedBuildInputs ++ dnsimple.propagatedBuildInputs);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kjanosz, IMO, there’s something wrong with this FHS creation, if you need to supply the deps twice.

@kjanosz kjanosz Jun 16, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYM? Where are they supplied first time?

EDIT:
ah, you've meant propagatedBuildInputs?
Yeah, was surprised, but couldn't get it working without it.

@michalrus michalrus Jun 16, 2017

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!

Both for pycrypto and libcloud.

profile = ''
source .env.local;
export PYTHONPATH="/usr/lib/python2.7/site-packages"

@michalrus michalrus May 3, 2017

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s a fake/virtual path, NixOS doesn’t have /usr, but buildFHSUserEnv fakes that in nix-shell -A main for broken programs (in this case: Ansible).

'';
}).env;

api-docs = stdenv.mkDerivation {
name = "api-docs";
buildInputs = [ gcc pkgconfig nodejs-6_x ];
shellHook = ''
source .env.local
cd api-docs
'';
};

ashes = let
flow25 = stdenv.lib.overrideDerivation flow (oldAttrs : rec {
name = "flow-${version}";
version = "0.25.0";

src = fetchFromGitHub {
owner = "facebook";
repo = "flow";
rev = "v${version}";
sha256 = "1v82phl1cb10p0ggjq9w6a0bcysjxwgmlqsp9263n3j52dl74yi8";
};
});
in stdenv.mkDerivation {
name = "ashes";
buildInputs = [ gcc pkgconfig fontconfig cairo libpng pixman nodejs-6_x flow25 ];
shellHook = ''
source .env.local
cd ashes
ln -sf `readlink -f $(which flow)` node_modules/flow-bin/vendor/flow
'';
};

green-river = stdenv.mkDerivation {
name = "green-river";
buildInputs = [ openjdk sbt ];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why openjdk, we use oracle one

@michalrus michalrus May 3, 2017

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On production machines? From the very beginning we’ve been using OpenJDK on our developer machines, so it probably doesn’t matter as much, and it allows devs’ machines to stay in the non-proprietary land, for ones that care. :)

But it would be pretty easy to change. To use Oracle’s JVM, you’d have to change with import nixpkgs {} in L9 to with import nixpkgs { allowUnfree = true; } or similar.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I meant on production and CI. I prefer to have same version on local just because the difference can introduce weird behaviors. Anyway, it's up to you, I just wanted to point at the difference in config

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mhm! OpenJDK and Oracle are almost the same, but @kjanosz would know more about that.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Axblade we don't use any JDK at all, even seeders run via docker containers

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kpashka mesos/marathon are using oracle jdk as a runtime.
Also it's interesting that we use openjdk containers... So I was not actually right declaring that we use oracle one for phoenix/greenriver.
But it is inconsistent...

shellHook = ''
source .env.local
cd green-river
'';
};

middlewarehouse = stdenv.mkDerivation {
name = "middlewarehouse";
buildInputs = [ go glide ];
shellHook = ''
source .env.local
cd middlewarehouse
'';
};

phoenix = stdenv.mkDerivation {
name = "phoenix";
buildInputs = [ openjdk sbt ];
shellHook = ''
source .env.local
cd phoenix-scala
'';
};
}