Coder Social home page Coder Social logo

Comments (8)

kosmikus avatar kosmikus commented on June 30, 2024

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.

peti avatar peti commented on June 30, 2024

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.

kosmikus avatar kosmikus commented on June 30, 2024

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.

peti avatar peti commented on June 30, 2024

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.

kosmikus avatar kosmikus commented on June 30, 2024

Yes, I think I'm coming to the same conclusion.

from cabal2nix.

kosmikus avatar kosmikus commented on June 30, 2024

I'm starting to work on this in branch flag-support.

from cabal2nix.

peti avatar peti commented on June 30, 2024

As an intermediate solution, I've added the ability to hard-code certain flag assignments on a per-package basis.

from cabal2nix.

peti avatar peti commented on June 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.