nixos-config/terranix/servers/shell.nix
Ingolf Wagner 973e3b3305
reformat
2021-11-01 19:30:41 +01:00

36 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
'';
}