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

adding new package: pyre-check (untested) #40809

Closed
wants to merge 1 commit into from

Conversation

bbarker
Copy link
Contributor

@bbarker bbarker commented May 20, 2018

Motivation for this change

Adding pyre-check; a static analysis package for python 3.5+.

Things done

I haven't tested so far due to #40782 blocking me from testing my local nixpkgs repo.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@bhipple
Copy link
Contributor

bhipple commented May 20, 2018

@GrahamcOfBorg build pyre-check

@GrahamcOfBorg
Copy link

No attempt on aarch64-linux (full log)

The following builds were skipped because they don't evaluate on aarch64-linux: pyre-check

Partial log (click to expand)

Cannot nix-instantiate `pyre-check' because:
�[31;1merror:�[0m attribute 'pyre-check' in selection path 'pyre-check' not found

@GrahamcOfBorg
Copy link

No attempt on x86_64-linux (full log)

The following builds were skipped because they don't evaluate on x86_64-linux: pyre-check

Partial log (click to expand)

Cannot nix-instantiate `pyre-check' because:
error: attribute 'pyre-check' in selection path 'pyre-check' not found

@bhipple
Copy link
Contributor

bhipple commented May 20, 2018

You'll have to add a callPackage invocation to this in pkgs/top-level/all-packages.nix. Then you should be able to build it by cd'ing to the src tree and running:

[~/src/nixpkgs] $ nix-build -A pyre-check

buildPhase = ''
./scripts/setup.sh --local
make
'';
Copy link
Contributor

Choose a reason for hiding this comment

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

Generally, we prefer to let the default buildPhase do its thing, since it will handle various debugging/parallelization flags, etc. When we want it to do something non-standard, we do something like this:

preBuild = ''
  ./scripts/setup.sh --local  
'';

(the default buildPhase will call make for you). Though in this case it's probably more appropriate to put this as a preConfigure hook instead.

homepage = https://pyre-check.org/;
description = "A performant type-checker for Python 3";
license = stdenv.lib.licenses.mit;
platforms = with stdenv.lib.platforms; unix;
Copy link
Contributor

Choose a reason for hiding this comment

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

Generally, when adding a new package, it's expected that you'll volunteer to maintain it by adding yourself to this file:
https://github.com/NixOS/nixpkgs/blob/master/maintainers/maintainer-list.nix

and adding a maintainers = with stdenv.lib.maintainers; [ bbarker ];

@bhipple
Copy link
Contributor

bhipple commented May 20, 2018

Can you format the commit message according to CONTRIBUTING.md? Namely, pyre-check: init at 0.0.6. There are quite a few bots and tools that parse these messages and respond accordingly, plus NixPKgs gets hundreds of PRs so it's useful to stay consistent.

@teh
Copy link
Contributor

teh commented Jul 1, 2018

Thanks for your PR!

Unfortunately this PR won't work in this form. I started packaging pyre and it needs ppxlib which in turn requires updating the jane-street ocaml libraries in nixpkgs to 0.11.

Once the ocaml updates are in something like the following would do the job (still has too many dependencies):

{ stdenv, fetchFromGitHub, ocamlPackages, makeWrapper, writeScript }:
let
vsc = writeScript "vv" ''
# Add version information to the file.
cat > "./version.ml" <<EOF
let build_info () =
  "nixpkgs-master"
let version () =
  "nixpkgs-master"
EOF
'';
in stdenv.mkDerivation rec {
  name = "pyre-${version}";
  version = "master";

  src = fetchFromGitHub {
    owner = "facebook";
    repo = "pyre-check";
    rev = "master";
    sha256 = "1a0ylg076n4kybi3ra1cbnrm6vg1k1zs29g9hmyfygzf0blqfrcp";
  };

  nativeBuildInputs = [ makeWrapper ];

  buildInputs = with ocamlPackages; [
    ocaml findlib batteries menhir stdint
    zarith camlp4 yojson pprint core sedlex  ppx_jane ppx_sexp_conv ppx_tools ppx_let ppx_core ppx_driver
    ulex ocaml-migrate-parsetree process ppx_deriving ppx_deriving_yojson ocamlbuild
  ];

  buildPhase = ''
    sed "s/%VERSION%/0.7.0/" Makefile.template > Makefile
    export HOME=.
    mkdir $out
    # the shipped generate-version-number needs git and hg.
    cp ${vsc} ./scripts/generate-version-number.sh
    export OCAMLFIND_DESTDIR=$out
    make release
  '';

  makeFlags = [ "PREFIX=$(out)" ];
}

@teh
Copy link
Contributor

teh commented Jul 1, 2018

See #42738 for ppxlib packaging

@teh teh mentioned this pull request Jul 8, 2018
9 tasks
@xeji
Copy link
Contributor

xeji commented Jul 10, 2018

Thank you for contributing!
I am closing this in favor of #43212 , which fixes the issues mentioned above.

@xeji xeji closed this Jul 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants