]> Git — Sourcephile - sourcephile-nix.git/blob - .lib/nixops/Makefile.make
gitolite: update
[sourcephile-nix.git] / .lib / nixops / Makefile.make
1 #
2 ## vmdk
3 ###
4 nixops-vmdk: $(dir $(NIXOPS_STATE))/virtualbox/nixops.vmdk
5 .PHONY: $(dir $(NIXOPS_STATE))/virtualbox/nixops.vmdk
6 $(dir $(NIXOPS_STATE))/virtualbox/nixops.vmdk:
7 # NOTE: user's TMPDIR may be too small
8 TMPDIR=/tmp \
9 time nix $(NIX_FLAGS) build \
10 --out-link .cache/nixops/virtualbox \
11 --argstr system x86_64-linux \
12 -f "<nixpkgs-commonsoft/build/pkgs/installer/nixops-virtualbox>"
13
14 #
15 ## create
16 ###
17 nixops-create: $(dir $(NIXOPS_STATE))
18 $(if $(filter $(NIXOPS_DEPLOYMENT),$(nixops-deployment)),,\
19 nixops create \
20 $(NIXOPS_CREATE) \
21 install/logical.nix \
22 install/physical.nix)
23 nixops-modify: $(NIXOPS_STATE)
24 nixops modify \
25 $(NIXOPS_MODIFY) \
26 install/logical.nix \
27 install/physical.nix
28 $(dir $(NIXOPS_STATE)):
29 mkdir -p $@
30 nixops-deployment = $(shell \
31 test ! -f $(NIXOPS_STATE) || \
32 sqlite3 $(NIXOPS_STATE) \
33 "select value from DeploymentAttrs \
34 where name='name' and value='$(NIXOPS_DEPLOYMENT)';")
35
36 #
37 ## deploy
38 ###
39 nixops-deploy: nixops-create
40 sudo modprobe vboxnetadp
41 sudo modprobe vboxnetflt
42 time nixops deploy $(NIXOPS_OPTS) $(NIX_DEPLOY_FLAGS)
43 #TMPDIR=/tmp \
44 #time disnixos-env --use-nixops \
45 # -s install/disnix/services.nix \
46 # -d install/disnix/distribution.nix \
47 # -n install/logical.nix \
48 # -n install/physical.nix
49 %/offline: NIX_BUILD_FLAGS+=--option substituters ""
50 %/offline: NIX_DEPLOY_FLAGS+=--option substituters ""
51 %/offline: %
52
53 %/verbose: NIX_FLAGS+=-v -v -v
54 %/verbose: %
55
56
57 nixops-stop:
58 nixops stop
59
60 #
61 ## state
62 ###
63 nixops-state-dump: $(NIXOPS_STATE)
64 sqlite3 $(NIXOPS_STATE) .dump
65 nixops-privateIpv4:
66 sqlite3 $(NIXOPS_STATE) \
67 'update ResourceAttrs set value = "$(IPv4)" where name="privateIpv4"'