#!/usr/bin/env bash

# omarchy:summary=Install Nix, the package manager, with its daemon
# omarchy:requires-sudo=true

# Based: Nix's own installer, in multi-user mode on Debian; on macOS it
# creates the /nix volume and the launchd daemon itself.

set -eo pipefail

if [[ -e /nix/var/nix/gc.lock ]]; then
  echo "Nix is already installed"
else
  echo "Installing Nix..."
  case $(omarchy-os) in
  darwin) curl -L https://nixos.org/nix/install | sh ;;
  *) curl -L https://nixos.org/nix/install | sh -s -- --daemon ;;
  esac
fi

omarchy-code-extensions bbenoist.nix
