* Guix extension to display derivation (and rewrite fixed-output)
@ 2024-04-12 18:28 Simon Tournier
2024-04-13 0:04 ` Leo Famulari
0 siblings, 1 reply; 9+ messages in thread
From: Simon Tournier @ 2024-04-12 18:28 UTC (permalink / raw)
To: Guix Devel
Hi,
As an Emacs user, exploring Derivation (the .drv files) is easy since
there is an Emacs mode. However, I have been annoyed with some pipe
through ’sed’ and friends.
Therefore, I wrote a very simple Guix extension [1] that outputs
derivation content using recutils format.
--8<---------------cut here---------------start------------->8---
$ guix drv-show $(guix build hello -d)
name: /gnu/store/qr00sgbh3vwwqswmgjjymg6wkys9r4i2-hello-2.12.1.drv
outputs:
+ /gnu/store/6fbh8phmp3izay6c0dpggpxhcjn4xlm5-hello-2.12.1 [out]
inputs:
+ /gnu/store/3ds56xg6njpw6hnp2w4xpx4psw5mka5q-glibc-2.35.drv [out]
+ /gnu/store/3zh2qpi897s2x229s93iakji86b08a20-hello-2.12.1.drv [out]
+ /gnu/store/5bqhdbbl71r9r936w6w8zzqlk41md3wx-glibc-2.35.drv [out]
+ /gnu/store/67nh3fzviy3q4s8ar8cg0dzhyzgwrwdd-module-import-compiled.drv [out]
+ /gnu/store/7fsz44vifdc0ws0amnpwnmig3ra6hb53-gcc-11.3.0.drv [lib]
+ /gnu/store/fchdaawcrxb35llbl7fj7lcsq5asmk4b-guile-2.0.14.drv [out]
+ /gnu/store/ky030dkfkfr3l8xgdbv45j6bs87988lx-gcc-11.3.0.drv [lib]
+ /gnu/store/n9kblf5cx4lphrydjr90sp3zfvcdr1pb-glibc-utf8-locales-2.35.drv [out]
system: x86_64-linux
builder:
+ /gnu/store/4p1l5bdxxbyyqc3wh0d07jv9rp1pdcy7-guile-2.0.14/bin/guile
+ --no-auto-compile
+ -L /gnu/store/a6acf6dds8s9fw7dp5div03rwik0x4x2-module-import
+ -C /gnu/store/yk897hj2p5mdx6hw47s90n8x9pn6s36c-module-import-compiled
+ /gnu/store/fiy8arwqm8vwaqs4h8b361kbmjmd1yra-hello-2.12.1-builder
environment:
+ allowSubstitutes: 0
+ guix properties: ((type . graft) (graft (count . 2)))
+ out: /gnu/store/6fbh8phmp3izay6c0dpggpxhcjn4xlm5-hello-2.12.1
+ preferLocalBuild: 1
--8<---------------cut here---------------end--------------->8---
Do you think it would be useful to package it? Or maybe to include it
as another subcommand (or part of some subcommand)?
Let me know. :-)
My motivation to do it now is this story:
https://simon.tournier.info/posts/2024-04-11-rewrite-drv.html
Cheers,
simon
1: https://gitlab.com/zimoun/guix-drv
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Guix extension to display derivation (and rewrite fixed-output)
2024-04-12 18:28 Guix extension to display derivation (and rewrite fixed-output) Simon Tournier
@ 2024-04-13 0:04 ` Leo Famulari
2024-04-13 10:32 ` Adding plumbing subcommand 'derivation'? Simon Tournier
0 siblings, 1 reply; 9+ messages in thread
From: Leo Famulari @ 2024-04-13 0:04 UTC (permalink / raw)
To: Simon Tournier; +Cc: Guix Devel
On Fri, Apr 12, 2024 at 08:28:11PM +0200, Simon Tournier wrote:
> Therefore, I wrote a very simple Guix extension [1] that outputs
> derivation content using recutils format.
Amazing! That's so useful.
> Do you think it would be useful to package it? Or maybe to include it
> as another subcommand (or part of some subcommand)?
I'd love for this to be built in to Guix. I'm often struggling to read
derivations while debugging or analysing something.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Adding plumbing subcommand 'derivation'?
2024-04-13 0:04 ` Leo Famulari
@ 2024-04-13 10:32 ` Simon Tournier
2024-04-15 18:54 ` Leo Famulari
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Simon Tournier @ 2024-04-13 10:32 UTC (permalink / raw)
To: Leo Famulari; +Cc: Guix Devel
Hi Leo,
On ven., 12 avril 2024 at 20:04, Leo Famulari <leo@famulari.name> wrote:
>> Do you think it would be useful to package it? Or maybe to include it
>> as another subcommand (or part of some subcommand)?
>
> I'd love for this to be built in to Guix. I'm often struggling to read
> derivations while debugging or analysing something.
So I propose to add the plumbing command ’derivation’. Any objection?
Cheers,
simon
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Adding plumbing subcommand 'derivation'?
2024-04-13 10:32 ` Adding plumbing subcommand 'derivation'? Simon Tournier
@ 2024-04-15 18:54 ` Leo Famulari
2024-04-18 8:40 ` Ricardo Wurmus
2024-04-19 14:02 ` Ludovic Courtès
2 siblings, 0 replies; 9+ messages in thread
From: Leo Famulari @ 2024-04-15 18:54 UTC (permalink / raw)
To: Simon Tournier; +Cc: Guix Devel
On Sat, Apr 13, 2024 at 12:32:45PM +0200, Simon Tournier wrote:
> So I propose to add the plumbing command ’derivation’. Any objection?
Sounds good to me, but give it a couple days for everyone else to ponder
the bike shed ;)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Adding plumbing subcommand 'derivation'?
2024-04-13 10:32 ` Adding plumbing subcommand 'derivation'? Simon Tournier
2024-04-15 18:54 ` Leo Famulari
@ 2024-04-18 8:40 ` Ricardo Wurmus
2024-04-18 12:57 ` Christina O'Donnell
2024-04-19 14:02 ` Ludovic Courtès
2 siblings, 1 reply; 9+ messages in thread
From: Ricardo Wurmus @ 2024-04-18 8:40 UTC (permalink / raw)
To: Simon Tournier; +Cc: Leo Famulari, Guix Devel
Hi Simon,
> So I propose to add the plumbing command ’derivation’. Any objection?
I think it's useful to have. To avoid proliferation of sub-commands, do
you think we could put this under "inspect", a generic sub-command for
all sorts of as yet to be invented introspection tools?
--
Ricardo
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Adding plumbing subcommand 'derivation'?
2024-04-18 8:40 ` Ricardo Wurmus
@ 2024-04-18 12:57 ` Christina O'Donnell
2024-04-18 13:28 ` Christina O'Donnell
0 siblings, 1 reply; 9+ messages in thread
From: Christina O'Donnell @ 2024-04-18 12:57 UTC (permalink / raw)
To: Ricardo Wurmus, Simon Tournier; +Cc: Leo Famulari, Guix Devel
Hi,
In the interest of throwing ideas out there, and with the caveat that
this is rather uninformed:
I think having a derivation sub-command makes the most sense to me. E.g.
`guix derivation show` for `guix drv-show`
`guix derivation update` for `guix drv-drv` (or 'refresh' or 'fix')
I have also been thinking that it'd potentially be useful to have
something like:
`guix derivation edit /gnu/store/...-xyz.drv`
Which then produces a temp directory that you may edit with whatever
tools you like, then on command checks for changed files, recompute
hashes recursively, and puts the modified derivations and back into the
store. I think this would be mainly be useful as a debugging tool or for
changes that no longer build, for cases where the new `guix derivation
update` wouldn't work.
On the tangential subject of plumbing commands, I've also started to
write a `guix store` command that simply exposes functions in (guix
store) as a command line interface as a way of learning the internals of
Guix.
This would have sub-commands like:
`guix store get-references`
`guix store get-referrers`
`guix store info` - dumps the `path-info`
`guix store put xyz` - puts xyz into the store as a fixed derivation
binary blob.
I say this as a way of clarifying the design of `guix derivation`, not
as extra stuff that needs go in at the same time. Most of these commands
might be deemed unnecessary.
Alternatively, as you say, Ricardo:
`guix inspect get-references`
`guix inspect get referrers`
`guix inspect path-info`
`guix inspect show-derivation`
However, in that case, another home would need to be found for drv-drv
at minimum since I wouldn't expect 'inspect' to modify anything.
Kind regards,
Christina
On 18/04/2024 09:40, Ricardo Wurmus wrote:
> Hi Simon,
>
>> So I propose to add the plumbing command ’derivation’. Any objection?
> I think it's useful to have. To avoid proliferation of sub-commands, do
> you think we could put this under "inspect", a generic sub-command for
> all sorts of as yet to be invented introspection tools?
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Adding plumbing subcommand 'derivation'?
2024-04-18 12:57 ` Christina O'Donnell
@ 2024-04-18 13:28 ` Christina O'Donnell
0 siblings, 0 replies; 9+ messages in thread
From: Christina O'Donnell @ 2024-04-18 13:28 UTC (permalink / raw)
To: Guix Devel; +Cc: Simon Tournier, Leo Famulari, Ricardo Wurmus
Correction:
On 18/04/2024 13:57, Christina O'Donnell wrote:
> [...]
>
> `guix store get-references`
> `guix store get-referrers`
> `guix store info` - dumps the `path-info`
> `guix store put xyz` - puts xyz into the store as a fixed derivation
> binary blob.
>
> [...]
I've just checked and get-references and get-referrers are available as:
`guix gc --references`
`guix gc --referrers`
Kind regards,
Christina
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Adding plumbing subcommand 'derivation'?
2024-04-13 10:32 ` Adding plumbing subcommand 'derivation'? Simon Tournier
2024-04-15 18:54 ` Leo Famulari
2024-04-18 8:40 ` Ricardo Wurmus
@ 2024-04-19 14:02 ` Ludovic Courtès
2024-04-22 0:11 ` Simon Tournier
2 siblings, 1 reply; 9+ messages in thread
From: Ludovic Courtès @ 2024-04-19 14:02 UTC (permalink / raw)
To: Simon Tournier; +Cc: Leo Famulari, Guix Devel
Hi,
Simon Tournier <zimon.toutoune@gmail.com> skribis:
> On ven., 12 avril 2024 at 20:04, Leo Famulari <leo@famulari.name> wrote:
>
>>> Do you think it would be useful to package it? Or maybe to include it
>>> as another subcommand (or part of some subcommand)?
>>
>> I'd love for this to be built in to Guix. I'm often struggling to read
>> derivations while debugging or analysing something.
>
> So I propose to add the plumbing command ’derivation’. Any objection?
We should see how that fits into the set of tools we already have, in
particular the (guix derivations) interface and the REPL meta-commands.
My gut feeling, with a Schemer bias, is that we’d rather enrich the
Scheme API and/or REPL than add more commands (this is not Nix :-)).
But I don’t know, maybe we can have both?
Ludo’.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Adding plumbing subcommand 'derivation'?
2024-04-19 14:02 ` Ludovic Courtès
@ 2024-04-22 0:11 ` Simon Tournier
0 siblings, 0 replies; 9+ messages in thread
From: Simon Tournier @ 2024-04-22 0:11 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: Leo Famulari, Guix Devel
Hi,
On ven., 19 avril 2024 at 16:02, Ludovic Courtès <ludo@gnu.org> wrote:
> We should see how that fits into the set of tools we already have, in
> particular the (guix derivations) interface and the REPL meta-commands.
>
> My gut feeling, with a Schemer bias, is that we’d rather enrich the
> Scheme API and/or REPL than add more commands (this is not Nix :-)).
>
> But I don’t know, maybe we can have both?
Yes, I think that’s orthogonal and a good idea.
Maybe a new plumbing generic subcommand, as “guix inspect” or “guix
store”, where showing the fields of a derivation would be a
sub-subcommand. For instance, diffing two derivations from the
command-line seems helpful when debugging – I often do that with Emacs
exploiting buffer facilities. :-)
In addition, it could be helpful to improve the readability for the
pretty-printer. Other said, somehow redesign this:
--8<---------------cut here---------------start------------->8---
(set-record-type-printer! <derivation>
(lambda (drv port)
(format port "#<derivation ~a => ~a ~a>"
(derivation-file-name drv)
(string-join
(map (match-lambda
((_ . output)
(derivation-output-path output)))
(derivation-outputs drv)))
(number->string (object-address drv) 16))))
--8<---------------cut here---------------end--------------->8---
It looks like a plan. ;-)
Cheers,
simon
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-04-22 13:46 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-12 18:28 Guix extension to display derivation (and rewrite fixed-output) Simon Tournier
2024-04-13 0:04 ` Leo Famulari
2024-04-13 10:32 ` Adding plumbing subcommand 'derivation'? Simon Tournier
2024-04-15 18:54 ` Leo Famulari
2024-04-18 8:40 ` Ricardo Wurmus
2024-04-18 12:57 ` Christina O'Donnell
2024-04-18 13:28 ` Christina O'Donnell
2024-04-19 14:02 ` Ludovic Courtès
2024-04-22 0:11 ` Simon Tournier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.