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

mercurial: add withPackages #81100

Closed
wants to merge 2 commits into from
Closed

Conversation

xavierzwirtz
Copy link
Contributor

@xavierzwirtz xavierzwirtz commented Feb 26, 2020

Motivation for this change

Mercurial ships features in external packages, expecting the end user to install those packages and enable them in their config. This PR adds a withPackages function that builds a derivation including mercurial and the supplied packages.

Mercurial Evolve enables safe mutable history for mercurial.

Things done

hg-evolve: init at 9.2.2
mercurial: add withPackages

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • 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 nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@danbst
Copy link
Contributor

danbst commented Feb 26, 2020

is it really required to put evolve into buildInputs? Can't we just use hg --config extensions.evolve= evolve inside virtual env or nix-shell?

@xavierzwirtz
Copy link
Contributor Author

Could you give me an example of doing it that way? Adding it to propagatedBuildInputs is how the hg-git extension was implemented before it was removed.

@danbst
Copy link
Contributor

danbst commented Feb 26, 2020

@xavierzwirtz yeah, I understand. It is definitely easier to use when it is bundled.

nix-build -E '
  with import ./. {}; 
  runCommand "${mercurial.name}+ext" { 
    buildInputs = [ xorg.lndir makeWrapper ]; 
  } "
  mkdir $out
  lndir ${mercurial} $out
  wrapProgram $out/bin/hg --prefix PYTHONPATH : ${pythonPackages.hg-evolve}/${python.sitePackages}
  "
'
$ ./result/bin/hg --config extensions.evolve= --help | grep evolve
 evolve        solve troubled changesets in your repository
 evolve        extends Mercurial feature related to Changeset Evolution

Maybe a function like mercurial.withPackages (similar to python.withPackages) would make a generic way to add any new extension packages.

@xavierzwirtz xavierzwirtz changed the title mercurial: add hg-evolve mercurial: add withPackages Feb 27, 2020
@xavierzwirtz
Copy link
Contributor Author

@danbst how's it look now? I used your code sample to implement withPackages.

@xavierzwirtz
Copy link
Contributor Author

Superseded by #81158 and #81157.

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

2 participants