Overriding terragrunt with invalid version installs nixpkgs version?

I am trying to override the terragrunt package to install a different version. I know I can lookup find a version of nixpkgs with the version I desire, and use that. I want to learn why what I am doing does not behave the way I expect. In the following code I am overriding both the buildGoModule and fetchFromGitHub functions. I pass a version that does not exist intentionally. I expect the package not to build but, it builds version v0.44.5. If I change my version to a version that does exist like v0.40.2 it will build that version and use it.

# shell.nix
  pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/8bc6945b1224a1cfa679d6801580b1054dba1a5c.tar.gz") { },

  tag = v: "refs/tags/v${v}";
  version = "2.40.2";
  hash = "sha256-wNedd6C4NPLPw8CA1tyKx2MWsKatFbN4xt3Us2SC/ME=";
  vendorHash = "sha256-Qc0FnNxyErtieVvEj/eKPW5PpvYFwiYtv+ReJTVFAPA=";

  terragrunt = 
    pkgs.terragrunt.override {
      buildGoModule = args: pkgs.buildGoModule (args  // {
        inherit version vendorHash;
      fetchFromGitHub = args: pkgs.fetchFromGitHub (args // {
        inherit hash;
        rev = (tag version);


pkgs.mkShell {
  buildInputs = [


  • In this example hash and vendorHash are the hashes for version v0.40.2
1 Like

When you passed the inexisting version, did you also change the hash? Or did you use one that you used before?

I did not. I left the hash to set to the value of 0.40.2 expecting it to fail to download. If it did download anything (Not sure why it would), I expected it would fail the checksum. I see now if I set the hashes to "" it does indeed fail to download. If I set it to the value of 0.40.2, it does not fail to download, but it installs 0.44.5.