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") { },
}:
let
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);
});
};
in
pkgs.mkShell {
buildInputs = [
terragrunt
];
}
Notes:
- In this example
hash
andvendorHash
are the hashes for versionv0.40.2