Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nix shell derivation #1641

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Nix shell derivation #1641

wants to merge 4 commits into from

Conversation

michalrus
Copy link
Contributor

@michalrus michalrus commented Apr 28, 2017

make prepare asks me for my root password, which is pretty insane.

Here’s a PR with @kjanosz’s default.nix that set ups the environment, there was a branch but no PR.

I pinned it to Nixpkgs 16.09 for greater reproducibility.

Example usage:

  # in your normal shell:

% nix-shell -A main

  # drops you to a new Bash shell with all the deps of the `main' attr (defined below)

$ make up


green-river = stdenv.mkDerivation {
name = "green-river";
buildInputs = [ openjdk sbt ];
Copy link
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

Copy link
Contributor Author

@michalrus michalrus May 3, 2017

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
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
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
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
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...

default.nix Outdated
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 ++ dnsimple.propagatedBuildInputs);
profile = ''
source .env.local;
export PYTHONPATH="/usr/lib/python2.7/site-packages"
Copy link
Contributor Author

@michalrus michalrus May 3, 2017

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).

@michalrus michalrus force-pushed the nix-shell-derivation branch from 75cdac1 to 8eda142 Compare June 16, 2017 09:57
default.nix Outdated
@@ -21,7 +21,7 @@ in with import nixpkgs {}; {
};
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 ++ dnsimple.propagatedBuildInputs);
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
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.

Copy link
Contributor

@kjanosz kjanosz Jun 16, 2017

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.

Copy link
Contributor Author

@michalrus michalrus Jun 16, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants