Skip to content

Commit

Permalink
fix: shell init sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
blaggacao committed Feb 28, 2024
1 parent 257398d commit 66537f8
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions src/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -191,27 +191,48 @@ in {
git add . && git commit -m 'FRAPPIX START' --no-verify --allow-empty --no-gpg-sign
yarn --silent || true
)
fi
'';
in ''
${lib.concatMapStrings clone cfg.apps}
'';
deps = ["emplace-pyenv"];
};
install-pre-commit = {
text = let
install = app: ''
if (
[[ ! -f "$PRJ_ROOT/apps/${app.pname}/.git/hooks/pre-commit" ]] &&
[[ -f "$PRJ_ROOT/apps/${app.pname}/.pre-commit-config.yaml" ]]
); then
relpath="$(realpath --relative-to=`pwd` $PRJ_ROOT/apps/${app.pname})"
echo -e "\033[0;32mInstalling $relpath pre-commit hook ...\033[0m" && \
(cd $PRJ_ROOT/apps/${app.pname}; pre-commit install --install-hooks;)
fi
'';
in ''
${lib.concatMapStrings install cfg.apps}
'';
deps = ["emplace-apps"];
};
pyinstall-apps = {
text = let
install = app: ''
if [[ ! -f "$PRJ_DATA_HOME/pyenv/${sitePackagesPath}/${app.pname}.pth" ]]; then
relpath="$(realpath --relative-to=`pwd` $PRJ_ROOT/apps/${app.pname})"
if (
[[ ! -f "$PRJ_ROOT/apps/${app.pname}/.git/hooks/pre-commit" ]] &&
[[ -f "$PRJ_ROOT/apps/${app.pname}/.pre-commit-config.yaml" ]]
); then
echo -e "\033[0;32mInstalling $relpath pre-commit hook ...\033[0m" && \
(cd $PRJ_ROOT/apps/${app.pname}; pre-commit install --install-hooks;)
fi
echo -e "\033[0;32mInstalling $relpath into virtual env ...\033[0m" && \
"$PRJ_ROOT/pyenv/bin/python" -m pip install --quiet --upgrade --editable \
"$PRJ_ROOT/apps/${app.pname}" --no-cache-dir --no-dependencies
fi
'';
in ''
${lib.concatMapStrings clone cfg.apps}
${lib.concatMapStrings install cfg.apps}
'';
deps = ["emplace-pyenv"];
deps = ["emplace-apps"];
};
activate-pyenv = {
text = ''source "$PRJ_DATA_HOME/pyenv/bin/activate"'';
deps = ["emplace-apps"];
deps = ["pyinstall-apps"];
};
};
};
Expand Down

0 comments on commit 66537f8

Please sign in to comment.