50 lines
1.1 KiB
Nix
50 lines
1.1 KiB
Nix
{ pkgs, ... }:
|
|
|
|
{
|
|
# https://devenv.sh/basics/
|
|
env.PROJECT_NAME = "go-twitch";
|
|
|
|
env.MOCK_DATA_PATH = "~/.config/twitch-cli/eventCache.db";
|
|
env.MOCK_API_PORT = "3000";
|
|
|
|
# https://devenv.sh/packages/
|
|
packages = with pkgs; [
|
|
git
|
|
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-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/
|
|
}
|