-
-
Notifications
You must be signed in to change notification settings - Fork 159
Description
AFAICT, cabal2nix currently needs to be run from the directory that you want the derivation to live in. E.g.,
cabal2nix my-package >nix/my-package.nixwill have the wrong src (it’ll be ./my-package instead of ../my-package), but
cd nix
cabal2nix ../my-package >my-package.nixwill have the correct src, because it just uses the file URI.
Also, providing an absolute path for the URI will have a src that requires --impure.
If the destination file is specified as an argument rather than a redirect, cabal2nix can resolve both paths and deduce the relative path from the destination to the source URI, which solves both of these problems.
In my case, I‘m running this from a script, and both paths are relative to where the script is run from. Also, the script accepts the same sources as cabal2nix (e.g., “cabal://”), so there is extra work already done by cabal2nix itself to determine if the source even is a path that will make it into the derivation.