{ 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 = '' set -euo pipefail if [ -n "$(git status --porcelain)" ]; then printf "Working directory is not clean. Please commit or stash your changes.\n" exit 1 fi version="$(git cliff --bumped-version)" changelog=$(git cliff --unreleased --strip all | sed -e '/^#/d' -e '/^$/d') git cliff --bump --unreleased --prepend $CHANGELOG_FILE git add $CHANGELOG_FILE git commit -m "chore(release): release $version" git tag "$version" -m "Release $version" -m "$changelog" 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/ }