infra/flake.nix
2023-06-26 15:29:07 +01:00

51 lines
1.8 KiB
Nix

{
description = "A basic flake with a shell";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, flake-utils, nixos-generators }:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
devShells.default = pkgs.mkShell {
shellHook =
''
bw sync
export BW_SESSION=$(bw unlock --raw)
export VERCEL_API_TOKEN=$(bw list items --search "Vercel API" | jq -r '.[0].notes')
export HCLOUD_TOKEN=$(bw list items --search "Hetzner" | jq -r '.[0].fields[] | select(.name | contains("API")) | .value')
export TF_VAR_tailscale_key=$(bw list items --search "Tailscale Key" | jq -r '.[0].notes')
export CLOUDFLARE_API_TOKEN=$(bw list items --search "CloudFlare" | jq -r '.[0].fields[] | select(.name | contains("Zone API Key")) | .value')
# alias terraform='terraform -chdir=terraform'
'';
nativeBuildInputs = [
pkgs.jq
pkgs.terraform
pkgs.ansible
pkgs.kubectl
pkgs.awscli2
pkgs.nodePackages.yaml-language-server
pkgs.python39Packages.python-lsp-server
pkgs.k9s
pkgs.terraform-ls
pkgs.kubernetes-helm
pkgs.k6
];
buildInputs = [ ];
};
packages.aarch64-linux = {
k3s-server = nixos-generators.nixosGenerate {
system = "aarch64-linux";
modules = [
./pi-imgs/k3s-server.nix
];
format = "sd-aarch64-installer";
};
};
});
}