Skip to content

Instantly share code, notes, and snippets.

@aolwas
Last active December 9, 2024 16:51
Show Gist options
  • Save aolwas/2a285e9c816a6b75c4625f1885ee66f6 to your computer and use it in GitHub Desktop.
Save aolwas/2a285e9c816a6b75c4625f1885ee66f6 to your computer and use it in GitHub Desktop.
project-env-setup

Isolated project environment setup using direnv, pixi or mise

Requirements

Pixi

Enable pixi with direnv

create the following .envrc file in pixi workspace:

source_up .envrc
watch_file pixi.lock
eval "$(pixi shell-hook)"

First line allows loading variables set up in parent directories.

run direnv allow to enable envrc.

Setup golang project with pixi

Add golang to pixi project:

pixi add go

Update .envrc (initialize one if needed) with following lines:

export GOPATH=$CONDA_PREFIX/gopath
export PATH=$PATH:$GOPATH/bin

Mise

Enable mise with direnv

Create the following .envrc file in pixi workspace:

source_up .envrc
watch_file MISE_PROJECT_CONFIG_FILE
eval "$(mise env)"

First line allows loading variables set up in parent directories.

run direnv allow to enable envrc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment