Hi Mark,

I would like to add to the answers you already got.

"Mark L." <c...@pydis.com> writes:

> Hi everyone!
>
> I am trying out Guix to build software, I like it so far, but what confuses 
> me are the build systems.
>
> I originally thought a build system would figure out which dependencies are 
> needed based on the project lockfile (has versions and hashes) and then 
> installs them from there. But it doesnt seem to work that way.

>
> It seems that package dependencies specified in the languages lockfiles need 
> to be duplicated into the guix package definitions, which I think means any 
> dependency of the project needs to be packaged in Guix, & any package updates 
> need to be done twice. Is this correct?

>
> Would it be possible for the build system to somehow infer packages from the 
> project dependencies - maybe have them supply a function to return package 
> definitions as sourced from the lockfile?

It depends on the language and the tools available for it. For example,
something like that is perfectly possible with languages like Go, Rust,
Node or Python. But on the other hand, it's somewhat feasible only with
Go and Rust. That is because those get the dependencies compiled in the
resulting binary. Whereas Python and Node, they use the dependencies
during runtime. You can't mix two library versions in one python process
(at least not easily). And in addition this can work only with
completely 'native' libraries that are written solely in the language
used, or if they have an easy mechanism to build their dependencies.
The whole process would something like this: 1.
vendor the dependencies as 'source', 2. build everything in the build
process together. Note that for step 1 to work well, you need to ensure
complete reproducibility, because you will need to use a fixed output
derivation to have access to the internet to download the packages. This
can sometimes be hard to do.

While Guix isn't taking this approach, Nixpkgs is, so you can check out
how they do it. (of course only with Go and Rust, as I mentioned
it is not really possible with Python nor Node)
And it seems there are unofficial guix projects that do
a similar thing. Someone made go vendor recently for Guix.

But generally this is not really possible as most build systems do not
really have a way to say how to build the dependencies, it's possible
only in the 'well-defined' ones, where you fetch code (and this code can
be compiled the same way every time) from one place / multiple places
using the same APIs, when you get to world of C, C++ programs, you
usually end up with not-so-clearly defined dependencies - you don't know
the exact version, you don't know where to obtain it nor what the
process to build it will be (though you can of course guess it will be
just simple makefiles/autoconf)

Regards,
Rutherther

Reply via email to