Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where hpack goes so does hpack-dhall. #374

Open
philderbeast opened this issue Aug 31, 2018 · 4 comments
Open

Where hpack goes so does hpack-dhall. #374

philderbeast opened this issue Aug 31, 2018 · 4 comments

Comments

@philderbeast
Copy link
Contributor

In the same way that we have an --hpack option for taking the package definition from package.yaml with hpack can we also have an --hpack-dhall option for taking the package definition from package.dhall with hpack-dhall?


> cabal2nix --help
cabal2nix converts Cabal files into build instructions for Nix.

Available options:
--hpack                  run hpack before configuring this package (only
                           non-hackage packages)
philderbeast added a commit to cabalism/cabal2nix that referenced this issue Aug 31, 2018
philderbeast added a commit to cabalism/cabal2nix that referenced this issue Aug 31, 2018
philderbeast added a commit to cabalism/cabal2nix that referenced this issue Aug 31, 2018
@philderbeast
Copy link
Contributor Author

I kept --hpack as an option and added --dhall;

Available options:
  --hpack                  package.yaml --> .cabal (only non-hackage packages)
  --dhall                  package.dhall -> .cabal (only non-hackage packages)

@philderbeast
Copy link
Contributor Author

> cabal2nix --dhall siggy-chardust
*** found package.dhall. Using hpack-dhall...
...
mkDerivation {
  pname = "siggy-chardust";
  version = "1.0.0";
  src = ./siggy-chardust;
...
  libraryToolDepends = [ hpack-dhall ];
...
  preConfigure = "hpack-dhall";
...
}
cabal2nix --dhall https://github.com/BlockScope/flare-timing --subpath=siggy-chardust
...
*** found package.dhall. Using hpack-dhall...
...
mkDerivation {
  pname = "siggy-chardust";
  version = "1.0.0";
  src = fetchgit {
    url = "https://github.com/BlockScope/flare-timing";
    sha256 = "1f8z45p894m77m80nk0di6x6s7mvdx35d1y70971m661iqybk5z1";
    rev = "5b34dd6c5a8babef45a3beca2af9f04ccf8ed645";
    fetchSubmodules = true;
  };
  postUnpack = "sourceRoot+=/siggy-chardust; echo source root reset to $sourceRoot";
...
  libraryToolDepends = [ hpack-dhall ];
...
  preConfigure = "hpack-dhall";
...
}

@philderbeast
Copy link
Contributor Author

philderbeast commented Sep 5, 2018

When package.dhall has an error, in this case I've added a trailing semicolon;

> cabal2nix siggy-chardust
*** found package.dhall. Using hpack-dhall...
*** hpack-dhall error: "\n\ESC[1;31mError\ESC[0m: Invalid input\n\n./siggy-chardust/package.dhall:48:8:\n   |\n48 |       };\n   |        ^\nunexpected ';'\nexpecting \"!=\", \"&&\", \"++\", \"//\", \"//\\\\\", \"/\\\", \"==\", \"||\", \"\8743\", \"\10835\", \"\11005\", '#', '(', '*', '+', '.', ':', '?', built-in expression, double literal, end of input, import, integer literal, label, list literal, natural literal, record type or literal, text literal, the rest of expression, or union type or literal\n". Exiting.

philderbeast added a commit to cabalism/cabal2nix that referenced this issue Sep 5, 2018
philderbeast added a commit to cabalism/cabal2nix that referenced this issue Sep 6, 2018
@philderbeast
Copy link
Contributor Author

@peti you've probably seen cabalism/hpack-dhall#3 where @sol gives some pros and cons of hpack-dhall. I liked using hpack (yaml) for filling in cabal fields for me like other-modules. I like that I can keep those benefits of hpack and yet do more with hpack-dhall.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant