Switch to a Makefile

This commit is contained in:
Dave Gallant
2021-10-26 22:06:47 -04:00
parent fe1a2654b6
commit 68de2e924b
4 changed files with 33 additions and 33 deletions

21
Makefile Normal file
View File

@@ -0,0 +1,21 @@
SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
HOSTAME ?= $(shell hostname)
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
SWITCH_CMD := sudo nixos-rebuild -I nixos-config="machines/$(HOSTNAME)/configuration.nix" switch --flake '.\#'
endif
ifeq ($(UNAME_S),Darwin)
SWITCH_CMD := exec darwin-rebuild switch --flake .
endif
switch:
$(SWITCH_CMD)
update:
nix flake update