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

be able to specify default values for `system-ghc` and `resolver` #904

Closed
erantapaa opened this Issue Sep 2, 2015 · 5 comments

Comments

Projects
None yet
3 participants
@erantapaa
Copy link

erantapaa commented Sep 2, 2015

Is there a way to default the value of system-ghc and resolver when creating a new stack.yaml?

I've tried adding them to my ~/.stack/global/stack.yaml file, but it doesn't seem to have any effect when using stack new.

Btw, I think defaulting system-ghc: false would be a good idea, especially for beginners if they have a corrupted ghc package db.

@borsboom

This comment has been minimized.

Copy link
Contributor

borsboom commented Sep 2, 2015

In general, see the stack.yaml documentation for information about which options can go where.

In particular, since system-ghc is a non-project option, you can set its default in ~/.stack/stack.yaml. That file is always loaded before the project's stack.yaml (which can then override it).

There is no way to set the default resolver for stack new. However, it will tend to prefer a snapshot that you're already using (it uses the same algorithm as stack init)

The ~/.stack/global/stack.yaml file is only used as a "pseudo-project" for when you're performing operations outside a real project. Values in that file are not used in other cases.

Btw, I think defaulting system-ghc: false would be a good idea, especially for beginners if they have a corrupted ghc package db.

Do you think this is common? stack only uses the global GHC package database, not the user package database. That means a user would have had to be using sudo cabal install --global in order to mess up the global database. That seems like something they'd have to be pretty deliberate about.

@erantapaa

This comment has been minimized.

Copy link
Author

erantapaa commented Sep 3, 2015

Thanks for the reply!

Re the default value of system-ghc... I have a simple project which will not build unless I use system-ghc: false. If you want to help me debug the problem I can give you more details.

@snoyberg

This comment has been minimized.

Copy link
Contributor

snoyberg commented Sep 3, 2015

There is no way to set the default resolver for stack new.

Actually, the --resolver flag works for this, e.g.:

stack new foo simple --resolver lts-3.4
@borsboom

This comment has been minimized.

Copy link
Contributor

borsboom commented Sep 3, 2015

Actually, the --resolver flag works for this,

Er, I meant no way to set it in a configuration file, but I should have been more specific. In general, we're pushing to make more command-line options settable in the config file, but I have my doubts as to whether this one should be. Stack new/init need to use some logic to determine the right resolver for the particular template or project, which means forcing a default is as likely to cause problems as it is to be helpful.

I have a simple project which will not build unless I use system-ghc: false

Have you done anything weird, such as perhaps installing multiple versions of a package in the global package database (Cabal and bytestring seem especially prone to this)? That should only happen if you explicitly use cabal --global, though. You can check that using ghc-pkg list --global. If so, I'd say re-install your system GHC with a fresh global package database. If things aren't working with a "fresh" system GHC, though, we should dig into that some more.

@snoyberg snoyberg added this to the Support milestone Sep 6, 2015

@snoyberg

This comment has been minimized.

Copy link
Contributor

snoyberg commented Sep 21, 2015

Closing due to lack of feedback. Issue #115 may be relevant.

@snoyberg snoyberg closed this Sep 30, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment