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

Nix shell: passing inNixShell #989

Closed
RaitoBezarius opened this issue Oct 16, 2021 · 4 comments
Closed

Nix shell: passing inNixShell #989

RaitoBezarius opened this issue Oct 16, 2021 · 4 comments

Comments

@RaitoBezarius
Copy link

RaitoBezarius commented Oct 16, 2021

I tried the instructions to get started and encountered:

hnix on  master 
❯ nix-shell          
error: anonymous function at /home/raito/dev/projects/hnix/default.nix:1:1 called with unexpected argument 'inNixShell'

       at /home/raito/dev/projects/hnix/shell.nix:7:5:

            6| };
            7| in (import ./. (defaultAttrs // attrs)).env
             |     ^

I believe this is related to the fact that attrs contains inNixShell and default.nix head function do not have any ... to take as many arguments as necessary?

Can push the fix, if that's indeed an issue.

@Anton-Latukha
Copy link
Collaborator

Anton-Latukha commented Oct 18, 2021

Good day to you.

A note to be obvious: nix-shell is the execution of the upstream nix & it loads default.nix configuration. CI tests it on default settings at every PR & runs everyday master branch check.

I just now checked additionally in Nix v. 2.3.0 & latest one - 2.3.15 & they nix-shell the configuration fine.

Upstream Nix ... lets say it has some hardcode & side effects, and it very well may be it on your setup. Because of the team & merging difficulties in the Nix to fix such things, that directly drove me here to maintain HNix.

It may be something particularly special with your way of Nix configuration, locale/Nix version/way of nix configuration, as we both know Nix configuration is a quite complex beast.

If you would find the particular case - our team is open to merge patches & you always can reformulate/update the current report, add environment information, or open new reports whenever you would see fit.

If you know Haskell, I am open and happy to merge fixes to the code, code style in HNix is a bit special one, & the project has an exceptionally clean & concise codebase, & I myself accept any code styles.

There is a lot of ways to configure Nix loadout, so it is hard to guess the configuration you getting this exception under. If something - you also free to update default.nix configuration and send the patch, if it would be an addition/improvement to the general case & internationalization - would be happy to merge an improvement.

@Anton-Latukha
Copy link
Collaborator

Anton-Latukha commented Nov 2, 2021

Well, having no information provided - does not help.

It is upstream shenanigans:

NixOS/nix#4003

Inheritance was designed pretty horribly in Nix:

#762 - I specifically created this thread because Nix inheritance is a mess & hoped we would figure-out how to import what we want/need through it.

As we see from 4003 - Nixpkgs was using a Nix bug to overcome this.

I use Nix for 5 years & work on HNix & still do not understand all cases & details of the inheritance syntax. The main language design error there was - { <args> } - loads args normally, but passing args through elipsis (...), { ... } - suddenly adds set name prefix to them, so set imports args differently both with prefix & without and dealing with that is laid on the user.

Additionally - the interfaces (settings) can not be propagated from shell.nix into default.nix, because Nix loads default.nix before shell.nix, and then shell.nix actually needs to override the default.nix settings.

Imagine if .cabal config settings of upstream were required to be duplicated by downstream explicitly & HNix would be required to maintain the duplicates & their path through of all settings of all of the dependencies into dependencies. This is how interfaces are required to be passed in Nix.

@RaitoBezarius
Copy link
Author

@Anton-Latukha sorry for my late answer, I really appreciate you went ahead and detailled everything. My understanding was we only needed to provide for inNixShell in the list of arguments. As you know, Nix 2.4 was released, and I think it bundle this change.

You may be interested in this long post: https://discourse.nixos.org/t/nix-2-4-and-what-s-next/ ; I see this is fixed upstream in #1015, so this can be closed, thank you !

@Anton-Latukha
Copy link
Collaborator

Thank you also.

nix --version would helped. It in fact was 2.3.14 -> 2.3.15 minor release that broke its own code, this change still seems not documented.

Would ask within other reporting to collaborate with maintainers.

rli9 pushed a commit to intel/lkp-tests that referenced this issue Jan 10, 2022
…of known issue

build-clash-1.0.2 packs nix-2.5.1 now. When install build-clashwhich,
we met following known issue:
-----------------------
error: anonymous function at /var/lib/phoronix-test-suite/installed-tests/pts/build-clash-1.0.2/benchmark-compilation/default.nix:24:1 called with unexpected argument 'inNixShell'

       at /var/lib/phoronix-test-suite/installed-tests/pts/build-clash-1.0.2/benchmark-compilation/shell.nix:2:2:

            1| {...}@Args:
            2| (import ./. args).shell
             |  ^
-----------------------

Link: haskell-nix/hnix#989
Signed-off-by: Ma Xinjian <xinjianx.ma@intel.com>
Signed-off-by: Philip Li <philip.li@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants