Create srv.dev-shell target in Makefile

pull/18/head
Brian Picciano 2 years ago
parent 7e87c09c50
commit dd354bc323
  1. 16
      Makefile
  2. 6
      srv-dev-env.sh
  3. 17
      srv/default.nix

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

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

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

Loading…
Cancel
Save