diff options
Diffstat (limited to 'nixops/Makefile')
-rw-r--r-- | nixops/Makefile | 37 |
1 files changed, 8 insertions, 29 deletions
diff --git a/nixops/Makefile b/nixops/Makefile index c521682..a7b24cd 100644 --- a/nixops/Makefile +++ b/nixops/Makefile | |||
@@ -1,8 +1,5 @@ | |||
1 | export | 1 | export |
2 | ifndef NIXOPS_CONFIG_PASS_SUBTREE_PATH | 2 | PASSWORD_STORE_DIR = $(shell pwd)/secrets |
3 | $(error Please set NIXOPS_CONFIG_PASS_SUBTREE_PATH to the password-store subtree path) | ||
4 | endif | ||
5 | |||
6 | NIXOPS_STATE ?= ./state/eldiron.nixops | 3 | NIXOPS_STATE ?= ./state/eldiron.nixops |
7 | NIXOPS_DEPLOYMENT = cef694f3-081d-11e9-b31f-0242ec186adf | 4 | NIXOPS_DEPLOYMENT = cef694f3-081d-11e9-b31f-0242ec186adf |
8 | nixpkgs ?= $(shell cat ../nix/sources.json | jq -r '."nixpkgs-nixops".url') | 5 | nixpkgs ?= $(shell cat ../nix/sources.json | jq -r '."nixpkgs-nixops".url') |
@@ -34,6 +31,9 @@ ifdef TARGET | |||
34 | endif | 31 | endif |
35 | SSH_ARGS ?= | 32 | SSH_ARGS ?= |
36 | 33 | ||
34 | edit_env: | ||
35 | pass edit Nixops/files/environment.nix || true | ||
36 | |||
37 | nixops: | 37 | nixops: |
38 | $(NIXOPS_PRIV) $(NIXOPS_ARGS) | 38 | $(NIXOPS_PRIV) $(NIXOPS_ARGS) |
39 | 39 | ||
@@ -101,17 +101,6 @@ cleanup: delete-generations | |||
101 | .PHONY: cleanup | 101 | .PHONY: cleanup |
102 | 102 | ||
103 | ###### Pull environment and deployment from remote | 103 | ###### Pull environment and deployment from remote |
104 | # Don't include pull_deployment by default as this should happen only rarely | ||
105 | pull: pull_environment; | ||
106 | .PHONY: pull | ||
107 | |||
108 | pull_environment: | ||
109 | ifndef NIXOPS_CONFIG_PASS_SUBTREE_REMOTE | ||
110 | $(error "Please set NIXOPS_CONFIG_PASS_SUBTREE_REMOTE to the password-store subtree remote name") | ||
111 | endif | ||
112 | pass git subtree pull --prefix=$(NIXOPS_CONFIG_PASS_SUBTREE_PATH) $(NIXOPS_CONFIG_PASS_SUBTREE_REMOTE) master | ||
113 | .PHONY: pull_environment | ||
114 | |||
115 | pull_deployment: | 104 | pull_deployment: |
116 | @if $(NIXOPS) info -d $(NIXOPS_DEPLOYMENT) 2>/dev/null >/dev/null ; then \ | 105 | @if $(NIXOPS) info -d $(NIXOPS_DEPLOYMENT) 2>/dev/null >/dev/null ; then \ |
117 | echo "This will remove your current deployment file and recreate it!. Continue? [y/N]" && \ | 106 | echo "This will remove your current deployment file and recreate it!. Continue? [y/N]" && \ |
@@ -119,7 +108,7 @@ pull_deployment: | |||
119 | [ "$$y" = "y" -o "$$y" = "Y" ] && \ | 108 | [ "$$y" = "y" -o "$$y" = "Y" ] && \ |
120 | $(NIXOPS) delete --force -d $(NIXOPS_DEPLOYMENT); \ | 109 | $(NIXOPS) delete --force -d $(NIXOPS_DEPLOYMENT); \ |
121 | fi | 110 | fi |
122 | pass show $(NIXOPS_CONFIG_PASS_SUBTREE_PATH)/Nixops/Deployment | $(NIXOPS) import | 111 | pass show Nixops/Deployment | $(NIXOPS) import |
123 | $(NIXOPS) modify -d $(NIXOPS_DEPLOYMENT) "$$(pwd)/default.nix" | 112 | $(NIXOPS) modify -d $(NIXOPS_DEPLOYMENT) "$$(pwd)/default.nix" |
124 | .PHONY: pull_deployment | 113 | .PHONY: pull_deployment |
125 | 114 | ||
@@ -127,17 +116,7 @@ deployment_is_set: | |||
127 | $(NIXOPS) info -d $(NIXOPS_DEPLOYMENT) 2>/dev/null >/dev/null | 116 | $(NIXOPS) info -d $(NIXOPS_DEPLOYMENT) 2>/dev/null >/dev/null |
128 | .PHONY: deployment_is_set | 117 | .PHONY: deployment_is_set |
129 | 118 | ||
130 | ###### Push environment and deployment information to password store | 119 | ###### Push deployment information to password store |
131 | push: push_deployment push_environment; | ||
132 | .PHONY: push | ||
133 | |||
134 | push_deployment: | 120 | push_deployment: |
135 | $(NIXOPS) export | pass insert -m $(NIXOPS_CONFIG_PASS_SUBTREE_PATH)/Nixops/Deployment | 121 | $(NIXOPS) export | pass insert -m Nixops/Deployment |
136 | .PHONY: push_deployment | 122 | .PHONY: push |
137 | |||
138 | push_environment: | ||
139 | ifndef NIXOPS_CONFIG_PASS_SUBTREE_REMOTE | ||
140 | $(error "Please set NIXOPS_CONFIG_PASS_SUBTREE_REMOTE to the password-store subtree remote name") | ||
141 | endif | ||
142 | pass git subtree push --prefix=$(NIXOPS_CONFIG_PASS_SUBTREE_PATH) $(NIXOPS_CONFIG_PASS_SUBTREE_REMOTE) master | ||
143 | .PHONY: push_environment | ||