Merge pull request #600 from konradmalik/uri-builder-fix

fix: add '://' to built flake uri
This commit is contained in:
Domen Kožar 2023-04-29 14:58:27 +02:00 committed by GitHub
commit 379d42fad6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View file

@ -114,3 +114,7 @@ jobs:
darwin-rebuild build \
--flake /tmp/test-nix-darwin-submodules?submodules=1#simple \
--override-input darwin .
# Should also succeed
darwin-rebuild build \
--flake git+file:///tmp/test-nix-darwin-submodules?submodules=1#simple \
--override-input darwin .

View file

@ -123,9 +123,9 @@ flakeFlags=(--extra-experimental-features 'nix-command flakes')
if [ -n "$flake" ]; then
# Offical regex from https://www.rfc-editor.org/rfc/rfc3986#appendix-B
if [[ "${flake}" =~ ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))? ]]; then
scheme=${BASH_REMATCH[2]}
authority=${BASH_REMATCH[4]}
path=${BASH_REMATCH[5]}
scheme=${BASH_REMATCH[1]} # eg. http:
authority=${BASH_REMATCH[3]} # eg. //www.ics.uci.edu
path=${BASH_REMATCH[5]} # eg. /pub/ietf/uri/
queryWithQuestion=${BASH_REMATCH[6]}
fragment=${BASH_REMATCH[9]}