tweag / opam-nix

Turn opam-based OCaml projects into Nix derivations
MIT License
111 stars 33 forks source link

Opam-Nix not providing the latest library versions from opam-repository #52

Closed solomon-b closed 1 year ago

solomon-b commented 1 year ago

Describe the bug I can see in opam-repository that bwd-2.2 and yuujinchou-5.0.2 are available:

https://github.com/ocaml/opam-repository/blob/master/packages/bwd/bwd.2.2.0/opam https://github.com/ocaml/opam-repository/blob/master/packages/yuujinchou/yuujinchou.5.0.2/opam

However Opam-nix is giving me bwd-2.1 and yuujinchou-4.0.2.

To Reproduce

➜ nix shell github:tweag/opam-nix#bwd.latest       

➜ echo $PATH
/nix/store/gk1f1i3hba3cgbxmpg9i144qbmszw9lc-bwd-2.1.0/bin:/run/wrappers/bin:/home/solomon/.nix-profile/bin:/etc/profiles/per-user/solomon/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/home/solomon/.local/scripts:/home/solomon/.local/bin:/home/solomon/.cabal/bin:/home/solomon/.zsh/plugins/zsh-nix-shell
➜ nix shell github:tweag/opam-nix#yuujinchou.latest

➜ echo $PATH
/nix/store/9di530vv5hwafixg94gan84xgqimiwvx-yuujinchou-4.0.0/bin:/nix/store/gk1f1i3hba3cgbxmpg9i144qbmszw9lc-bwd-2.1.0/bin:/run/wrappers/bin:/home/solomon/.nix-profile/bin:/etc/profiles/per-user/solomon/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/home/solomon/.local/scripts:/home/solomon/.local/bin:/home/solomon/.cabal/bin:/home/solomon/.zsh/plugins/zsh-nix-shell
➜ nix shell github:tweag/opam-nix#yuujinchou.5.0.2
error: flake 'github:tweag/opam-nix' does not provide attribute 'packages.x86_64-linux.yuujinchou.5.0.2', 'legacyPackages.x86_64-linux.yuujinchou.5.0.2' or 'yuujinchou.5.0.2'

Expected behavior I would expect the latest version from opam-repository to be provided.

Environment

solomon-b commented 1 year ago

Looks like the issue is that the opam-repository input to the flake is locked to an old commit. Is there a way for me to tell opam-nix to use a newer version of repository?

solomon-b commented 1 year ago

I solved this in my project by making opam-repository an input my project's flake and forcing opam-nix to follow my pinned version:

   inputs = {
+    opam-repository = {
+      url = "github:ocaml/opam-repository";
+      flake = false;
+    };
     opam-nix.url = "github:tweag/opam-nix";
+    opam-nix.inputs.opam-repository.follows = "opam-repository";
     flake-utils.url = "github:numtide/flake-utils";
     nixpkgs.follows = "opam-nix/nixpkgs";
   };
-  outputs = { self, flake-utils, opam-nix, nixpkgs }@inputs:
+  outputs = { self, flake-utils, opam-nix, opam-repository, nixpkgs }@inputs: