Email or username:

Password:

Forgot your password?
Ludovic Courtès

# #Guix trick borrowed from Nix folks: the comma shell function,
# fitting in a single toot, with comments.
#
# Run then given command via 'guix shell'.
function ,
{
pkg_ver="$(set -o pipefail; guix locate "$1" | grep /bin/ | head -1 | cut -f1)"
pkg="$(echo $pkg_ver | cut -d@ -f1)"
test -n "$pkg" && guix shell "$pkg" -- "$@"
}

10 comments
Ludovic Courtès

So you can type “, supertuxkart” or “, objdump -T whatever” in your shell and it will do the right thing!

lynn
@civodul i can't tell if i love this or hate it. i think i love it though
Simon Tournier

@civodul What could be nicer: “guix run supertuxkart” or “guix run objdump -T whatever” and do all the dance under the hood.

Well, “run” or whatever other verb. :-)

This way, it would “run” with any shell.

Efraim Flashner

@zimoun @civodul
You could use guix-run instead of , so that you'd have 'guix-run supertuxkart'. That's close enough until someone makes it a guix extension

Ludovic Courtès

@efraim @zimoun Dunno, I liked the idea of a one-character function name in this context. :-)

This is where I saw it:
github.com/nix-community/comma

Simon Tournier

@civodul Well, I’m not big fan of comma… bikeshed. ;-)

That’s said, when you give a look at all the Rust… that’s more that just 3 lines of Bash. :-) Hence the opportunity for an extension.

@efraim

Pjotr Prins

@civodul checking - it is not April fools day?!

Pjotr Prins

@civodul I bet we'll use it :). It just feels a bit, ehrm, dirty. One thing it can be used for is setting up the shell environment after firing it up. Maybe useful for development services too in a guix.scm file.

Pjotr Prins

@civodul and since @wingo blogged about K8s it could help a next generation of workflows that run shell scripts today. Such as nextflow.

Go Up