2025-01-21 20:56:48 -05:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
|
|
|
|
{
|
|
|
|
imports = [ ];
|
|
|
|
|
|
|
|
options.me = {
|
|
|
|
ansible.enable = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
|
|
|
default = false;
|
|
|
|
example = true;
|
|
|
|
description = "Whether we want to install ansible.";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf config.me.ansible.enable (
|
|
|
|
lib.mkMerge [
|
|
|
|
{
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
ansible
|
|
|
|
];
|
|
|
|
|
|
|
|
nixpkgs.overlays = [
|
|
|
|
(final: prev: {
|
|
|
|
ansible = pkgs.symlinkJoin {
|
|
|
|
name = "ansible";
|
|
|
|
paths = [
|
|
|
|
(prev.ansible.overridePythonAttrs {
|
|
|
|
propagatedBuildInputs = prev.ansible.propagatedBuildInputs ++ [ prev.python3Packages.jmespath ];
|
|
|
|
})
|
2025-01-25 14:35:37 -05:00
|
|
|
pkgs.ansible-sshjail
|
2025-01-21 20:56:48 -05:00
|
|
|
];
|
|
|
|
buildInputs = [ pkgs.makeWrapper ];
|
2025-01-25 14:35:37 -05:00
|
|
|
|
2025-01-21 20:56:48 -05:00
|
|
|
postBuild = ''
|
2025-01-25 14:35:37 -05:00
|
|
|
${lib.concatMapStringsSep "\n"
|
|
|
|
(
|
|
|
|
prog:
|
|
|
|
(
|
|
|
|
"wrapProgram $out/bin/${prog} ${
|
|
|
|
lib.concatMapStringsSep " "
|
|
|
|
(
|
|
|
|
plugin_type:
|
|
|
|
"--set ANSIBLE_${lib.toUpper plugin_type}_PLUGINS $out/share/ansible/plugins/${lib.toLower plugin_type}_plugins"
|
|
|
|
)
|
|
|
|
[
|
|
|
|
"action"
|
|
|
|
"cache"
|
|
|
|
"callback"
|
|
|
|
"connection"
|
|
|
|
"filter"
|
|
|
|
"inventory"
|
|
|
|
"lookup"
|
|
|
|
"shell"
|
|
|
|
"strategy"
|
|
|
|
"test"
|
|
|
|
"vars"
|
|
|
|
]
|
|
|
|
} --prefix PATH : ${lib.makeBinPath [ ]}"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
[
|
|
|
|
"ansible"
|
|
|
|
"ansible-config"
|
|
|
|
"ansible-console"
|
|
|
|
"ansible-doc"
|
|
|
|
"ansible-galaxy"
|
|
|
|
"ansible-inventory"
|
|
|
|
"ansible-playbook"
|
|
|
|
"ansible-pull"
|
|
|
|
"ansible-test"
|
|
|
|
"ansible-vault"
|
|
|
|
]
|
|
|
|
}
|
2025-01-21 20:56:48 -05:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
|
|
|
}
|
|
|
|
]
|
|
|
|
);
|
|
|
|
}
|