nixos-config/terranix/servers/shell.nix

37 lines
817 B
Nix
Raw Normal View History

2019-12-20 05:54:26 +01:00
{ pkgs ? import <nixpkgs> { } }:
2019-10-24 02:20:38 +02:00
let
#terraform = terraform-current;
terraform = pkgs.terraform;
2019-12-20 05:54:26 +01:00
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";
};
});
2019-10-24 02:20:38 +02:00
2021-11-01 19:30:41 +01:00
in
pkgs.mkShell {
2019-10-24 02:20:38 +02:00
# needed pkgs
# -----------
2019-12-20 05:54:26 +01:00
buildInputs = with pkgs;
[
2019-10-24 02:20:38 +02:00
2019-12-20 05:54:26 +01:00
(pkgs.writeShellScriptBin "terraform" ''
export TF_VAR_hcloud_api_token=`${pkgs.pass}/bin/pass development/hetzner.com/api-token`
${terraform}/bin/terraform "$@"
'')
];
2019-10-24 02:20:38 +02:00
# run this on start
# -----------------
shellHook = ''
HISTFILE=${toString ./.}/.history
'';
}