Describe the bug
It seems there is a distinction, when using ?dir=subdir/path, between a local path reference and a remote reference.
This is a bit surprising/confusing, and seems like something that should be supported. I guess maybe this feature is for folks with mono-repos and they are somehow cloning just the subdirectories? Otherwise I'm not sure how one would do the initial local development on a repo where the flake.nix is in a subdir. As alluded to in my example, I basically had to keep force pushing to github over-and-over so that I could test through the "remote ref" path to get examples/test01/flake.nix building.
# make sure we're on latest
❯ git add .; git commit --amend --no-edit; git push origin HEAD -f
❯ f="github:colemickens/redact/$(git ls-remote https://github.com/colemickens/redact master|cut -d' ' -f1)"
❯ nix run "$f?dir=examples/test01"
error: --- Error --------------------------------------------------------------------------------------------- nix
cannot write modified lock file of flake 'github:colemickens/redact/0c4774c02c5e8de272556eac4faf8215b950bdf5?dir=examples%2ftest01' (use '--no-write-lock-file' to ignore)
# ^^ kind of annoying when it's a remote repo...
❯ nix run "$f?dir=examples/test01" --no-write-lock-file
warning: not writing modified lock file of flake 'github:colemickens/redact/0c4774c02c5e8de272556eac4faf8215b950bdf5?dir=examples%2ftest01':
* Added 'nixpkgs': 'github:nixos/nixpkgs/733e537a8ad76fd355b6f501127f7d0eb8861775'
Hello, world!
# works when we `--no-write-lock-file` and use a remote repo
❯ cd ~/code/redact
❯ f="$(pwd)"
❯ nix run "$f?dir=examples/test01"
error: --- BadURL -------------------------------------------------------------------------------------------- nix
path '/home/cole/code/redact' is not a flake (because it doesnt contain a 'flake.nix' file)
# does not work when we use a local path
❯ nix --version
nix (Nix) 2.4pre20201201_5a6ddb3
Describe the bug
It seems there is a distinction, when using
?dir=subdir/path, between a local path reference and a remote reference.This is a bit surprising/confusing, and seems like something that should be supported. I guess maybe this feature is for folks with mono-repos and they are somehow cloning just the subdirectories? Otherwise I'm not sure how one would do the initial local development on a repo where the
flake.nixis in a subdir. As alluded to in my example, I basically had to keep force pushing to github over-and-over so that I could test through the "remote ref" path to getexamples/test01/flake.nixbuilding.