{"action":"created","issue":{"url":"https://api.github.com/repos/NixOS/cabal2nix/issues/220","repository_url":"https://api.github.com/repos/NixOS/cabal2nix","labels_url":"https://api.github.com/repos/NixOS/cabal2nix/issues/220/labels{/name}","comments_url":"https://api.github.com/repos/NixOS/cabal2nix/issues/220/comments","events_url":"https://api.github.com/repos/NixOS/cabal2nix/issues/220/events","html_url":"https://github.com/NixOS/cabal2nix/issues/220","id":138841528,"number":220,"title":"Pass cabal file itself instead of directory.","user":{"login":"Ericson2314","id":1055245,"avatar_url":"https://avatars.githubusercontent.com/u/1055245?v=3","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},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-03-06T21:39:26Z","updated_at":"2016-03-09T18:32:00Z","closed_at":"2016-03-08T10:03:24Z","body":"I like to run cabal2nix with an import from derivation:\r\n```nix\r\n dynamicCabal2nix = dir: pkgs.runCommand \"dynamic-cabal2nix\" {\r\n     nativeBuildInputs = [ pkgs.haskellPackages.cabal2nix ];\r\n   } \"cabal2nix ${dir} > $out\";\r\n```\r\nTo avoid copying tons of stuff to the store just to get in a development shell, I'd like to invoke that as `dynamicCabal2nix ./my-pkg.cabal`. But cabal2nix only accepts directories, not cabal files directly. My current work around is an additional `runCommand` to copy the cabal file to a new empty directory---not very elegant."},"comment":{"url":"https://api.github.com/repos/NixOS/cabal2nix/issues/comments/194438976","html_url":"https://github.com/NixOS/cabal2nix/issues/220#issuecomment-194438976","issue_url":"https://api.github.com/repos/NixOS/cabal2nix/issues/220","id":194438976,"user":{"login":"Ericson2314","id":1055245,"avatar_url":"https://avatars.githubusercontent.com/u/1055245?v=3","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":"2016-03-09T18:32:00Z","updated_at":"2016-03-09T18:32:00Z","body":"> If the URI refers to a cabal file, information for building the package will\r\n  be retrieved from that file, but hackage will be used as a source for the\r\n  derivation. Otherwise, the supplied URI will be used to as the souce for the\r\n  derivation and the information is taken from the cabal file at the root of the\r\n  downloaded source.\r\n\r\nOk, now I understand the rational for the current way things are done better. Maybe the solution is then to add a `--source=<nix expression>`, `--source=<path>`, or `--null-source` flag? I currently set the `src` with `overrideCabal` for nix-shell, and keep it as is for full builds, in order to copy the minimal amount of stuff. With this flag, I'd just do that in reverse."}}