mirror of
https://gitlab.com/TECHNOFAB/nixible.git
synced 2025-12-12 18:20:09 +01:00
chore: initial commit
This commit is contained in:
commit
7602719790
24 changed files with 1916 additions and 0 deletions
45
lib/ansible-collections.nix
Normal file
45
lib/ansible-collections.nix
Normal 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}
|
||||
''
|
||||
Loading…
Add table
Add a link
Reference in a new issue