chore: initial commit

This commit is contained in:
technofab 2025-07-15 19:28:42 +02:00
commit 7602719790
No known key found for this signature in database
24 changed files with 1916 additions and 0 deletions

View file

@ -0,0 +1,45 @@
{
stdenv,
lib,
pkgs,
}: ansible: collections: let
inherit (lib) concatStringsSep mapAttrsToList;
mkCollection = {
name,
version,
hash,
}:
stdenv.mkDerivation {
pname = name;
inherit version;
src = pkgs.fetchurl {
inherit hash;
url = "https://galaxy.ansible.com/download/${name}-${version}.tar.gz";
};
phases = ["installPhase"];
installPhase = ''
mkdir -p $out
cp $src $out/collection.tar.gz
'';
};
installCollection = collection: "${ansible}/bin/ansible-galaxy collection install ${collection}/collection.tar.gz";
installCollections = concatStringsSep "\n" (
mapAttrsToList (
name: coll:
installCollection (
mkCollection ({inherit name;} // coll)
)
)
collections
);
in
pkgs.runCommand "ansible-collections" {} ''
mkdir -p $out
export HOME=./
export ANSIBLE_COLLECTIONS_PATH=$out
${installCollections}
''