{"action":"created","issue":{"url":"https://api.github.com/repos/NixOS/nixpkgs/issues/39646","repository_url":"https://api.github.com/repos/NixOS/nixpkgs","labels_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/39646/labels{/name}","comments_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/39646/comments","events_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/39646/events","html_url":"https://github.com/NixOS/nixpkgs/issues/39646","id":318624892,"number":39646,"title":"haskell: Setup.hs should not be compiled with the same pkgdb as the package itself","user":{"login":"kirelagin","id":451835,"avatar_url":"https://avatars1.githubusercontent.com/u/451835?v=4","gravatar_id":"","url":"https://api.github.com/users/kirelagin","html_url":"https://github.com/kirelagin","followers_url":"https://api.github.com/users/kirelagin/followers","following_url":"https://api.github.com/users/kirelagin/following{/other_user}","gists_url":"https://api.github.com/users/kirelagin/gists{/gist_id}","starred_url":"https://api.github.com/users/kirelagin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kirelagin/subscriptions","organizations_url":"https://api.github.com/users/kirelagin/orgs","repos_url":"https://api.github.com/users/kirelagin/repos","events_url":"https://api.github.com/users/kirelagin/events{/privacy}","received_events_url":"https://api.github.com/users/kirelagin/received_events","type":"User","site_admin":false},"labels":[{"id":6314750,"url":"https://api.github.com/repos/NixOS/nixpkgs/labels/0.kind:%20bug","name":"0.kind: bug","color":"84b6eb","default":false},{"id":99513706,"url":"https://api.github.com/repos/NixOS/nixpkgs/labels/6.topic:%20haskell","name":"6.topic: haskell","color":"fef2c0","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2018-04-28T10:44:54Z","updated_at":"2018-05-04T15:10:39Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Let’s say I have a project that consists of two packages:\r\n\r\n1. Custom prelude. It depends on `base-noprelude` instead of `base` and provides a `Prelude` module so that it is imported automatically.\r\n2. Library. Depends, again, on `base-noprelude` and my custom prelude package.\r\n\r\n([demo](https://github.com/kirelagin/nixpkgs-cusom-prelude))\r\n\r\nWhen I try to build the library package with nix, here is what I get:\r\n\r\n~~~\r\nthese derivations will be built:\r\n  /nix/store/g9cdimcmbcmd2b5nc7xd420xij5w744k-demo-0.0.0.drv\r\nbuilding '/nix/store/g9cdimcmbcmd2b5nc7xd420xij5w744k-demo-0.0.0.drv'...\r\nsetupCompilerEnvironmentPhase\r\nBuild with /nix/store/kwwcbv3kdpq7wr3rqn1fawijqkzbac3s-ghc-8.4.1.\r\nignoring (possibly broken) abi-depends field for packages\r\nunpacking sources\r\nunpacking source archive /nix/store/8f8plqz8n5zgcqryw6xm2rrlpr3z0q49-demo\r\nsource root is demo\r\npatching sources\r\ncompileBuildDriverPhase\r\nsetupCompileFlags: -package-db=/private/var/folders/sd/00sk0kcj1vqcxg1ygth7vl6h0000gn/T/nix-build-demo-0.0.0.drv-0/package.conf.d -j4 -threaded\r\n[1 of 1] Compiling Main             ( /nix/store/4mdp8nhyfddh7bllbi7xszz7k9955n79-Setup.hs, /private/var/folders/sd/00sk0kcj1vqcxg1ygth7vl6h0000gn/T/nix-build-demo-0.0.0.drv-0/Main.o )\r\n\r\n/nix/store/4mdp8nhyfddh7bllbi7xszz7k9955n79-Setup.hs:1:1: error:\r\n    Ambiguous module name ‘Prelude’:\r\n      it was found in multiple packages: base-4.11.0.0 myprelude-0.0.0\r\n  |\r\n1 | import Distribution.Simple\r\n  | ^\r\nnote: keeping build directory '/private/var/folders/sd/00sk0kcj1vqcxg1ygth7vl6h0000gn/T/nix-build-demo-0.0.0.drv-0'\r\nbuilder for '/nix/store/g9cdimcmbcmd2b5nc7xd420xij5w744k-demo-0.0.0.drv' failed with exit code 1\r\nerror: build of '/nix/store/g9cdimcmbcmd2b5nc7xd420xij5w744k-demo-0.0.0.drv' failed\r\n~~~\r\n\r\nAs far as I understand, the cause is that `Setup.hs` is built with the `--make` flag and with this flag GHC adds `base` to the set of visible packages, but my custom prelude is there as well.\r\n\r\nI think one way to solve this is to do away with `coreSetup` and always build a custom environment consisting only of `setupHaskellDepends`. One issue I am aware of here is that `Cabal` does not have `setupHaskellDepends` and will need to be fixed with `addSetupDepends Cabal [ mtl pandoc ]`.\r\n\r\n(@peti)\r\n(somewhat related: #37254)"},"comment":{"url":"https://api.github.com/repos/NixOS/nixpkgs/issues/comments/386631851","html_url":"https://github.com/NixOS/nixpkgs/issues/39646#issuecomment-386631851","issue_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/39646","id":386631851,"user":{"login":"Ericson2314","id":1055245,"avatar_url":"https://avatars3.githubusercontent.com/u/1055245?v=4","gravatar_id":"","url":"https://api.github.com/users/Ericson2314","html_url":"https://github.com/Ericson2314","followers_url":"https://api.github.com/users/Ericson2314/followers","following_url":"https://api.github.com/users/Ericson2314/following{/other_user}","gists_url":"https://api.github.com/users/Ericson2314/gists{/gist_id}","starred_url":"https://api.github.com/users/Ericson2314/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ericson2314/subscriptions","organizations_url":"https://api.github.com/users/Ericson2314/orgs","repos_url":"https://api.github.com/users/Ericson2314/repos","events_url":"https://api.github.com/users/Ericson2314/events{/privacy}","received_events_url":"https://api.github.com/users/Ericson2314/received_events","type":"User","site_admin":false},"created_at":"2018-05-04T15:10:39Z","updated_at":"2018-05-04T15:10:39Z","author_association":"MEMBER","body":"Multiple outputs is a solution for closure size, not shorter debug cycles. It doesn't help with debug cycles at all. Debug cycles period length is still far and away my top priority."}}
{"actor":{"display_login":"Ericson2314"}}