Installation of `alt-ergo` v2.4.1


I would like to install alt-ergo with nix. However, I need to install a specific version of it (v2.4.1).
I’m using direnv with nix so that being in the directory suffices to load the needed packages into the environment.

I have tried to use the old default.nix for v2.4.1 found on the master branch of nixpkgs, but it fails to build. It looks like dune’s CLI has gone through some changes. “dune: This subcommand has been moved to dune describe external-lib-deps.”.
This is going to be difficult since I need to find all the old dependencies of this package. Is there a way, similar to Haskell’s stackage, obtain a snapshot of all packages at a certain point of time so that this old nix file grabbed from GitHub can build the package correctly?

More generally, I would like to know the best practices to install an old version of a package, and how it’s normally done.

Thank you for your time :slight_smile:

Update: I discovered opam-nix, I think this could serve as a bridge between nix and opam.

How can I adapt this syntax

nix shell 'github:tweag/opam-nix#alt-ergo."2.4.1"'

to the shell.nix syntax so that it’s in my direnv configuration ? Thanks !


  • Change your direnv to use_flakes (instead of use_nix)
# flakes.nix
   inputs.opam-nix.url = "github:tweag/opam-nix";
   outputs = { opamnix, nixpkgs, self, ... }:
     devShells.x86_64-linux.default = nixpkgs.legacyPackages.x86_64-linux.callPackage ./shell.nix {
       alt-ergo = opamnix.packages.x86_64-linux.alt-ergo;
  • Import it directly to your shell.nix
 opam-nix = pkgs.callPackage (lib.fetchGithub { owner = "tweag"; repo = "opam-nix"; rev = "a2c8f7d640f1dcb92f036044f13eb9135f6db474"; }) {};
in mkShell {
  buildInputs = [ opam-nix.alt-ergo ];
  • Use niv or npins (similar to previous one);
  • Use devenv or devshell and do it with Nix Modules + previous options for pining;
1 Like