{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreihqbq3wbeiqnu7cjosegks2t5wgxtztktjcftchr2f7owadsxgqqi",
"uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mimk3yycndv2"
},
"path": "/t/suggestion-deprecate-the-global-default-package-environment-file/13885#post_1",
"publishedAt": "2026-04-03T19:42:35.000Z",
"site": "https://discourse.haskell.org",
"tags": [
"Global configuration of default packages - #12 by tomjaguarpaw",
"Add a warning when an env file is created (backport #9705) by mergify[bot] · Pull Request #9895 · haskell/cabal · GitHub"
],
"textContent": "Every now and then, my colleagues run into problems with scripts which invoke `ghc` directly getting confused because they happen to have a global package environment file at `$XDG_DATA_HOME/ghc/arch-os-version/environments/default` (whereas most people at my work don’t have one of these). I recently learned that `ghc` reads this file by default if it exists, which seems to just mess things up if you’re in any kind of cabal project, or just generally if you’re not expecting `ghc` to use this global configuration. Right now, it seems like you have to remember to pass `-hide-all-packages` or `-package-env=-` pretty much whenever you’re invoking ghc directly, which is a bit inconvenient.\n\nThe global package environment file is clearly not well-loved by the community either; see, eg:\n\n * Global configuration of default packages - #12 by tomjaguarpaw\n * Add a warning when an env file is created (backport #9705) by mergify[bot] · Pull Request #9895 · haskell/cabal · GitHub\n\n\n\nIs it feasible to just do away with the global default package environment? I’m imagining changing ghc so that it would stop reading that file by default if it exists, and that you could still opt in to having ghc read that file by passing `-package-env default` or by setting `GHC_ENVIRONMENT=default`.\n\nMy guess would be that most recent-ish haskell tutorials don’t rely on this behaviour (especially since this behaviour is now opt-in via cabal’s `--lib` flag) and it wouldn’t be particularly difficult to work around in the places that do?",
"title": "Suggestion: deprecate the global default package environment file"
}