diff options
author | Kenny Ballou <kb@devnulllabs.io> | 2022-03-30 11:31:09 -0600 |
---|---|---|
committer | Kenny Ballou <kb@devnulllabs.io> | 2022-03-30 11:48:58 -0600 |
commit | fd2a9bfd37b2e0674484644a56cec3239cce71aa (patch) | |
tree | 4c0ffa57a2f7374a323a925d7d9885e661956c3e /config/direnv | |
parent | 9dc0dd0d8b4ed3b3999e61d71a3f3662862f43cc (diff) | |
download | dotfiles-fd2a9bfd37b2e0674484644a56cec3239cce71aa.tar.gz dotfiles-fd2a9bfd37b2e0674484644a56cec3239cce71aa.tar.xz |
config: direnv: customize use_guix behavior
If specific files are in the directory, use them as part of the exported
`guix shell`.
Signed-off-by: Kenny Ballou <kb@devnulllabs.io>
Diffstat (limited to 'config/direnv')
-rwxr-xr-x | config/direnv/direnvrc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/config/direnv/direnvrc b/config/direnv/direnvrc new file mode 100755 index 00000000..05e03a5b --- /dev/null +++ b/config/direnv/direnvrc @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +function use_guix() { + if [[ -f channels.scm ]]; then + echo 2> "Using Guix version from channels.scm" + export GUIX_ENVIRONMENT=$(guix time-machine --channels ./channels.scm -- shell -- bash -c 'echo ${GUIX_ENVIRONMENT}') + eval "$(guix time-machine --channels ./channels.scm -- shell ${FLAGS} --search-paths)" + else + echo "${FLAGS}" + export GUIX_ENVIRONMENT=$(guix shell -- bash -c 'echo ${GUIX_ENVIRONMENT}') + eval "$(guix shell --search-paths)" + fi +} |