Hi!
I have a Haskell package (let’s call it myDep
) available in a remote git repository. This package is not uploaded on hackage, but I made a flake.
Now I develop a Haskell application (let’s call it myApp
) which depends on that package myDep
. Again, I’d like to package app
into a flake.
My approach was to declare an input
inputs.depGit.url = "gitlab:UserName/dep/mainBranch";
provide it in outputs
outputs = { self, nixpkgs, depGit }: # other incantations
...
and then extend haskellPackages
:
haskellPackages =
pkgs.haskell.packages.${ghc}.extend (hself: hsuper: {
myApp = hself.callCabal2nix "myApp" "${self}/" { };
myDep= depGit.packages.${system}.myDep;
});
Unfortunately, this did not work, nix build
complained that
Error: Setup: Encountered missing or private dependencies
myDep
I got an advice to forego the “flakiness” of myDep
:
inputs.depGit = {url = "gitlab:UserName/dep/mainBranch"; flake = false;};
and then use it as
haskellPackages =
pkgs.haskell.packages.${ghc}.extend (hself: hsuper: {
myApp = hself.callCabal2nix "myApp" "${self}/" { };
myDep = hself.callCabal2nix "myDep" depGit { };
});
While this approach certainly works, I am not entirely happy with this way of doing things - it feels like I repackaged the same package again. Nothing flake-related was used; I could call a fetchFromGitlab
and obtain the same result.
Hence my question - is there a fix for my first approach to make myDep
visible? Or is there a yet another approach to the same problem?
Cheers!