Using a custom version of terraform

I need to be able to install a more recent version of terraform using the following package:

How can I use there exposed terraform_1 (that uses a more modern version) via environment.systemPackages ?

I have tried

environment.systemPackages = with pkgs; [

which gives the error: error: attribute 'terraform_1' missing,

What channel are you on?

I checked both, nixos-22.05 and nixos-unstable, both provide the terraform_1 attribute:

$ nix eval nixpkgs/
$ nix eval nixpkgs/

well i think unstable but questioning that now as I don’t get the same output as your eval commands?

vagrant@carverlinux ~/nixos (master) [1]> nix-channel --list
vagrant@carverlinux ~/nixos (master)> nix eval nixpkgs/
error: getting status of '/home/vagrant/nixos/nixpkgs/': No such file or directory
vagrant@carverlinux ~/nixos (master) [1]> nix eval nixpkgs/
error: getting status of '/home/vagrant/nixos/nixpkgs/': No such file or directory

What version of nix?

Also what version of nixpkgs exactly? Can you please run nix-instantiate --eval --expr '(import <nixos> {}).lib.version'?

1 Like

ahh interesting it’s:


better reread the upgrade guide I thought I had upgraded

sudo nix-channel --update should do (unless you use flakes, which I doubt after the output of nix eval above).

Though be careful then… If you used the 2.3 experimental CLI a lot, then the 2.10ish one will be completely different from what you are used to and also push you towards flakes quickly.

Enabling flakes will not disable channels, any you can use a channel based system configuration for the time being.

1 Like

I’ve had the same problem and fixed it using flakes:

First, search for the commit containing the version you want (Search · repo:NixOS/nixpkgs terraform "1.1.3" · GitHub)
In my case it was terraform: 1.1.2 -> 1.1.3 · NixOS/nixpkgs@3c0f090 · GitHub

Then register this in a separate registry:

nix registry add nixold github:NixOS/nixpkgs/3c0f090cacf5

then use nix shell (for example) to use it:

nix shell nixold#terraform

terraform version
Terraform v1.1.3

Hope it helps!

Hosted by Flying Circus.