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

electrum: excluded plugins into arguments #30387

Closed
wants to merge 3 commits into from

Conversation

oxzi
Copy link
Member

@oxzi oxzi commented Oct 13, 2017

Motivation for this change

This PR is a proposal to exclude the plugins from the electrum-package into an argument-list. It is based on #30347.

This plugins-list will be called with the current plugins for compatibility reasons. The additional withPlugins argument defaults to true, but can be overridden to demonstrate that electrum should be built without plugins.
I'm not quite sure if this changes are the most elegant ones.

Things done
  • 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.

@joachifm
Copy link
Contributor

I think it'd be more convenient to pass the plugins as names instead, which would then add whatever packages are necessary. Otherwise, the user needs to know which python package set to use, which packages to add and so on.

Also, I think it's cleaner to rely on the list itself to carry information about whether to enable plugins than to use a separate parameter.

@joachifm
Copy link
Contributor

Then again, discoverability is so poor that it almost makes no difference ...

@oxzi
Copy link
Member Author

oxzi commented Oct 21, 2017

@joachifm Thanks for your thoughts.
I'm also not sure what an elegant way would be or if there should just be one package with all plugins. However, imho it would be nice to limit the amount of unnecessary (and perhaps fishy) plugins to a minimum.

@joachifm
Copy link
Contributor

One possibility is

packageOverrides = super: {
  electrum = super.electrum.override { plugins = [ "foo" "bar" ]; };
}

and in the package expression do

{ plugins ? [ ], ... }:
let
  pluginPackages = { "foo" = [ package1 package2 ]; ... };
  # ...
in
# ...
buildPythonApplication rec {
   # ...
   buildInputs = [ /* ... */ ] ++ concatMap (x: getAttr x pluginPackages) plugins;
   # ...
}

But I think it's simpler to just provide a default batteries included variant and a minimal variant, where the former is derived from the latter by passing additional build inputs via override.

@FRidh
Copy link
Member

FRidh commented Oct 28, 2017

Are plugins always Python packages? And does a plugin require/constitute an individual package (with dependencies) or multiple independent packages?

You have to make sure Python plugins/packages are build using the same interpreter as the rest of the package. You could solve this with using a lambda:

{ ...
, python
, plugins = (ps: with ps; [ keepkey trezor ])
}

let
  p = plugins python.pkgs;
in {
...
... + p;
}

At the same, there should ideally be the possibility to use plugins that are not yet part of python.pkgs. But that can be done by overriding the Python package set.

Finally, don't over-engineer this :)

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

4 participants