Skip to content

writers: use callPackages to import sub-groups of writers#245785

Merged
zimbatm merged 2 commits intoNixOS:masterfrom
lopsided98:writers-callpackages
Jul 28, 2023
Merged

writers: use callPackages to import sub-groups of writers#245785
zimbatm merged 2 commits intoNixOS:masterfrom
lopsided98:writers-callpackages

Conversation

@lopsided98
Copy link
Copy Markdown
Contributor

Description of changes

Use callPackages instead of plain import to get proper splicing. Without this, writeNginxConfig fails when cross-compiling:

/nix/store/rgb5qi33s9gkp764067c5czsshvd70sn-gixy-0.1.20-armv6l-unknown-linux-gnueabihf/bin/.gixy-wrapped: /nix/store/rgb5qi33s9gkp764067c5czsshvd70sn-gixy-0.1.20-armv6l-unknown-linux-gnueabihf/bin/gixy: line 3: syntax error near unexpected token `lambda'
/nix/store/rgb5qi33s9gkp764067c5czsshvd70sn-gixy-0.1.20-armv6l-unknown-linux-gnueabihf/bin/.gixy-wrapped: /nix/store/rgb5qi33s9gkp764067c5czsshvd70sn-gixy-0.1.20-armv6l-unknown-linux-gnueabihf/bin/gixy: line 3: `import sys;import site;import functools;sys.argv[0] = '/nix/store/rgb5qi33s9gkp764067c5czsshvd70sn-gixy-0.1.20-armv6l-unknown-linux-gnueabihf/bin/gixy';functools.reduce(lambda k, p: site.addsitedir(p, k), ['/nix/store/rgb5qi33s9gkp764067c5czsshvd70sn-gixy-0.1.20-armv6l-unknown-linux-gnueabihf/lib/python3.10/site-packages','/nix/store/9wj8r2wkg9k498kbrmq5idd1ank76qlj-python3.10-cached-property-1.5.2-armv6l-unknown-linux-gnueabihf/lib/python3.10/site-packages','/nix/store/7zwq6d471517idl7pbx5dyk7jkj8gvhv-python3.10-configargparse-1.5.5-armv6l-unknown-linux-gnueabihf/lib/python3.10/site-packages','/nix/store/yh5vr25fbp2dyxl4nmlch6ls2n9ipgqp-python3.10-pyparsing-2.4.7-armv6l-unknown-linux-gnueabihf/lib/python3.10/site-packages','/nix/store/yd7jyxbb7hgfrvllzlwmg6l3sg008dsj-python3.10-Jinja2-3.1.2-armv6l-unknown-linux-gnueabihf/lib/python3.10/site-packages','/nix/store/hhfxy9c941696sfaamg8njbiqdz4i4y0-python3.10-babel-2.12.1-armv6l-unknown-linux-gnueabihf/lib/python3.10/site-packages','/nix/store/2sgrxhwc97gjs25gqs38mxkqjpr36mz6-python3.10-markupsafe-2.1.3-armv6l-unknown-linux-gnueabihf/lib/python3.10/site-packages','/nix/store/rr9gh0yhm2v9sdq929jlcr2k9dxqiaqa-python3.10-nose-1.3.7-armv6l-unknown-linux-gnueabihf/lib/python3.10/site-packages','/nix/store/az94m56lzk4p4va6y40yhfqf4mh1rb3j-python3.10-coverage-7.2.1-armv6l-unknown-linux-gnueabihf/lib/python3.10/site-packages','/nix/store/k49gqafjic5wbx7djlr15smjr0z4bysf-python3.10-setuptools-67.4.0-armv6l-unknown-linux-gnueabihf/lib/python3.10/site-packages','/nix/store/20w5xp1miy5hlrl7f5pj8350561jpyw0-python3.10-six-1.16.0-armv6l-unknown-linux-gnueabihf/lib/python3.10/site-packages'], site._init_pathinfo());'

This fixes #244835, which split the writers into multiple files.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
    • armv6l-linux (cross)
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • 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/)
  • 23.11 Release Notes (or backporting 23.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.

cc @zimbatm @Lassulus

@AndersonTorres
Copy link
Copy Markdown
Member

  1. still broken
  2. dreadful splicing

@lopsided98
Copy link
Copy Markdown
Contributor Author

Could you provide more explanation? I haven't tested this super thoroughly, but it works well enough to allow me to cross-compile my armv6l systems.

@AndersonTorres
Copy link
Copy Markdown
Member

AndersonTorres commented Jul 28, 2023

This is an old discussion: because of the current splicing method, some "natural" expressions break.

For me, it all started here:
#204303

But there are many complains about splicing running out there

#227327
#211340

@lopsided98
Copy link
Copy Markdown
Contributor Author

Are you just complaining about splicing in general? I don't see what those issues specifically have to do with this case. Could you provide an example that is still broken with this PR?

Just to clarify, splicing was working fine with writeNginxConfig until #244835 broke it. This PR is necessary to restore functionality that was working fine until a few days ago.

@AndersonTorres
Copy link
Copy Markdown
Member

AndersonTorres commented Jul 28, 2023

Forget.

Just fix the problems reported by ofBorg here and now, at the red X below. Until then, I will put the PR on draft mode.

@AndersonTorres AndersonTorres marked this pull request as draft July 28, 2023 02:45
Use callPackages instead of plain import to get proper splicing. Without this,
writeNginxConfig fails when cross-compiling.
@lopsided98 lopsided98 force-pushed the writers-callpackages branch from e42f2f3 to 09dd973 Compare July 28, 2023 02:55
@AndersonTorres
Copy link
Copy Markdown
Member

error: anonymous function at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/ofborg-evaluator-7/pkgs/build-support/writers/data.nix:1:1 called without required argument 'runCommandNoCC'

@lopsided98
Copy link
Copy Markdown
Contributor Author

I can't reproduce that locally, so I don't know how to fix it.

runCommandNoCC is now an alias for runCommand, which was causing ofborg
failures with allowAliases = false.
@lopsided98
Copy link
Copy Markdown
Contributor Author

I figured it out; it is caused by ofborg setting allowAliases = false, because runCommandNoCC is an alias. Not sure why this wasn't caught previously.

@lopsided98 lopsided98 marked this pull request as ready for review July 28, 2023 04:41
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Jul 28, 2023
@zimbatm zimbatm merged commit 1c19ccb into NixOS:master Jul 28, 2023
@zimbatm
Copy link
Copy Markdown
Member

zimbatm commented Jul 28, 2023

thanks! sorry for the breakage

@lopsided98 lopsided98 deleted the writers-callpackages branch July 28, 2023 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants