65 lines
1.5 KiB
Nix
65 lines
1.5 KiB
Nix
{ pkgs, ... }:
|
|
|
|
{
|
|
# https://devenv.sh/basics/
|
|
env = {
|
|
PROJECT_NAME = "go-twitch";
|
|
|
|
MOCK_DATA_PATH = "~/.config/twitch-cli/eventCache.db";
|
|
MOCK_API_PORT = "3000";
|
|
|
|
CHANGELOG_FILE = "CHANGELOG.md";
|
|
};
|
|
|
|
# https://devenv.sh/packages/
|
|
packages = with pkgs; [
|
|
git
|
|
git-cliff
|
|
twitch-cli
|
|
];
|
|
|
|
# https://devenv.sh/scripts/
|
|
scripts = {
|
|
welcome-banner.exec = ''
|
|
echo "Welcome to the $PROJECT_NAME development environment."
|
|
echo "Golang version: $(go version | cut -d ' ' -f 3)"
|
|
'';
|
|
|
|
gen-changelog.exec = "git cliff -o $CHANGELOG_FILE";
|
|
release.exec = ''
|
|
version="$(git cliff --bumped-version)"
|
|
git cliff --bump --unreleased -o $CHANGELOG_FILE
|
|
git add $CHANGELOG_FILE
|
|
git commit -m "chore(release): release $version"
|
|
git tag "$version" -m "Release $version"
|
|
git push --tags
|
|
'';
|
|
|
|
gen-mock-data.exec = "twitch-cli mock-api generate";
|
|
rm-mock-data.exec = "rm $MOCK_DATA_PATH";
|
|
start-mock-api.exec = "twitch-cli mock-api start -p $MOCK_API_PORT";
|
|
};
|
|
|
|
enterShell = "welcome-banner";
|
|
|
|
# https://devenv.sh/languages/
|
|
languages = {
|
|
nix.enable = true;
|
|
go.enable = true;
|
|
};
|
|
|
|
# https://devenv.sh/pre-commit-hooks/
|
|
# pre-commit.hooks.shellcheck.enable = true;
|
|
|
|
# https://devenv.sh/processes/
|
|
# processes.ping.exec = "ping example.com";
|
|
process.before = ''
|
|
if [ ! -f $MOCK_DATA_PATH ]; then
|
|
gen-mock-data
|
|
fi
|
|
'';
|
|
processes.mock-api.exec = "start-mock-api";
|
|
|
|
# See full reference at https://devenv.sh/reference/options/
|
|
}
|