Install Exiftool version 12.70 instead of standard version 13.0

Hi Nix users,

I am very happy with Nix so far, but have a problem with installing a package in an older version. What I have done is this in configuration.nix:

let
   # Fetch the specific revision of nixpkgs EXIFTOOL version 12.70      
   # https://lazamar.co.uk/nix-versions/?channel=nixos-23.11&package=exiftool                                                      
   fetchurl = pkgs.fetchurl;                                            
                                                                                                        
  fixedNixpkgs = import (fetchurl {                                    
    url = "https://github.com/NixOS/nixpkgs/archive/c2f319bf379eedec9eec6a8148b78aa635720ae3.tar.gz"; 
    sha256 = "IdOmvRdL12pfFF82+pYhVwsL5lJNHB1j6+XU2Xa6ZPo=";          
  }) {};                                                                               
in                                                                                                                         
 {
...
 environment.systemPackages = with pkgs; [                                                                                     
  ...                                                                                                          
  (fixedNixpkgs.perlPackages.Image-ExifTool)

I am sure the sha256 hash is correct because if I leave it out it says:

error: hash mismatch in fixed-output derivation '/nix/store/fc53bgrhay0dk9vdlg5d02y7c30jmk41-c2f319bf379eedec9eec6a8148b78aa635720ae3.tar.gz.drv':
         specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
            got:    sha256-IdOmvRdL12pfFF82+pYhVwsL5lJNHB1j6+XU2Xa6ZPo=

If I do a nix-prefetch I get a very different sha256, and that does not work either. So now I am stuck and don’t know what to do.

So my question is, is this the nix-way to do it and why does it not work.

I will just reply myself. I fixed it by using fetchTarball instead of url. I guess it was not unpacked. So:

let
  fetchTarball = builtins.fetchTarball;

  fixedNixpkgs = import (fetchTarball {
    url = "https://github.com/NixOS/nixpkgs/archive/c2f319bf379eedec9eec6a8148b78aa635720ae3.tar.gz";
    sha256 = "04fmn849lqscvajd7db5qs5qmm3qmrgzklldqxkn2wf71gpdhkp1";
  }) {};
in
{
   ...

    environment.systemPackages = with pkgs; [
    # Use the specific version of exiftool from the fixed revision
    (fixedNixpkgs.perlPackages.ImageExifTool)
    ...

Hope it may help somebody in the same situation.

1 Like