guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with `direnv` package definition


From: Christopher Baines
Subject: Re: Problem with `direnv` package definition
Date: Sun, 21 Apr 2019 10:54:19 +0100
User-agent: mu4e 1.0; emacs 26.1

Tanguy Le Carrour <address@hidden> writes:

> Le 04/20, Christopher Baines a écrit :
>> Tanguy Le Carrour <address@hidden> writes:
>> > However, in the package definition [2], 3 Go packages are listed as
>> > "inputs" whereas they should be listed as "native-inputs". Is this
>> > correct?
>> That sounds right to me, although there have been issues with binaries
>> generated with Go […]
>> There's also an important aspect of cross-compilation to these fields,
>> which you can read about here:
>>
>>   
>> https://www.gnu.org/software/guix/manual/en/html_node/package-Reference.html
>
> Thanks for the link.
>
> I do realize that, so close to the release of Guix System 1.0,
> this can sound trivial, but I find it a little annoying to have
> `guix size direnv` reporting 594 MiB when the actual binary size is
> 2.9M. :-(

So, in contrast to some other package management systems, the runtime
dependencies, or references of the output(s) in the case of Guix are not
explicitly set in the package definition.

This is still something I have a little difficulty understanding, but
the inputs/native-inputs distinction is more about architecture than
runtime references.

That's not to say that making the inputs, native-inputs in this case is
wrong, quite the opposite. But, to reduce the size of the package, all
that's required is to remove the reference from the direnv binary to the
go compiler.

It turns out that there's a specific phase of the go-build-system in
Guix that does this. Currently the direnv package is using the
gnu-build-system, as it's one of the older go packages in Guix, however
it does now pull in some phases from the go-build-system.

I've just pushed a commit that pulls in the relevant phase, and makes
the inputs, native-inputs [1]. With that change, the size of the package
does drop [2].

1: 
http://git.savannah.gnu.org/cgit/guix.git/commit/?id=9729b6ea2fe89d5b8cfd180ef2dfca367c7417e5
2:
→ guix size /gnu/store/64m1v6smprhzmsbdvrwvd5gsrc5lirr5-direnv-2.15.2
store item                                                       total    self
/gnu/store/64m1v6smprhzmsbdvrwvd5gsrc5lirr5-direnv-2.15.2            4.9     
2.9  59.0%
/gnu/store/izyk3kppj42pa8i2cq29bw3bnr1607ps-tzdata-2018i             2.0     
2.0  41.0%
total: 4.9 MiB

>> > As I said, I'm still learning. But I've tried, and here is what I've
>> > done so far […]
>>
>> I tried changing the inputs to native-inputs, and the package built for
>> me. Could you share the exact changes you made?
>
> I haven't done much:
>
> --- a/gnu/packages/shellutils.scm
> +++ b/gnu/packages/shellutils.scm
> @@ -129,12 +129,11 @@ are already there.")
>           ;; Help the build scripts find the Go language dependencies.
>           (add-before 'unpack 'setup-go-environment
>             (assoc-ref go:%standard-phases 'setup-go-environment)))))
> -    (inputs
> -     `(("go" ,go)
> -       ("go-github-com-burntsushi-toml" ,go-github-com-burntsushi-toml)
> -       ("go-github-com-direnv-go-dotenv" ,go-github-com-direnv-go-dotenv)))
>      (native-inputs
> -      `(("which" ,which)))
> +      `(("go" ,go)
> +        ("go-github-com-burntsushi-toml" ,go-github-com-burntsushi-toml)
> +        ("go-github-com-direnv-go-dotenv" ,go-github-com-direnv-go-dotenv)
> +        ("which" ,which)))
>      (home-page "https://direnv.net/";)
>      (synopsis "Environment switcher for the shell")
>      (description
>
>
> Thanks again for your time!

What you've put above looks ok, I'm unsure why that wouldn't work...

Anyway, while the size of direnv should now be improved, there's still
more improvements to be made to the direnv package if you're interested!

I think it would be better to switch to using the go build system, and
the package in Guix is quite a few versions behind.

Chris

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]