unable to download 'https://api.github.com/repos/chadac/nix-ws/commits/HEAD': HTTP error 409
Hello!
I'm getting the following error after following the installation instruction in the README and running ns init --name test in an empty directory:
[ERROR] cli error:
stderr: error:
… while fetching the input 'github:chadac/nix-ws'
error: unable to download 'https://api.github.com/repos/chadac/nix-ws/commits/HEAD': HTTP error 409
response body:
{
"message": "Git Repository is empty.",
"documentation_url": "https://docs.github.com/rest/commits/commits#get-a-commit"
}
stdout:
I'm also using the following command for nix-shell, just in case, which works, but running ns init --name test also errors out there as well:
nix-shell -E 'with builtins.getFlake "https://github.com/chadac/nixspace/archive/main.tar.gz"; with (import /etc/nixos).pkgs.currentSystem
; mkShell { buildInputs = [ packages.${builtins.currentSystem}.nixspace ]; }'
Thank you kindly for the help!
Looks like potentially you're using an earlier version of nixspace, I had a commit earlier today that referred to this repo. With ns -vv you can see what CLI commands I'm running, but to pull in the most recent version, I'd try:
nix shell github:chadac/nixspace --refresh
That should pull the latest commit from the repository. If you'd like to just start a project, you could also run (in your workspace directory):
nix flake init github:chadac/nixspace
which is essentially what ns init does.
Quick note: nix flake init github:chadac/nixspace is erroring out with error: unexpected argument 'github:chadac/nixspace'.
In addition, ns init --name [...] errors out on directories whether they exist or not, and you can't initialize without a name.
Apologies, I got the command wrong in that comment. It should be nix flake init -t github:chadac/nixspace. Lemme throw that in the docs as well. I assume ns init still errors with the same message?
Hmm... nix flake init -t github:chadac/nixspace works, creating the workspace, but it seems that ns init --name [...] worked as well, but threw an error anyway? I tried again just now, and it said that the directory already existed, which it in fact does...
The ns command does have to be initialized in an empty directory unlike the nix flake init template usage. I threw in an explicit check for that. Perhaps I shouldn't, though? If that is too strange a behavior I could probably update the init command to work in existing directories. I may add some type of confirmation to ensure the user really wants a workspace rooted in that directory, though.
Yeah, that might be better, making it work something like git init. Unless that's how creating npm workspaces work?
Yeah I'd be up for that, it would be more consistent with the nix flake init syntax anyways. npm workspaces are sort of their own thing that happens after a project has already been created, so modeling after them probably wouldn't make too much sense.
Lemme change this to a feature request and get something out for this soon.
Let me know where I can help; I've no knowledge of rust, but I've been working with nix for some time now, so I can try there! 😅