flake: add flake.nix and lock

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2024-07-05 13:40:30 +02:00
parent a0ad0410d9
commit 8bb033cf6c
No known key found for this signature in database
GPG Key ID: FE65CD384D5BF7B4
2 changed files with 73 additions and 0 deletions

27
flake.lock Normal file
View File

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1720031269,
"narHash": "sha256-rwz8NJZV+387rnWpTYcXaRNvzUSnnF9aHONoJIYmiUQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "9f4128e00b0ae8ec65918efeba59db998750ead6",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

46
flake.nix Normal file
View File

@ -0,0 +1,46 @@
{
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.python310.withPackages (
_: with (pkgs.python310Packages); [
ipython pyyaml jinja2 PyGithub
pyopenssl cryptography
]
);
in pkgs.mkShellNoCC {
packages = with pkgs.buildPackages; [
# misc
git openssh jq fzf silver-searcher
# networking
curl nmap nettools dnsutils
# infra
terraform ansible_2_16 pythonPkgs
# security
pass 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
'';
};
});
};
}