From e8f2ad8304310f7ddbd79da3a649d4b16e067478 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Sun, 17 Feb 2019 14:16:21 -0800 Subject: Create makefile More flexible than a script --- Makefile | 16 ++++++++++++++++ README.md | 11 ++++++++--- deploy.sh | 14 -------------- 3 files changed, 24 insertions(+), 17 deletions(-) create mode 100644 Makefile delete mode 100755 deploy.sh diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7b938e8 --- /dev/null +++ b/Makefile @@ -0,0 +1,16 @@ +HOST = root@simatime.com +OUT = $(shell readlink -n ./result) + +result: + nix-build --attr system ./nixos.nix + +copy: result + nix copy --to "ssh://$(USER)@$(HOST)" ./result + +switch: + ssh $(USER)@$(HOST) sudo "$(OUT)/bin/switch-to-configuration" switch + +clean: FORCE + rm -f ./result + +.PHONY: FORCE diff --git a/README.md b/README.md index a093a45..60845a2 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,16 @@ To build the production server config locally: - nix-build --attr system ./nixos.nix + make clean result -To deploy (will ask for ssh passphrase 2x): +To push the built closure and switch to the new configuration (will ask for ssh +passphrase 2x): - ./deploy.sh + make copy switch + +A quick deploy can be just: + + make clean copy switch When that damn bug gets fixed, we could just do: diff --git a/deploy.sh b/deploy.sh deleted file mode 100755 index 096b205..0000000 --- a/deploy.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -echo ":: Cleaning" -rm -f ./result - -echo ":: Building" -nix-build --attr system ./nixos.nix - -echo ":: Copying" -nix copy --to "ssh://root@simatime.com" ./result - -echo ":: Switching" -path=$(readlink -n ./result) -ssh root@simatime.com sudo "$path/bin/switch-to-configuration" switch -- cgit v1.2.3