Idris2 icon indicating copy to clipboard operation
Idris2 copied to clipboard

How to get a multipackage environment with nix.

Open locallycompact opened this issue 4 years ago • 5 comments

Hi. I've asked this on nixpkgs (https://github.com/NixOS/nixpkgs/issues/119175) but I imagine I'd find more answers here. I'm looking to get the idris.with-packages behaviour that I'm used to in nix.

I was able to build the pkg flake in this repository by instantiating it as a template, but not the pkgWithDep flake. I wanted to modify the pkgWithDep flake to just accept dependencies via fetchFromGitHub, but I don't see a mechanism to build those and install them to the correct directory, since everything on nixpkgs seems still specific to idris 1.

What is the right way to do this?

locallycompact avatar Apr 15 '21 18:04 locallycompact

There isn't really a right way, yet. I'm working on it here (warning: unstable), but I'm holding off on adding it to nixpkgs until we get the next release. It requires some path changes that were made after v0.3.0.

claymager avatar Apr 15 '21 19:04 claymager

Thank you very much. How do I call it?

locallycompact avatar Apr 16 '21 14:04 locallycompact

# flake.nix
{
  inputs.userpkgs.url = github:claymager/nixpkgs/idris2;
  inputs.flake-utils.url = github:numtide/flake-utils;
  outputs = { self, userpkgs, flake-utils } :
    flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
      let pkgs = import userpkgs {inherit system; };
      in {
        devShell = pkgs.mkShell {
          buildInputs = [
            (pkgs.idris2.withPkgs (ps: [ ps.comonad ]) )
          ];
        };
      }
    );
}

I use something like that. As I said, unstable. and there's a few local paths in the branch atm for testing, but nix develop with that flake will grant you a shell with idris2-comonad.

You'll still need to explicitly call idris2 -p comonad in order to import Control.Comonad, if you're not using an ipkg file.

claymager avatar Apr 16 '21 15:04 claymager

Thanks, claymager, for your work on this nix-related stuff! I'm really looking forward to the day when we can use nix as a fully operating development environment for Idris2.

stefan-hoeck avatar Apr 16 '21 16:04 stefan-hoeck

Is there any change in Nix support for Idris2 yet?

mokshasoft avatar Nov 19 '23 08:11 mokshasoft