Fix Makefile

This commit is contained in:
Henrik Lissner 2020-01-12 20:42:17 -05:00
parent eb95f34464
commit d238824032
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -1,9 +1,12 @@
NIXOS_VERSION := 19.09 NIXOS_VERSION := 19.09
NIXOS_PREFIX := $(PREFIX)/etc/nixos NIXOS_PREFIX := $(PREFIX)/etc/nixos
NIXOS_FLAGS := -I my=$(PWD)
FLAGS := -I "my=$(PWD)" $(FLAGS)
COMMAND := test
all: channels config secrets.nix test # The real Labowski
all: channels config secrets.nix
@sudo nixos-rebuild $(FLAGS) $(COMMAND)
install: result channels update config install: result channels update config
@nixos-generate-config --root "$(PREFIX)" @nixos-generate-config --root "$(PREFIX)"
@ -12,10 +15,7 @@ install: result channels update config
upgrade: update switch upgrade: update switch
switch: switch:
@sudo nixos-rebuild $(NIXOS_FLAGS) switch @sudo nixos-rebuild $(FLAGS) switch
test:
@sudo nixos-rebuild $(NIXOS_FLAGS) test
clean: clean:
@rm -f secrets.nix @rm -f secrets.nix
@ -28,15 +28,23 @@ update:
config: $(NIXOS_PREFIX)/configuration.nix config: $(NIXOS_PREFIX)/configuration.nix
channels: channels:
sudo nix-channel --add "https://nixos.org/channels/nixos-${NIXOS_VERSION}" nixos @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://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 @sudo nix-channel --add "https://nixos.org/channels/nixpkgs-unstable" nixpkgs-unstable
$(NIXOS_PREFIX)/configuration.nix: $(NIXOS_PREFIX)/configuration.nix:
@sudo mkdir -p "$(NIXOS_PREFIX)" @sudo mkdir -p "$(NIXOS_PREFIX)"
@echo "import ../dotfiles \"$$(hostname)\"" | sudo tee "$(NIXOS_PREFIX)/configuration.nix" @echo "import $(PWD)/dotfiles \"$$(hostname)\"" | sudo tee "$(NIXOS_PREFIX)/configuration.nix"
secrets.nix: secrets.nix.gpg secrets.nix: secrets.nix.gpg
gpg -dq $< > $@ gpg -dq $< > $@
# Convenience aliases
i: install
t: test
s: switch
up: upgrade
.PHONY: update config channels test upgrade install .PHONY: update config channels test upgrade install