42 lines
913 B
Nix
42 lines
913 B
Nix
{ pkgs, ... }:
|
|
|
|
{
|
|
# https://devenv.sh/basics/
|
|
env.NAME = "cmd";
|
|
|
|
# https://devenv.sh/packages/
|
|
packages = with pkgs; [
|
|
git
|
|
gotest
|
|
];
|
|
|
|
# https://devenv.sh/scripts/
|
|
scripts.welcome-banner.exec = ''
|
|
echo "Welcome to the $NAME development environment."
|
|
echo -n "Golang version: $(go version | cut -d ' ' -f 3), "
|
|
'';
|
|
|
|
scripts.test.exec = ''
|
|
gotest ./...
|
|
'';
|
|
|
|
scripts.cover.exec = ''
|
|
go test -race -cover -covermode=atomic -coverprofile=coverage.out ./...
|
|
go tool cover -html=coverage.out -o=coverage.html
|
|
open coverage.html
|
|
'';
|
|
|
|
enterShell = "welcome-banner";
|
|
|
|
# https://devenv.sh/languages/
|
|
languages.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";
|
|
|
|
# See full reference at https://devenv.sh/reference/options/
|
|
}
|