mirror of
https://github.com/LnL7/nix-darwin.git
synced 2024-12-14 11:57:34 +00:00
Merge pull request #741 from Enzime/default-flake-location
Set default flake directory as `/etc/nix-darwin`
This commit is contained in:
commit
5ce8503cf4
1 changed files with 14 additions and 2 deletions
|
@ -11,8 +11,8 @@ showSyntax() {
|
||||||
echo " [-Q] [{--max-jobs | -j} number] [--cores number] [--dry-run]" >&2
|
echo " [-Q] [{--max-jobs | -j} number] [--cores number] [--dry-run]" >&2
|
||||||
echo " [--keep-going] [-k] [--keep-failed] [-K] [--fallback] [--show-trace]" >&2
|
echo " [--keep-going] [-k] [--keep-failed] [-K] [--fallback] [--show-trace]" >&2
|
||||||
echo " [-I path] [--option name value] [--arg name value] [--argstr name value]" >&2
|
echo " [-I path] [--option name value] [--arg name value] [--argstr name value]" >&2
|
||||||
echo " [--flake flake] [--update-input input flake] [--impure] [--recreate-lock-file]" >&2
|
echo " [--flake flake] [--no-flake] [--update-input input flake] [--impure]" >&2
|
||||||
echo " [--no-update-lock-file] [--refresh]" >&2
|
echo " [--recreate-lock-file] [--no-update-lock-file] [--refresh]" >&2
|
||||||
echo " [--offline] [--substituters substituters-list] ..." >&2
|
echo " [--offline] [--substituters substituters-list] ..." >&2
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ extraProfileFlags=()
|
||||||
profile=@profile@
|
profile=@profile@
|
||||||
action=
|
action=
|
||||||
flake=
|
flake=
|
||||||
|
noFlake=
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
i=$1; shift 1
|
i=$1; shift 1
|
||||||
|
@ -77,6 +78,9 @@ while [ $# -gt 0 ]; do
|
||||||
flake=$1
|
flake=$1
|
||||||
shift 1
|
shift 1
|
||||||
;;
|
;;
|
||||||
|
--no-flake)
|
||||||
|
noFlake=1
|
||||||
|
;;
|
||||||
-L|-vL|--print-build-logs|--impure|--recreate-lock-file|--no-update-lock-file|--no-write-lock-file|--no-registries|--commit-lock-file|--refresh)
|
-L|-vL|--print-build-logs|--impure|--recreate-lock-file|--no-update-lock-file|--no-write-lock-file|--no-registries|--commit-lock-file|--refresh)
|
||||||
extraLockFlags+=("$i")
|
extraLockFlags+=("$i")
|
||||||
;;
|
;;
|
||||||
|
@ -137,6 +141,14 @@ if [ -z "$action" ]; then showSyntax; fi
|
||||||
|
|
||||||
flakeFlags=(--extra-experimental-features 'nix-command flakes')
|
flakeFlags=(--extra-experimental-features 'nix-command flakes')
|
||||||
|
|
||||||
|
# Use /etc/nix-darwin/flake.nix if it exists. It can be a symlink to the
|
||||||
|
# actual flake.
|
||||||
|
if [[ -z $flake && -e /etc/nix-darwin/flake.nix && -z $noFlake ]]; then
|
||||||
|
flake="$(dirname "$(readlink -f /etc/nix-darwin/flake.nix)")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For convenience, use the hostname as the default configuration to
|
||||||
|
# build from the flake.
|
||||||
if [ -n "$flake" ]; then
|
if [ -n "$flake" ]; then
|
||||||
# Offical regex from https://www.rfc-editor.org/rfc/rfc3986#appendix-B
|
# Offical regex from https://www.rfc-editor.org/rfc/rfc3986#appendix-B
|
||||||
if [[ "${flake}" =~ ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))? ]]; then
|
if [[ "${flake}" =~ ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))? ]]; then
|
||||||
|
|
Loading…
Reference in a new issue