nixos-config/terranix/servers/shell.nix
2019-12-20 17:54:26 +13:00

35 lines
817 B
Nix

{ pkgs ? import <nixpkgs> { } }:
let
#terraform = terraform-current;
terraform = pkgs.terraform;
terraform-current = pkgs.terraform.overrideAttrs (old: rec {
version = "0.11.10";
name = "terraform-${version}";
src = pkgs.fetchFromGitHub {
owner = "hashicorp";
repo = "terraform";
rev = "v${version}";
sha256 = "08mapla89g106bvqr41zfd7l4ki55by6207qlxq9caiha54nx4nb";
};
});
in pkgs.mkShell {
# needed pkgs
# -----------
buildInputs = with pkgs;
[
(pkgs.writeShellScriptBin "terraform" ''
export TF_VAR_hcloud_api_token=`${pkgs.pass}/bin/pass development/hetzner.com/api-token`
${terraform}/bin/terraform "$@"
'')
];
# run this on start
# -----------------
shellHook = ''
HISTFILE=${toString ./.}/.history
'';
}