diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2023-10-04 01:35:06 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2023-10-04 02:11:48 +0200 |
commit | 1a64deeb894dc95e2645a75771732c6cc53a79ad (patch) | |
tree | 1b9df4838f894577a09b9b260151756272efeb53 /nixops/Makefile | |
parent | fa25ffd4583cc362075cd5e1b4130f33306103f0 (diff) | |
download | Nix-1a64deeb894dc95e2645a75771732c6cc53a79ad.tar.gz Nix-1a64deeb894dc95e2645a75771732c6cc53a79ad.tar.zst Nix-1a64deeb894dc95e2645a75771732c6cc53a79ad.zip |
Squash changes containing private information
There were a lot of changes since the previous commit, but a lot of them
contained personnal information about users. All thos changes got
stashed into a single commit (history is kept in a different place) and
private information was moved in a separate private repository
Diffstat (limited to 'nixops/Makefile')
-rw-r--r-- | nixops/Makefile | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/nixops/Makefile b/nixops/Makefile deleted file mode 100644 index fb9da4c..0000000 --- a/nixops/Makefile +++ /dev/null | |||
@@ -1,102 +0,0 @@ | |||
1 | ifndef NIXOPS_ENV_LOADED | ||
2 | $(error "Please load environment with direnv") | ||
3 | endif | ||
4 | |||
5 | ###### Current channel information | ||
6 | nix-info: | ||
7 | @version=$$(nix eval --raw nixpkgs.lib.version) && \ | ||
8 | mainversion=$$(echo $$version | cut -d"." -f -2) && \ | ||
9 | echo "https://releases.nixos.org/nixos/$$mainversion/nixos-$$version/nixexprs.tar.xz" && \ | ||
10 | nix-instantiate --find-file nixpkgs | ||
11 | .PHONY: nix-info | ||
12 | |||
13 | ###### Initial setup | ||
14 | setup: | ||
15 | ./scripts/setup | ||
16 | .PHONY: setup | ||
17 | |||
18 | ###### Morph regular tasks | ||
19 | PROFILE=/nix/var/nix/profiles/per-user/immae/morph/immaeEu | ||
20 | TARGET ?= | ||
21 | MORPH_ARGS ?= | ||
22 | ifdef TARGET | ||
23 | # multiple targets: --on="{machine1,machine2}" (works with * glob too) | ||
24 | override MORPH_ARGS +=--on=$(TARGET) | ||
25 | endif | ||
26 | SSH_ARGS ?= | ||
27 | |||
28 | edit_env: | ||
29 | $(EDITOR) secrets/environment.nix || true | ||
30 | git -C secrets add environment.nix || true | ||
31 | git -C secrets commit -m "Edit environment.nix" environment.nix || true | ||
32 | |||
33 | edit_vars: | ||
34 | sops secrets/vars.yml || true | ||
35 | git -C secrets add vars.yml || true | ||
36 | git -C secrets commit -m "Edit password for vars.yml using sops." vars.yml || true | ||
37 | |||
38 | ssh-eldiron: | ||
39 | ./scripts/with_env bash -c 'ssh -i $$SSH_IDENTITY_FILE root@eldiron $(SSH_ARGS)' | ||
40 | |||
41 | ssh-dilion: | ||
42 | ./scripts/with_env bash -c 'ssh -i $$SSH_IDENTITY_FILE root@dilion $(SSH_ARGS)' | ||
43 | |||
44 | ssh-backup-2: | ||
45 | ./scripts/with_env bash -c 'ssh -i $$SSH_IDENTITY_FILE root@backup-2 $(SSH_ARGS)' | ||
46 | |||
47 | ssh-monitoring-1: | ||
48 | ./scripts/with_env bash -c 'ssh -i $$SSH_IDENTITY_FILE root@monitoring-1 $(SSH_ARGS)' | ||
49 | |||
50 | ssh-4c: | ||
51 | ./scripts/with_env bash -c 'ssh -i $$SSH_IDENTITY_FILE root@quatresaisons $(SSH_ARGS)' | ||
52 | |||
53 | debug: | ||
54 | ./scripts/with_env morph build --show-trace default.nix $(MORPH_ARGS) | ||
55 | |||
56 | build: | ||
57 | ./scripts/with_env morph build default.nix $(MORPH_ARGS) | ||
58 | |||
59 | dry-run: | ||
60 | ./scripts/with_env morph build --dry-run default.nix $(MORPH_ARGS) | ||
61 | |||
62 | upload: | ||
63 | ./scripts/with_env morph push default.nix $(MORPH_ARGS) | ||
64 | |||
65 | deploy: | ||
66 | ./scripts/with_env morph deploy default.nix switch --keep-result --upload-secrets $(MORPH_ARGS) | ||
67 | nix-env -p $(PROFILE) --set .gcroots/default.nix | ||
68 | |||
69 | next-boot: | ||
70 | ./scripts/with_env morph deploy default.nix boot --keep-result --upload-secrets $(MORPH_ARGS) | ||
71 | nix-env -p $(PROFILE) --set .gcroots/default.nix | ||
72 | |||
73 | deploy-reboot: | ||
74 | ./scripts/with_env morph deploy default.nix boot --reboot --upload-secrets $(MORPH_ARGS) | ||
75 | |||
76 | .PHONY: ssh-eldiron ssh-dilion ssh-monitoring-1 ssh-backup-2 debug build upload deploy deploy-reboot | ||
77 | |||
78 | ###### Cleanup generations and garbage collection | ||
79 | GEN ?= "+3" | ||
80 | |||
81 | list-generations: | ||
82 | nix-env -p $(PROFILE) --list-generations | ||
83 | $(MAKE) ssh-eldiron SSH_ARGS="nix-env -p /nix/var/nix/profiles/system --list-generations" | ||
84 | .PHONY: list-generations | ||
85 | |||
86 | delete-generations: | ||
87 | @echo "making sure that a complete build is done before cleaning up" | ||
88 | $(MAKE) build MORPH_ARGS=--keep-result | ||
89 | nix-env -p $(PROFILE) --delete-generations $(GEN) | ||
90 | $(MAKE) ssh-eldiron SSH_ARGS="nix-env -p /nix/var/nix/profiles/system --delete-generations $(GEN)" | ||
91 | $(MAKE) ssh-dilion SSH_ARGS="nix-env -p /nix/var/nix/profiles/system --delete-generations $(GEN)" | ||
92 | $(MAKE) ssh-backup-2 SSH_ARGS="nix-env -p /nix/var/nix/profiles/system --delete-generations $(GEN)" | ||
93 | $(MAKE) ssh-monitoring-1 SSH_ARGS="nix-env -p /nix/var/nix/profiles/system --delete-generations $(GEN)" | ||
94 | .PHONY: delete-generations | ||
95 | |||
96 | cleanup: delete-generations | ||
97 | nix-store --gc | ||
98 | $(MAKE) ssh-eldiron SSH_ARGS="nix-store --gc" | ||
99 | $(MAKE) ssh-dilion SSH_ARGS="nix-store --gc" | ||
100 | $(MAKE) ssh-backup-2 SSH_ARGS="nix-store --gc" | ||
101 | $(MAKE) ssh-monitoring-1 SSH_ARGS="nix-store --gc" | ||
102 | .PHONY: cleanup | ||