stefan-hoeck / idris2-pack

BSD 3-Clause "New" or "Revised" License
100 stars 27 forks source link

how to use on nixos? #311

Open srghma opened 5 days ago

stefan-hoeck commented 5 days ago

Sorry, I am not a Nix user so I can't help with this one. Maybe someone else can step in here?

buzden commented 4 days ago

@mattpolzin and @DanMax03 might help, as to my knowledge they are NixOS users

mattpolzin commented 4 days ago

The question is a bit vague for me to know exactly what the end goals are, but there are several potential answers depending on those goals.

If you want to have Pack installed on your machine much like it would be on a non-nixos machine, you are going to want to install the following via your system config: idris2, gcc, and gmp. Then follow the Pack install instructions. I have not done this so you might hit a snag but nothing should stop you from doing it this way so any snag should be small.

If you want to install Pack via a Nix derivation but otherwise use Pack as any other Pack user would to build your Idris2 programs, feel free to snag the derivation I wrote (has not been merged into nixpkgs yet): https://github.com/NixOS/nixpkgs/pull/344109/files

If you want to go full nix on things (i.e. minimize the amount of stuff built & stored in your home folders and maximize the amount of stuff configured via Nix files), you can check out nix-idris2-packages which does not use Pack as its frontend but it pulls the exact same database of Idris2 packages in as Pack uses and enables you to use the buildIdris family of Nix functions to build your projects.

[EDIT] I added gcc to the list of installs you should do via system config if you are going with the first option I mentioned.

DanMax03 commented 4 days ago

As Mathew said, there is a giant issue in nix community regarding other ecosystems: should they be totally wrapped in nix or not?

Depending on that, you may search for 2 possible solutions:

  1. nix package(s) that allow to configure every single pack's package for idris2 via nix config
  2. nix package(s) that allow you to install pack and control every folder that it needs, though managing pack's packages is done completely by pack itself

    For the first option, I've heard about idr2nix and it seems to be quite fresh and rolling. The second option doesn't have a solution... yet

Mathew also mentioned that you may try to mix NixOS with pack installed in an old-fashioned way, but then you will face several issues:

Currently, I don't have time to dive into nix (I use NixOS less than a year) and I am not using flakes, so I decided to make a docker container with Idris 2. Works perfectly for me, especially the ability to get a fresh version of any idris package without additional actions