Create srv.dev-shell target in Makefile

This commit is contained in:
Brian Picciano 2022-05-14 15:21:52 -06:00
parent 7e87c09c50
commit dd354bc323
3 changed files with 19 additions and 20 deletions

View File

@ -6,16 +6,20 @@ entrypoint:
--arg baseConfig '(import ${CONFIG})'
install:
nix-build -A install --arg baseConfig '(import ${CONFIG})'
./result
$$(nix-build -A install --arg baseConfig '(import ${CONFIG})')
test:
$$(nix-build --no-out-link -A pkgs.bash)/bin/bash test.sh
@if [ $$? == 0 ]; then echo "TESTS PASSED!"; else echo "TESTS FAILED!"; fi
$$(nix-build --no-out-link -A pkgs.bash)/bin/bash srv-dev-env.sh \
--run "cd srv/src && go test ./... -count=1 -tags integration"
@echo "\nTESTS PASSED!\n"
srv.dev-shell:
$$(nix-build --no-out-link -A pkgs.bash)/bin/bash srv-dev-env.sh \
--command "cd srv/src; return"
srv.shell:
nix-shell -A srv.shell --arg baseConfig '(import ${CONFIG})' \
--command 'cd srv; return'
nix-shell -A srv.shellWithBuild --arg baseConfig '(import ${CONFIG})' \
--command 'cd srv/src; return'
# TODO static is on the way out, these aren't well supported
static.serve:

View File

@ -24,6 +24,6 @@ while [ ! -e $test_dir/run/redis ]; do
sleep 1
done
nix-shell -A srv.test \
--arg baseConfig "$test_cfg" \
--run "cd srv/src && go test ./... -count=1 -tags integration"
nix-shell -A srv.shell \
--arg baseConfig "$test_cfg" \
"$@"

View File

@ -52,18 +52,13 @@
shell = stdenv.mkDerivation {
name = "mediocre-blog-srv-shell";
buildInputs = [ go build ];
shellHook = ''
source ${init}
cd src
'';
buildInputs = [ go ];
shellHook = ''source ${init}'';
};
test = stdenv.mkDerivation {
name = "mediocre-blog-srv-test";
buildInputs = [ go ];
shellHook = ''
source ${init}
'';
shellWithBuild = stdenv.mkDerivation {
name = "mediocre-blog-srv-shell-with-build";
buildInputs = [ go build ];
shellHook = ''source ${init}'';
};
}