Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ fi
use flake
PATH_add bin
dotenv ./.env
if [ -f ./bin/completion ]; then
source ./bin/completion
fi
watch_dir bin
watch_dir nix
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
help: ## Display this help screen
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

SHELL := /bin/bash
BIN_DIR := bin
API_NAME := acmcsuf-api
CLI_NAME := acmcsuf-cli
Expand Down Expand Up @@ -31,6 +32,8 @@ build: generate ## Build the api and cli binaries
@mkdir -p $(BIN_DIR)
go build -ldflags "-X main.Version=$(VERSION)" -o $(BIN_DIR)/$(API_NAME) ./cmd/$(API_NAME)
go build -ldflags "-X cli.Version=$(VERSION)" -o $(BIN_DIR)/$(CLI_NAME) ./cmd/$(CLI_NAME)
cd $(BIN_DIR) && ./$(CLI_NAME) completion bash > completion
chmod +x $(BIN_DIR)/completion

vet: ## Vet all go files
go vet ./...
Expand Down
21 changes: 20 additions & 1 deletion nix/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
go-swag,
cobra-cli,
go-tools,
bash,
bash-completion,
}:
mkShell {
packages = [
Expand All @@ -29,9 +31,26 @@ mkShell {
jq
go-swag
cobra-cli
];
bash
bash-completion
];

shellHook = ''
# Shell auto complete
source ${bash-completion}/etc/profile.d/bash_completion.sh

if [ ! -d bin ]; then
mkdir bin # Nix blows up if bin isnt here
fi

COMPLETION_FILE=./bin/completion
if [ -f "$COMPLETION_FILE" ]; then
source "$COMPLETION_FILE"
else
echo "Note: Your cli has no autocomplete, remember to source completion in ./bin or restart the shell when it is generated!"
fi


export CGO_ENABLED=0 # cgo compiler flags cause issues with delve when using Nix
if [ ! -f .env ]; then
echo ".env file not found! Creating one from .env.example for you..."
Expand Down