From 11c09b3072ff4dddfe14a0becf1430296303e230 Mon Sep 17 00:00:00 2001
From: Gregor Kleen <gkleen@yggdrasil.li>
Date: Sun, 6 Jun 2021 21:59:59 +0200
Subject: only attempt to rmdir /etc/nixos if it *is* a dir

---
 system-profiles/core.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/system-profiles/core.nix b/system-profiles/core.nix
index 588f4632..14a1dae3 100644
--- a/system-profiles/core.nix
+++ b/system-profiles/core.nix
@@ -79,7 +79,7 @@ in {
     system.activationScripts.symlink-flake = ''
       if test -L /etc/nixos; then
         ln -nsf ${flake} /etc/nixos
-      elif rmdir --ignore-fail-on-non-empty /etc/nixos; then
+      elif test -d /etc/nixos && rmdir --ignore-fail-on-non-empty /etc/nixos; then
         ln -s ${flake} /etc/nixos
       fi
     '';
-- 
cgit v1.2.3