Compare commits

...

2 commits

3 changed files with 25 additions and 21 deletions

View file

@ -152,11 +152,9 @@
}; };
optionsDoc = doclib.mkOptionDocs { optionsDoc = doclib.mkOptionDocs {
module = { module = {
_module.args.pkgs = pkgs;
imports = [ imports = [
nblib.module nblib.module
{
_module.args.pkgs = pkgs;
}
]; ];
}; };
roots = [ roots = [

View file

@ -26,32 +26,27 @@
}: }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "ansible-core"; pname = "ansible-core";
version = "2.18.6"; version = "2.19.2";
pyproject = true; pyproject = true;
src = fetchPypi { src = fetchPypi {
pname = "ansible_core"; pname = "ansible_core";
inherit version; inherit version;
hash = "sha256-JbsgzhUWobcweDGyY872hAQ7NyBxFGa9nUFk5f1XZVc="; hash = "sha256-h/y7xJLtFutq2wN5uuCtv2nzzoioRA5+iODc76n4pUw=";
}; };
# ansible_connection is already wrapped, so don't pass it through # ansible_connection is already wrapped, so don't pass it through
# the python interpreter again, as it would break execution of # the python interpreter again, as it would break execution of
# connection plugins. # connection plugins.
postPatch = '' postPatch = ''
substituteInPlace lib/ansible/executor/task_executor.py \
--replace "[python," "["
patchShebangs --build packaging/cli-doc/build.py patchShebangs --build packaging/cli-doc/build.py
SETUPTOOLS_PATTERN='"setuptools[0-9 <>=.,]+"' SETUPTOOLS_PATTERN='"setuptools[0-9 <>=.,]+"'
PYPROJECT=$(cat pyproject.toml) WHEEL_PATTERN='"wheel[0-9 <>=.,]+"'
if [[ "$PYPROJECT" =~ $SETUPTOOLS_PATTERN ]]; then echo "Patching pyproject.toml"
echo "setuptools replace: ''${BASH_REMATCH[0]}" # print replaced patterns to stdout
echo "''${PYPROJECT//''${BASH_REMATCH[0]}/'"setuptools"'}" > pyproject.toml sed -r -i -e 's/'"$SETUPTOOLS_PATTERN"'/"setuptools"/w /dev/stdout' \
else -e 's/'"$WHEEL_PATTERN"'/"wheel"/w /dev/stdout' pyproject.toml
exit 2
fi
''; '';
nativeBuildInputs = [ nativeBuildInputs = [
@ -86,6 +81,12 @@ buildPythonPackage rec {
pythonRelaxDeps = ["resolvelib"]; pythonRelaxDeps = ["resolvelib"];
postInstall = ''
export HOME="$(mktemp -d)"
packaging/cli-doc/build.py man --output-dir=man
installManPage man/*
'';
# internal import errors, missing dependencies # internal import errors, missing dependencies
doCheck = false; doCheck = false;
} }

View file

@ -19,7 +19,7 @@
unsetOr = typ: unsetOr = typ:
(types.either unsetType typ) (types.either unsetType typ)
// { // {
description = typ.description; inherit (typ) description getSubOptions;
}; };
filterUnset = value: filterUnset = value:
@ -36,7 +36,7 @@
mkOption args mkOption args
// { // {
type = unsetOr args.type; type = unsetOr args.type;
default = unset; default = args.default or unset;
defaultText = literalExpression "unset"; defaultText = literalExpression "unset";
}; };
@ -59,7 +59,7 @@
}; };
}; };
tasksType = types.submodule { tasksType = types.submodule {
freeformType = types.attrsOf (types.attrsOf types.anything); freeformType = types.attrsOf types.anything;
options = { options = {
name = mkUnsetOption { name = mkUnsetOption {
type = types.str; type = types.str;
@ -118,7 +118,7 @@
}; };
}; };
playType = types.submodule { playType = types.submodule {
freeformType = types.attrsOf (types.attrsOf types.anything); freeformType = types.attrsOf types.anything;
options = { options = {
name = mkOption { name = mkOption {
type = types.str; type = types.str;
@ -278,12 +278,17 @@ in {
cli = pkgs.writeShellApplication { cli = pkgs.writeShellApplication {
name = "nixible"; name = "nixible";
runtimeInputs = config.dependencies; runtimeInputs = config.dependencies;
text = '' text = let
inventoryStr =
if config.inventory != {}
then "-i ${config.inventoryFile}"
else "";
in ''
set -euo pipefail set -euo pipefail
export ANSIBLE_COLLECTIONS_PATH=${config.installedCollections} export ANSIBLE_COLLECTIONS_PATH=${config.installedCollections}
git_repo=$(git rev-parse --show-toplevel 2>/dev/null || true) git_repo=$(git rev-parse --show-toplevel 2>/dev/null || true)
${config.ansiblePackage}/bin/ansible-playbook -i ${config.inventoryFile} ${config.playbookFile} -e "pwd=$(pwd)" -e "git_root=$git_repo" "$@" ${config.ansiblePackage}/bin/ansible-playbook ${inventoryStr} ${config.playbookFile} -e "pwd=$(pwd)" -e "git_root=$git_repo" "$@"
''; '';
}; };
}; };