Skip to content

Commit

Permalink
feat: floxify
Browse files Browse the repository at this point in the history
  • Loading branch information
garbas committed Sep 9, 2024
1 parent aafd979 commit 5332c76
Show file tree
Hide file tree
Showing 15 changed files with 1,518 additions and 654 deletions.
51 changes: 50 additions & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1 +1,50 @@
use flake
# Usage: use_flox [...]
#
# Loads the environment variables from a Flox envrionment
# By default, uses the ".flox" directory to load the envrionment from
# You can also specify a remote envrionment as follows
#
# ```
# use_flox --remote=<owner>/<name>
# ```
# or
# ```
# use_flox --trust --remote=<owner>/<name>
# ```
#
# Where <owner>/<name> is the name of the remote environment on FloxHub
#
# You can also specify another directory to load the environment from
#
# ```
# use_flox --dir=<path>
# ```
#
# Where <path> is the path to a directory containing a ".flox" directory
#
# Custom commands aren't supported, since we use the `flox activate` command to dump and load the environment
#
function use_flox() {
if [[ ! -d ".flox" ]]; then
printf "direnv(use_flox): \`.flox\` directory not found\n" >&2
printf "direnv(use_flox): Did you run \`flox init\` in this directory?\n" >&2
return 1
fi

echo ""
echo "Loading \`floxdocs\` environment ..."
echo ""

direnv_load flox activate "$@" -- "$direnv" dump

if [[ $# == 0 ]]; then
watch_dir ".flox/env/"
watch_file ".flox/env.json"
watch_file ".flox/env.lock"
fi
}

use_flox

watch_file "pyproject.toml"
watch_file "poetry.lock"
4 changes: 4 additions & 0 deletions .flox/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
run/
cache/
lib/
log/
4 changes: 4 additions & 0 deletions .flox/env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "floxdocs",
"version": 1
}
Loading

0 comments on commit 5332c76

Please sign in to comment.