From 012a913fbc861029a0f4b100cfd57d3b505a455f Mon Sep 17 00:00:00 2001
From: ForeverNooob <106961997+ForeverNooob@users.noreply.github.com>
Date: Sun, 30 Oct 2022 08:13:19 +0000
Subject: [PATCH] Add doas support to the installation script.

Previously the install errored out and told you to manually add `/nix/` and set the perms if you had `doas` installed instead of `sudo`. Well, not any more!
---
 scripts/install-nix-from-closure.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/install-nix-from-closure.sh b/scripts/install-nix-from-closure.sh
index d4eed2efe80..d8931e97015 100644
--- a/scripts/install-nix-from-closure.sh
+++ b/scripts/install-nix-from-closure.sh
@@ -137,7 +137,7 @@ echo "performing a single-user installation of Nix..." >&2
 if ! [ -e "$dest" ]; then
     cmd="mkdir -m 0755 $dest && chown $USER $dest"
     echo "directory $dest does not exist; creating it by running '$cmd' using sudo" >&2
-    if ! sudo sh -c "$cmd"; then
+    if ! (sudo sh -c "$cmd" || doas sh -c "$cmd") ; then
         echo "$0: please manually run '$cmd' as root to create $dest" >&2
         exit 1
     fi
