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

How to use github repo as dependency? #1946

Open
ildar-shaymukhametov opened this issue Apr 7, 2024 · 2 comments
Open

How to use github repo as dependency? #1946

ildar-shaymukhametov opened this issue Apr 7, 2024 · 2 comments

Comments

@ildar-shaymukhametov
Copy link

ildar-shaymukhametov commented Apr 7, 2024

I have a simple haskell stack repo
I want to use it's Lib module as a dependency for my another project (made with this template: https://github.com/rvarun11/codespaces-ihp)
How can I do this?

Also tried this: https://cabal.readthedocs.io/en/3.4/cabal-project.html#specifying-packages-from-remote-version-control-locations, it even installed pf2e and it's deps; I added pf2e to App.cabal, but got error "Module not found"

image
image
image

@ildar-shaymukhametov ildar-shaymukhametov changed the title Add ability to use github repo as dependency How to use github repo as dependency? Apr 8, 2024
@mpscholten
Copy link
Member

You can follow most of the guide here https://ihp.digitallyinduced.com/Guide/package-management.html#using-a-different-version-of-a-haskell-package and use cabal2nix to create a nix file for your custom package. Then adjust the generated nix file to fetch from github.

Here's an example:

# Config/nix/haskell-packages/currencies.nix
{ mkDerivation, base, hspec, lib, text, fetchFromGitHub }:
mkDerivation {
  pname = "currencies";
  version = "0.2.0.0";
  libraryHaskellDepends = [ base text ];
  testHaskellDepends = [ base hspec text ];
  homepage = "https://github.com/alx741/currencies#readme";
  description = "Currencies representation, pretty printing and conversion";
  license = lib.licenses.bsd3;
  src = fetchFromGitHub {
    owner = "alx741";
    repo = "currencies";
    rev = "99f5bde00814510aa5993940ffc179f543bdb3cd";
    sha256 = "sha256-B0Ah0If3qRaN8c4Ygh6ayzigfB8fgXjaO+1bPWItBcI=";
  };
}

@ildar-shaymukhametov
Copy link
Author

ildar-shaymukhametov commented Apr 8, 2024

I could not make it work
I am trying another way: I have it build and put in a local folder
But still it does not work (flake.lock does not reflect any changes)
image
How to make it work?

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

No branches or pull requests

2 participants