Skip to content

Allow specifying output file #684

@sellout

Description

@sellout

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.nix

will have the wrong src (it’ll be ./my-package instead of ../my-package), but

cd nix
cabal2nix ../my-package >my-package.nix

will 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions