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