Files
nix-config/Makefile
2024-02-19 20:23:08 -05:00

35 lines
800 B
Makefile

SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
HOSTNAME ?= $(shell hostname)
UNAME_S := $(shell uname -s)
export NIXPKGS_ALLOW_UNFREE := 1
ifeq ($(UNAME_S),Linux)
SWITCH_CMD := nixos-rebuild --use-remote-sudo -I nixos-config="modules/machines/$(HOSTNAME)/configuration.nix" switch --flake '.\#' \
--impure
endif
ifeq ($(UNAME_S),Darwin)
SWITCH_CMD := exec darwin-rebuild switch --flake .
endif
switch:
$(SWITCH_CMD)
rollback:
nixos-rebuild --use-remote-sudo switch --rollback -I nixos-config="modules/machines/$(HOSTNAME)/configuration.nix"
update:
nix flake update
make
git add .
git commit -S -m "nix flake update: $$(TZ=UTC date '+%Y-%m-%d %H:%M:%S %Z')"
git push
fmt:
alejandra .