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 extraPacakges doesn't work #326339

Closed
charmoniumQ opened this issue Jul 11, 2024 · 2 comments · Fixed by #325813
Closed

Xonsh extraPacakges doesn't work #326339

charmoniumQ opened this issue Jul 11, 2024 · 2 comments · Fixed by #325813
Labels
0.kind: question Requests for a specific question to be answered

Comments

@charmoniumQ
Copy link
Contributor

charmoniumQ commented Jul 11, 2024

Describe the bug

The wrapper introduced in #240246 is supposed to accept code like: xonsh.override { extraPackages = ps: [ ps.psutil ] }, and then psutil should be importable in the resulting Xonsh package. However, when building this package, I am met with:


error: function 'anonymous lambda' called with unexpected argument 'extraPackages'
at /nix/store/nm7g9fgcffl6nar6vpib220b51dyv0fl-source/pkgs/by-name/xo/xonsh/package.nix:1:1:

error:
       … while calling a functor (an attribute set with a '__functor' attribute)
         at /nix/store/81ai25ifhr0l8rryf83h4pj8k0q2pjaj-source/flake.nix:4:37:
            3|   outputs = { self, nixpkgs }: {
            4|     packages.x86_64-linux.default = nixpkgs.legacyPackages.x86_64-linux.xonsh.override {
             |                                     ^
            5|       extraPackages = ps: [ ps.psutil ];
   … from call site
     at /nix/store/nm7g9fgcffl6nar6vpib220b51dyv0fl-source/lib/trivial.nix:955:7:
      954|     { # TODO: Should we add call-time "type" checking like built in?
      955|       __functor = self: f;
         |       ^
      956|       __functionArgs = args;

   … while calling anonymous lambda
     at /nix/store/nm7g9fgcffl6nar6vpib220b51dyv0fl-source/lib/customisation.nix:144:34:
      143|       # Re-call the function but with different arguments
      144|       overrideArgs = mirrorArgs (newArgs: makeOverridable f (overrideWith newArgs));
         |                                  ^
      145|       # Change the result of the function call by applying g to it

   … while calling a functor (an attribute set with a '__functor' attribute)
     at /nix/store/nm7g9fgcffl6nar6vpib220b51dyv0fl-source/lib/customisation.nix:144:43:
      143|       # Re-call the function but with different arguments
      144|       overrideArgs = mirrorArgs (newArgs: makeOverridable f (overrideWith newArgs));
         |                                           ^
      145|       # Change the result of the function call by applying g to it

   … from call site
     at /nix/store/nm7g9fgcffl6nar6vpib220b51dyv0fl-source/lib/trivial.nix:955:7:
      954|     { # TODO: Should we add call-time "type" checking like built in?
      955|       __functor = self: f;
         |       ^
      956|       __functionArgs = args;

   … while calling anonymous lambda
     at /nix/store/nm7g9fgcffl6nar6vpib220b51dyv0fl-source/lib/customisation.nix:136:17:
      135|     in
      136|     mirrorArgs (origArgs:
         |                 ^
      137|     let

   … while evaluating a branch condition
     at /nix/store/nm7g9fgcffl6nar6vpib220b51dyv0fl-source/lib/customisation.nix:148:7:
      147|     in
      148|       if isAttrs result then
         |       ^
      149|         result // {

   … while calling the 'isAttrs' builtin
     at /nix/store/nm7g9fgcffl6nar6vpib220b51dyv0fl-source/lib/customisation.nix:148:10:
      147|     in
      148|       if isAttrs result then
         |          ^
      149|         result // {

   … from call site
     at /nix/store/nm7g9fgcffl6nar6vpib220b51dyv0fl-source/lib/customisation.nix:138:16:
      137|     let
      138|       result = f origArgs;
         |                ^
      139|

   error: function 'anonymous lambda' called with unexpected argument 'extraPackages'
   at /nix/store/nm7g9fgcffl6nar6vpib220b51dyv0fl-source/pkgs/by-name/xo/xonsh/package.nix:1:1:
        1| {
         | ^
        2|   lib,

Is there a different way of getting to the wrapped Xonsh?

Steps To Reproduce

To reproduce:

$ cat <<EOF > flake.lockb
{
  "nodes": {
    "nixpkgs": {
      "locked": {
        "lastModified": 1720712503,
        "narHash": "sha256-1u2FWxVZfuoMe8mfRvXBuZq6+DrEqeBT8A4uFOV+my8=",
        "owner": "nixos",
        "repo": "nixpkgs",
        "rev": "69214562aeca0d6b28f8a233748bbd6f32a52a3f",
        "type": "github"
      },
      "original": {
        "owner": "nixos",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "root": {
      "inputs": {
        "nixpkgs": "nixpkgs"
      }
    }
  },
  "root": "root",
  "version": 7
}
EOF

$ cat <<EOF > flake.nix
{
  inputs.nixpkgs.url = "github:nixos/nixpkgs/";
  outputs = { self, nixpkgs }: {
    packages.x86_64-linux.default = self.packages.x86_64-linux.xonsh.override {
      extraPackages = ps: [ ps.psutil ];
    };
  };
}
EOF

$ nix build

Expected behavior

Xonsh should build.

Additional context

Possibly relevant issues:

Notify maintainers

@samlukeyes123

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.37, NixOS, 24.11 (Vicuna), 24.11.20240709.feb2849`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.24.0pre20240627_b44909ac`
 - nixpkgs: `/home/sam/.nix-defexpr/channels/nixpkgs`

Add a 👍 reaction to issues you find important.

@charmoniumQ charmoniumQ added the 0.kind: bug Something is broken label Jul 11, 2024
@eclairevoyant
Copy link
Contributor

use xonsh.wrapper instead of xonsh

This is documented in the option search: https://search.nixos.org/options?channel=unstable&show=programs.xonsh.package&from=0&size=50&sort=relevance&type=packages&query=xonsh

@eclairevoyant eclairevoyant added 0.kind: question Requests for a specific question to be answered and removed 0.kind: bug Something is broken labels Jul 11, 2024
@SamLukeYes
Copy link
Member

SamLukeYes commented Jul 18, 2024

This behavior was changed in #314728, which includes a refactor, and the top-level xonsh package is not the wrapper now. I'm restoring the original behavior in #325813.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: question Requests for a specific question to be answered
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants