Comments (8)
Main reason I haven't just done this is because I'm not sure how to best structure the inputs. There are several options here. Since Nix isn't a very typed language, doing the most accurate thing may easily lead to unreadable code.
from cabal2nix.
Unless I'm totally mistaken, flags in Cabal are always boolean values, right? There's only enable/disable; you cannot pass string values into the build or anything.
In that case, I'd say that a flag "foo" should be a parameter "enableFoo" to the expression that has whatever default value the Cabal file specifies. Now, the choice for "enableFoo" affects extraBuildInputs and propagatedBuildInputs, nothing else, right? So those lists would have to be extended at evaluation time using some kind of conditional guard.
Am I missing something?
from cabal2nix.
Flags are only booleans, right. The choice is whether to require the maximum set of build inputs as function arguments and have them be null if they turn out not to be needed (this is what I currently favour), or whether to require build inputs as some nested record where conditional inputs are grouped with their flags.
from cabal2nix.
My intuitive choice would require all possible build inputs as flat arguments to the expression. I would not add them to the propagatedBuildInputs or extraBuildInput fields, though, unless the corresponding "enableFoo" tells me to.
The advantage I see in requiring all of them unconditionally is that missing inputs are detected quickly (because the function call will fail). We wouldn't know whether that expression actually builds in all cases, but we could be reasonably sure that all dependencies can be found in scope somewhere.
from cabal2nix.
Yes, I think I'm coming to the same conclusion.
from cabal2nix.
I'm starting to work on this in branch flag-support.
from cabal2nix.
As an intermediate solution, I've added the ability to hard-code certain flag assignments on a per-package basis.
from cabal2nix.
It's probably safe to close this issue for the time being. There is no immediate effort underway that touches this subject in any way.
from cabal2nix.
Related Issues (20)
- Map `extra-libraries: FLAC` to pkgs.flac HOT 4
- latest library doesn't pull in other latest library
- do not encourage use of `nix-env` HOT 1
- Confusing output when using --subpath in conjunction with a source that needs to be unpacked
- Improve tooling for making a new release
- Add --disable-library-profiling option HOT 2
- `posix_spawnp: illegal operation` HOT 1
- Support for GitHub/GitLab PR URLs HOT 1
- Add warning redirecting to nixpkgs manual at the top of every readthedocs page
- Get pkg-config dependencies from `pkg-configPackages` HOT 5
- Don't set mainProgram when it matches pname HOT 1
- Component-based build support for `cabal2nix` HOT 5
- Removing `configureCabalFlags` completely HOT 1
- Invalid Nix is generated for a .cabal file that has the `if` package as a dependency HOT 1
- Generate `meta.longDescription` HOT 2
- Generate version alias info to streamline updates HOT 3
- Support single-file Haskell script HOT 3
- Pulling from darcs zip file results in unpacking failure. HOT 1
- Status of the repository? HOT 2
- Adding pkgconfig-depends: hdf5 pulls in Haskell's hdf5, not system hdf5 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cabal2nix.