Omnisharp-roslyn overlay

Hi, I am trying to make a first overlay. I want omnisharp-roslyn version 1.37.6, and the version in unstable is 1.37.4.
Trying to follow Overlays - NixOS Wiki and staying as close to as possible, I added the following to configuration.nix, but as you can read in the comments the sha256 attribute is incorrect:

nixpkgs.overlays =
    [ (self: super:
            omnisharp-roslyn = super.omnisharp-roslyn.overrideAttrs (old: {
                src = pkgs.fetchurl {
                    url = "";
                    # according to the wiki, I could use the below sha256 to get the correct one.
                    # sha256 = "0000000000000000000000000000000000000000000000000000";
                    # The rebuild failed as expected, and suggested this hash:
                    # sha256 = "pebAU2s1ro+tq7AnaVKOIDoTjxM4dZwCRo1kJoARW+Y";
                    #However, that hash is too short and any following build fails because of incorrect hash length.

                    # I instead ran 
#nix-prefetch-url --unpack 
# This gave the following hash.
                    sha256 = "11wg5yh4s6hry43afggsfwa1w00rv14328j533ajdbvsw7di77zy";
                    # This hash is the correct length, but nix again complains that it is incorrect, and suggests the previous hash that is too short.

What am I misunderstanding with sha256?

You need to copy the full hash provided, including the sha256- prefix.

Similar to how I have it in this example

1 Like

Wow, I love easy fixes. It works perfectly. Thank you!

Also, nix-prefetch-url with --unpack gives you the hash of the archives content, though for fetchurl you need to provide that actual archives hash. You get it by ommiting the --unpack.

1 Like