tek / hix

Haskell/Nix development build tools
https://tryp.io/hix/index.html
Other
33 stars 2 forks source link

Include dependency from GitHub #8

Open Burtannia opened 1 month ago

Burtannia commented 1 month ago

Hey, I'm relatively new to nix and hix, I've been trying to include a library from GitHub but so far haven't managed to get it working.

I'd like to do something like the following:

{
  description = "A Haskell project";

  inputs = {
    hix.url = "github:tek/hix?ref=0.7.1";
    sem-log.url = "github:Functional-Core/sem-log";
  };

  outputs = {hix, sem-log, ...}: hix.lib.flake {
    overrides = { hackage, unbreak, notest, jailbreak, source, ... }: {
      polysemy-test = unbreak jailbreak;
      polysemy-conc = jailbreak;
      polysemy-log = jailbreak;
      servant-auth-server = unbreak;
      sem-log = sem-log;
    };
...

I've read through the Hix documentation and couldn't find any reference to GitHub deps, only to hackage and source.

tek commented 1 month ago

Hey! Github flake inputs are equivalent to directories, so you should be able to simply use sem-log = source.root sem-log; there (if the Cabal project is at the root, otherwise it's source.sub).

Since sem-log also uses hix, you could even use a more convenient method:

{
  outputs = {hix, sem-log, ...}: hix.lib.flake {
    depsFull = [sem-log];
  };
}

That will include the overrides defined in sem-log's flake (also described in the docs, probably a bit too terse).

I should probably include a comprehensive example like this in the manual. Thanks for the feedback!

tek commented 1 month ago

Actually, it would be best if it just worked the way you tried it, using sem-log = sem-log – if the value is a path, it could default to source.root!