2020-01-12 15:17:45 -08:00
|
|
|
NIXOS_VERSION := 19.09
|
|
|
|
NIXOS_PREFIX := $(PREFIX)/etc/nixos
|
|
|
|
|
2020-01-12 17:42:17 -08:00
|
|
|
FLAGS := -I "my=$(PWD)" $(FLAGS)
|
|
|
|
COMMAND := test
|
2020-01-12 15:17:45 -08:00
|
|
|
|
2020-01-12 17:42:17 -08:00
|
|
|
# The real Labowski
|
|
|
|
all: channels config secrets.nix
|
|
|
|
@sudo nixos-rebuild $(FLAGS) $(COMMAND)
|
2020-01-12 15:17:45 -08:00
|
|
|
|
|
|
|
install: result channels update config
|
|
|
|
@nixos-generate-config --root "$(PREFIX)"
|
|
|
|
@nixos-install --root "$(PREFIX)"
|
|
|
|
|
2020-01-13 14:57:52 -08:00
|
|
|
install-linode: result channels update
|
|
|
|
@sudo mkdir -p "$(NIXOS_PREFIX)"
|
|
|
|
@echo "(import $(PWD)/dotfiles \"linode\") \"$$(hostname)\"" | sudo tee "$(NIXOS_PREFIX)/configuration.nix"
|
|
|
|
|
2020-01-12 15:17:45 -08:00
|
|
|
upgrade: update switch
|
|
|
|
|
|
|
|
switch:
|
2020-01-12 17:42:17 -08:00
|
|
|
@sudo nixos-rebuild $(FLAGS) switch
|
2020-01-12 15:17:45 -08:00
|
|
|
|
2020-01-13 15:07:59 -08:00
|
|
|
gc:
|
|
|
|
@nix-collect-garbage -d
|
|
|
|
|
2020-01-12 15:17:45 -08:00
|
|
|
clean:
|
2020-01-13 15:14:26 -08:00
|
|
|
@rm -f secrets.nix result
|
2020-01-12 15:17:45 -08:00
|
|
|
|
|
|
|
|
|
|
|
# Parts
|
|
|
|
update:
|
|
|
|
@sudo nix-channel --update
|
|
|
|
|
|
|
|
config: $(NIXOS_PREFIX)/configuration.nix
|
|
|
|
|
|
|
|
channels:
|
2020-01-12 17:42:17 -08:00
|
|
|
@sudo nix-channel --add "https://nixos.org/channels/nixos-${NIXOS_VERSION}" nixos
|
|
|
|
@sudo nix-channel --add "https://github.com/rycee/home-manager/archive/release-${NIXOS_VERSION}.tar.gz" home-manager
|
|
|
|
@sudo nix-channel --add "https://nixos.org/channels/nixpkgs-unstable" nixpkgs-unstable
|
2020-01-12 15:17:45 -08:00
|
|
|
|
|
|
|
$(NIXOS_PREFIX)/configuration.nix:
|
|
|
|
@sudo mkdir -p "$(NIXOS_PREFIX)"
|
2020-01-12 17:42:17 -08:00
|
|
|
@echo "import $(PWD)/dotfiles \"$$(hostname)\"" | sudo tee "$(NIXOS_PREFIX)/configuration.nix"
|
2020-01-12 15:17:45 -08:00
|
|
|
|
|
|
|
secrets.nix: secrets.nix.gpg
|
2020-01-13 15:14:08 -08:00
|
|
|
@nix-shell -p gnupg --run "gpg -dq $< > $@"
|
2020-01-12 15:17:45 -08:00
|
|
|
|
2020-01-12 17:42:17 -08:00
|
|
|
|
|
|
|
# Convenience aliases
|
|
|
|
i: install
|
|
|
|
t: test
|
|
|
|
s: switch
|
|
|
|
up: upgrade
|
|
|
|
|
|
|
|
|
2020-01-12 15:17:45 -08:00
|
|
|
.PHONY: update config channels test upgrade install
|