nix: throw error if 'make nix-purge' is called on NixOS

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2020-01-24 14:46:46 +01:00
parent 30545f77d2
commit 5a64745fce
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
1 changed files with 7 additions and 0 deletions

View File

@ -54,6 +54,9 @@ export NIX_IGNORE_SYMLINK_STORE=1
export _NIX_ROOT = /opt/nix
endif
# Useful for checking if we are on NixOS
OS_NAME = $(shell grep -oP '^NAME=\K\w(.*)' /etc/os-release)
#----------------
# Nix targets
#----------------
@ -80,7 +83,11 @@ nix-clean: ##@nix Remove all status-react build artifacts from /nix/store
nix-purge: SHELL := /bin/sh
nix-purge: ##@nix Completely remove the complete Nix setup
ifeq ($(OS_NAME), NixOS)
$(error $(RED)You should not purge Nix files on NixOS!$(RESET))
else
sudo rm -rf $(_NIX_ROOT)/* ~/.nix-profile ~/.nix-defexpr ~/.nix-channels ~/.cache/nix ~/.status .nix-gcroots
endif
nix-add-gcroots: export TARGET := default
nix-add-gcroots: ##@nix Add Nix GC roots to avoid status-react expressions being garbage collected