infra-status/flake.nix
Alexis Pentori 8c19ec8e40
flake: open nix flake devShell automatically with direnv (nix-direnv)
see infra-templates:
              - 32a8552eaf0347c217fa7d80572b06d5cd90243d
              - a1b9500b5dcd114d45571e8122459f0e5aca9de2

Signed-off-by: Alexis Pentori <alexis@status.im>
2024-09-20 15:15:38 +02:00

48 lines
1.4 KiB
Nix

{
description = "infra-shell";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }:
let
stableSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
forAllSystems = nixpkgs.lib.genAttrs stableSystems;
pkgsFor = nixpkgs.lib.genAttrs stableSystems (
system: import nixpkgs { inherit system; config.allowUnfree = true; }
);
in rec {
devShells = forAllSystems (system: let
pkgs = pkgsFor.${system};
in {
default = let
pythonPkgs = pkgs.python311.withPackages (
_: with (pkgs.python311Packages); [
ipython pyyaml jinja2 PyGithub
pyopenssl cryptography
hvac
]
);
in pkgs.mkShellNoCC {
packages = with pkgs.buildPackages; [
# misc
git openssh jq fzf silver-searcher direnv
# networking
curl nmap nettools dnsutils
# infra
terraform ansible_2_16 pythonPkgs
# security
pass vault bitwarden-cli yubikey-manager pwgen
# cloud
aliyun-cli awscli doctl google-cloud-sdk
hcloud s3cmd scaleway-cli
];
shellHook = ''
./ansible/roles.py --check || \
echo -e '\nWARNING: Your role versions appear to be incorrect!' >&2
'';
};
});
};
}