teto
March 15, 2020, 4:29pm
1
I am looking for a solution for luarocks to deal with cmake based packages. The best fix would be to have structured cmakeFlags which was mentioned in [RFC 0013] Ergonomic `cmakeFlags` by aneeshusa · Pull Request #13 · NixOS/rfcs · GitHub , with PRs like [WIP/RFC] Make `cmakeFlags` more ergonomic by aneeshusa · Pull Request #17886 · NixOS/nixpkgs · GitHub .
Seems like stdenv: enable __structuredAttrs by globin · Pull Request #72074 · NixOS/nixpkgs · GitHub is the way forward.
I tried to enable __structuredAttrs = true for just my derivation but it ended up with /setup: No such file or directory errors.
1/ any quickfix to address this error ?
2/ what’s the status of stdenv 2.0 ?
Cheers
4 Likes
teto
April 3, 2020, 1:02pm
3
I dont mind helping with the workload as it is a crucial feature that could really help clean nixpkgs. But I would need some guidance and I guess it might not be easy to split the load anyway.
In case anyone is interested, I opened a (draft) PR tackling this.
NixOS:staging ← ShamrockLee:cmake-structured-attrs
opened 01:25AM - 28 Mar 24 UTC
## Description of changes
### Summary
Provide structural attributes suppor… t to the setup hooks of CMake, lint them with ShelllCheck, and add package tests to `cmake` to ensure that these hooks always passe ShellCheck.
Fix #289037.
### New interface
Provide interface to structurally specify CMake `-D` flags, i.e. `cmakeDFlagAttrs` and `cmakeDFlagEvalAttrs`. Not only can it be specified by phases/hooks run before `cmakeConfigurePhase`, but also as Nix Language attributes when `__structuralAttrs = true`.
### Questions
- Naming.
- Any suggestions to the new names `cmakeDFlagAttrs` and `cmakeDFlagEvalAttrs`?
- Boolean and non-string type management.
- Should we allow boolean and other non-string type when `cmakeDFlagAttrs` is used inside the Nix Language expression? That would be quite convenient in Nix expression level, but require an extra layer of conversion. This PR currently doesn't provide such support.
<!--
For package updates please link to a changelog or describe changes, this helps your fellow maintainers discover breaking updates.
For new packages please briefly describe the package or provide a link to its homepage.
-->
## 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](https://nixos.org/manual/nix/stable/command-ref/conf-file.html))
- [ ] `sandbox = relaxed`
- [ ] `sandbox = true`
- [ ] Tested, as applicable:
- [NixOS test(s)](https://nixos.org/manual/nixos/unstable/index.html#sec-nixos-tests) (look inside [nixos/tests](https://github.com/NixOS/nixpkgs/blob/master/nixos/tests))
- and/or [package tests](https://nixos.org/manual/nixpkgs/unstable/#sec-package-tests)
- or, for functions and "core" functionality, tests in [lib/tests](https://github.com/NixOS/nixpkgs/blob/master/lib/tests) or [pkgs/test](https://github.com/NixOS/nixpkgs/blob/master/pkgs/test)
- made sure NixOS tests are [linked](https://nixos.org/manual/nixpkgs/unstable/#ssec-nixos-tests-linking) to the relevant packages
- [ ] 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](https://github.com/Mic92/nixpkgs-review#usage)
- [ ] Tested basic functionality of all binary files (usually in `./result/bin/`)
- [24.05 Release Notes](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2405.section.md) (or backporting [23.05](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2305.section.md) and [23.11](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2311.section.md) 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](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
<!--
To help with the large amounts of pull requests, we would appreciate your
reviews of other pull requests, especially simple package updates. Just leave a
comment describing what you have tested in the relevant package/service.
Reviewing helps to reduce the average time-to-merge for everyone.
Thanks a lot if you do!
List of open PRs: https://github.com/NixOS/nixpkgs/pulls
Reviewing guidelines: https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#reviewing-contributions
-->
---
Add a :+1: [reaction] to [pull requests you find important].
[reaction]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/
[pull requests you find important]: https://github.com/NixOS/nixpkgs/pulls?q=is%3Aopen+sort%3Areactions-%2B1-desc
4 Likes
Given the approvals, I’m planning to merge the `cmakeEntries` PR. Could someone help take a look at the documentation and the release note?
1 Like
SergeK
June 2, 2026, 10:23pm
7
Tangential topic (don’t feel like starting a separate thread) we on the cuda team were about to ping you on: now that we’re moving to __structuredAttrs, none of the setup-hook modified makeFlags, cmakeFlags, mesonFlags, &c are now available outside bash, i.e. in subprocesses, which is why in python3Packages.triton: 3.6.0 -> 3.7.0; python3Packages.torch: 2.11.0 -> 2.12.0 by GaetanLepage · Pull Request #519925 · NixOS/nixpkgs · GitHub we’re temporarily going to make the assumption that cmakeFlags are static.
As such, we’ll be now needing the stdenv hook to feature some logic for updating the env synchronously with updating NIX_ATTRS_JSON_FILE. Do you already have some ideas for how to tackle this?
CC @ConnorBaker @YorikSar @glepage
Per Someone’s request, NixOS/nixpkgs PR #42017 now updates $NIX_ATTRS_JSON_FILE and the cmakeEntries/cmakeFlags shell variables simultaneously, and observe the JSON file as the source of truth.
Nevertheless, the diff of this implementation is significantly larger, which mainly consists of four CMake scripts and various getters and setters.
Please take a look!
1 Like
Woah, libchdr looks way nicer
2 Likes