X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=nixops%2FMakefile;h=c5216829862c4c27bca76605bb4052611428c494;hb=7ff0f7be4890ffd5d6af614fcade3d64eaa66ffc;hp=6087402690961068b4a6a635967f92b34805a1b2;hpb=af3aeef298d176c4f01ef341bf9662dd362834e5;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/nixops/Makefile b/nixops/Makefile index 6087402..c521682 100644 --- a/nixops/Makefile +++ b/nixops/Makefile @@ -5,8 +5,10 @@ endif NIXOPS_STATE ?= ./state/eldiron.nixops NIXOPS_DEPLOYMENT = cef694f3-081d-11e9-b31f-0242ec186adf -nixpkgs ?= https://releases.nixos.org/nixos/19.03/nixos-19.03.172754.0728c3e026e/nixexprs.tar.xz -NIX_PATH = nixpkgs=${nixpkgs}:nixpkgsNext=${nixpkgs}:nixpkgsPrevious=${nixpkgs} +nixpkgs ?= $(shell cat ../nix/sources.json | jq -r '."nixpkgs-nixops".url') +nixpkgsNext ?= $(shell cat ../nix/sources.json | jq -r '."nixpkgs-nixops-next".url') +nixpkgsPrevious ?= $(shell cat ../nix/sources.json | jq -r '."nixpkgs-nixops-previous".url') +NIX_PATH = nixpkgs=${nixpkgs}:nixpkgsNext=${nixpkgsNext}:nixpkgsPrevious=${nixpkgsPrevious} NIXOPS := $(shell NIX_PATH=$(NIX_PATH) nix-build --no-out-link -E "with import { overlays = builtins.attrValues (import ../overlays); }; nixops")/bin/nixops NIXOPS_PRIV = ./scripts/with_env $(NIXOPS) @@ -25,38 +27,52 @@ setup: .PHONY: setup ###### Nixops regular tasks +TARGET ?= NIXOPS_ARGS ?= +ifdef TARGET + override NIXOPS_ARGS +=--include=$(TARGET) +endif +SSH_ARGS ?= + nixops: $(NIXOPS_PRIV) $(NIXOPS_ARGS) -SSH_ARGS ?= ssh-eldiron: $(NIXOPS_PRIV) ssh eldiron -- $(SSH_ARGS) +ssh-dilion: + $(NIXOPS_PRIV) ssh dilion -- $(SSH_ARGS) + +ssh-backup-2: + $(NIXOPS_PRIV) ssh backup-2 -- $(SSH_ARGS) + +ssh-monitoring-1: + $(NIXOPS_PRIV) ssh monitoring-1 -- $(SSH_ARGS) + info: $(NIXOPS_PRIV) list $(NIXOPS_PRIV) info debug: - $(NIXOPS_PRIV) deploy --build-only --show-trace + $(NIXOPS_PRIV) deploy --build-only --show-trace $(NIXOPS_ARGS) dry-run: - $(NIXOPS_PRIV) deploy --dry-run + $(NIXOPS_PRIV) deploy --dry-run $(NIXOPS_ARGS) build: - $(NIXOPS_PRIV) deploy --build-only + $(NIXOPS_PRIV) deploy --build-only $(NIXOPS_ARGS) upload: - $(NIXOPS_PRIV) deploy --copy-only + $(NIXOPS_PRIV) deploy --copy-only $(NIXOPS_ARGS) deploy: - $(NIXOPS_PRIV) deploy + $(NIXOPS_PRIV) deploy $(NIXOPS_ARGS) deploy-reboot: - $(NIXOPS_PRIV) deploy --force-reboot + $(NIXOPS_PRIV) deploy --force-reboot $(NIXOPS_ARGS) reboot: - $(NIXOPS_PRIV) reboot --include=eldiron + $(NIXOPS_PRIV) reboot --include=$(TARGET) .PHONY: nixops ssh-eldiron info debug dry-run build upload deploy deploy-reboot reboot ###### Cleanup generations and garbage collection @@ -71,11 +87,17 @@ list-generations: delete-generations: nix-env -p $(profile) --delete-generations $(GEN) $(NIXOPS_PRIV) ssh eldiron -- nix-env -p /nix/var/nix/profiles/system --delete-generations $(GEN) + $(NIXOPS_PRIV) ssh dilion -- nix-env -p /nix/var/nix/profiles/system --delete-generations $(GEN) + $(NIXOPS_PRIV) ssh backup-2 -- nix-env -p /nix/var/nix/profiles/system --delete-generations $(GEN) + $(NIXOPS_PRIV) ssh monitoring-1 -- nix-env -p /nix/var/nix/profiles/system --delete-generations $(GEN) .PHONY: delete-generations cleanup: delete-generations nix-store --gc $(NIXOPS_PRIV) ssh eldiron -- nix-store --gc + $(NIXOPS_PRIV) ssh dilion -- nix-store --gc + $(NIXOPS_PRIV) ssh backup-2 -- nix-store --gc + $(NIXOPS_PRIV) ssh monitoring-1 -- nix-store --gc .PHONY: cleanup ###### Pull environment and deployment from remote