Closed Kesanov closed 2 years ago
Does idris2 have the right to create the directory ~/.idris2/idris2-0.3.0/test
?
How can I check that? Btw, I installed it with nix-env.
If I do sudo idris2 --instal test.ipkg
I get sudo: idris2: command not found
Hi @Josef-Vonasek, for clarification, did you install it from the packaged v0.3.0 version (nix-env -iA nixpkgs.idris2
) or did you build from source and install the result? (nix-build -E "with import <nixpkgs> {}; (callPackage ./. {})" && nix-env -i result/
)
I don't have Windows but could you do tree ~/.idris2/ -L 2
to check that directory?
I did nix-env -i idris2
and got it installed under /home/unix/.nix-profile/bin/idris2
.
~/.idris2
doesn't exist. Adding ~/.idris2/idris2-0.3.0/test
manually with mkdir
has no effect.
Hey, could you try using this nix packages? https://github.com/claymager/idris2-pkgs
All I want to do is run a simple hello world package with no external dependencies. I don't see how packager manager helps that.
@Josef-Vonasek, the issue is that nix copied everything to a non-mutable store (this is as designed) so you cannot copy more stuff over the nix install of Idris2.
You could try to move around it in a hacky way (Copying the Nix Idris2 install to ~/.idris2 and setting the env IDRIS2_PREFIX
to that location) however that would probably cause a bit more issues (since on an nix-env -u
and a garbage collection the dependencies of the copied idris2 might get removed, nix-env -u
would update the nix install but not your user install, etc)
The other option would be to make it from source, this is what I do on NixOS and should work better for you too. Clone this repo, nix-shell
and follow the bootstraping instructions here, use the normal make install
which will install idris2 in your home dir and remember to add the idris2 bin to your PATH. (I use a symbolic link from ~/.local/bin
to ~/.idris2/bin/idris2
and have ~/.local/bin
in my PATH)
@Josef-Vonasek Does running $ mkdir -p $(idris2 --libdir)
fix your issue?
There is a disagreement between nix and idris2:
~/idris2/idris2-0.3.0
to existWhen installing with make
, there's no issue, because the makefile handles that for us. Nix won't let us make a mutable folder at build time.
Does running $ mkdir -p $(idris2 --libdir) fix your issue?
Nope. It creates a folder /nix/store/bqqj72s3i18w4synw9wz2sf9radz2zzq-idris2-0.3.0/idris2-0.3.0
, but it doesn't affect the error.
Oops. Forgot I had IDRIS2_PREFIX set, sorry. Add that to your shell env, make the libdir, and it should work.
Order of precedence for libdir is
$IDRIS2_PREFIX/idris2-0.3.0
at runtimeBuild location is immutable, so obviously out. The nix package chooses not to set IDRIS2_PREFIX, but setting a default is trivial and the approach I'm taking in idris2-pkgs
.
We still need to make sure idris properly handles the libdir not existing.
test.ipkg:
src/Main.idr:
command:
OS: WSL