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

xonsh.xontribs.xontrib-*: init at various #354733

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

Conversation

Infinidoge
Copy link
Contributor

Closes #241386

Supersedes the above PR, I've gone ahead and updated and cleaned up all of the packages (including a small fix for xontrib-jupyter, after an upstream Xonsh change.) It has also been rebased on master accordingly.

I am very driven to get this done to let nix-community/home-manager#5494 proceed, as I have wanted to switch to Xonsh for a while now.

CC @greg-hellings as author of the previous PR

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Nov 9, 2024
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Nov 9, 2024
@greg-hellings
Copy link
Contributor

Hopefully you can get some actual traction on this. Having pushed a lot more packages since I initially made this, the feedback that might come could include a request to change all of the separate xontrib packages into individual commits to match the commit message log preference for introducing new packages.

@Infinidoge
Copy link
Contributor Author

Do those commit messages seem better?

@greg-hellings
Copy link
Contributor

Yes, that seems to match the format.

nixos/modules/programs/xonsh.nix Outdated Show resolved Hide resolved
Comment on lines +35 to +66
xontribs = lib.mkOption {
default = [ ];
type = lib.types.listOf lib.types.package;
description = ''
Add the listed xontribs to the package options. Available xontribs are
under xonsh.xontribs.

Take care in using this option along with manually defining the package
option above, as the two can result in conflicting sets of build dependencies.
This option assumes that the package option has an overridable argument
called `extraPackages`, so if you override the package option but also
intend to use this option, be sure that your resulting package still honors
the necessary option.
'';
example = "xontribs = with pkgs.xonsh.xontribs; [ xontrib-vox xontrib-abbrevs ];";
};

extraPackages = lib.mkOption {
default = (ps: [ ]);
type = lib.types.functionTo (lib.types.listOf lib.types.package);
description = ''
Add the specified extra packages to the xonsh package.
Preferred over using `programs.xonsh.package` as it composes with `programs.xonsh.xontribs`.

Take care in using this option along with manually defining the package
option above, as the two can result in conflicting sets of build dependencies.
This option assumes that the package option has an overridable argument
called `extraPackages`, so if you override the package option but also
intend to use this option, be sure that your resulting package still honors
the necessary option.
'';
};
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to separate xontribs from other python packages? I think they can be both in one option.

Copy link
Contributor

Choose a reason for hiding this comment

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

This was addressed in the review of my original PR. Xontribs are intentionally hobbled code and do not need to exclusively be written in Python (they can also be written in Xonsh syntax itself). Rather than using the established methods for Python plugin detection, Xonsh requires that its plugins all drop their entry point into the same folder and leave out the __init__.py file. Xonsh itself provides that init file and then looks for the xontribs in that directory. As such, xontribs are not truly valid Python packages and really shouldn't be handled as such.

Copy link
Member

Choose a reason for hiding this comment

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

This was addressed in the review of my original PR. Xontribs are intentionally hobbled code and do not need to exclusively be written in Python (they can also be written in Xonsh syntax itself). Rather than using the established methods for Python plugin detection, Xonsh requires that its plugins all drop their entry point into the same folder and leave out the __init__.py file. Xonsh itself provides that init file and then looks for the xontribs in that directory. As such, xontribs are not truly valid Python packages and really shouldn't be handled as such.

Xontribs and Python packages are both added to the wrapper's parameter extraPackages now and works fine so far for me, so I don't understand why there are two options to override extraPackages. Do you mean the wrapper needs rework?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants