diff --git a/flake.nix b/flake.nix index 50c4504..dc9e417 100644 --- a/flake.nix +++ b/flake.nix @@ -152,9 +152,11 @@ }; optionsDoc = doclib.mkOptionDocs { module = { - _module.args.pkgs = pkgs; imports = [ nblib.module + { + _module.args.pkgs = pkgs; + } ]; }; roots = [ diff --git a/lib/ansible-core.nix b/lib/ansible-core.nix index dfa3cbc..85c7de1 100644 --- a/lib/ansible-core.nix +++ b/lib/ansible-core.nix @@ -26,27 +26,32 @@ }: buildPythonPackage rec { pname = "ansible-core"; - version = "2.19.2"; + version = "2.18.6"; pyproject = true; src = fetchPypi { pname = "ansible_core"; inherit version; - hash = "sha256-h/y7xJLtFutq2wN5uuCtv2nzzoioRA5+iODc76n4pUw="; + hash = "sha256-JbsgzhUWobcweDGyY872hAQ7NyBxFGa9nUFk5f1XZVc="; }; # ansible_connection is already wrapped, so don't pass it through # the python interpreter again, as it would break execution of # connection plugins. postPatch = '' + substituteInPlace lib/ansible/executor/task_executor.py \ + --replace "[python," "[" + patchShebangs --build packaging/cli-doc/build.py SETUPTOOLS_PATTERN='"setuptools[0-9 <>=.,]+"' - WHEEL_PATTERN='"wheel[0-9 <>=.,]+"' - echo "Patching pyproject.toml" - # print replaced patterns to stdout - sed -r -i -e 's/'"$SETUPTOOLS_PATTERN"'/"setuptools"/w /dev/stdout' \ - -e 's/'"$WHEEL_PATTERN"'/"wheel"/w /dev/stdout' pyproject.toml + PYPROJECT=$(cat pyproject.toml) + if [[ "$PYPROJECT" =~ $SETUPTOOLS_PATTERN ]]; then + echo "setuptools replace: ''${BASH_REMATCH[0]}" + echo "''${PYPROJECT//''${BASH_REMATCH[0]}/'"setuptools"'}" > pyproject.toml + else + exit 2 + fi ''; nativeBuildInputs = [ @@ -81,12 +86,6 @@ buildPythonPackage rec { pythonRelaxDeps = ["resolvelib"]; - postInstall = '' - export HOME="$(mktemp -d)" - packaging/cli-doc/build.py man --output-dir=man - installManPage man/* - ''; - # internal import errors, missing dependencies doCheck = false; } diff --git a/lib/module.nix b/lib/module.nix index 5624d58..bcbe713 100644 --- a/lib/module.nix +++ b/lib/module.nix @@ -19,7 +19,7 @@ unsetOr = typ: (types.either unsetType typ) // { - inherit (typ) description getSubOptions; + description = typ.description; }; filterUnset = value: @@ -36,7 +36,7 @@ mkOption args // { type = unsetOr args.type; - default = args.default or unset; + default = unset; defaultText = literalExpression "unset"; }; @@ -59,7 +59,7 @@ }; }; tasksType = types.submodule { - freeformType = types.attrsOf types.anything; + freeformType = types.attrsOf (types.attrsOf types.anything); options = { name = mkUnsetOption { type = types.str; @@ -118,7 +118,7 @@ }; }; playType = types.submodule { - freeformType = types.attrsOf types.anything; + freeformType = types.attrsOf (types.attrsOf types.anything); options = { name = mkOption { type = types.str; @@ -278,17 +278,12 @@ in { cli = pkgs.writeShellApplication { name = "nixible"; runtimeInputs = config.dependencies; - text = let - inventoryStr = - if config.inventory != {} - then "-i ${config.inventoryFile}" - else ""; - in '' + text = '' set -euo pipefail export ANSIBLE_COLLECTIONS_PATH=${config.installedCollections} git_repo=$(git rev-parse --show-toplevel 2>/dev/null || true) - ${config.ansiblePackage}/bin/ansible-playbook ${inventoryStr} ${config.playbookFile} -e "pwd=$(pwd)" -e "git_root=$git_repo" "$@" + ${config.ansiblePackage}/bin/ansible-playbook -i ${config.inventoryFile} ${config.playbookFile} -e "pwd=$(pwd)" -e "git_root=$git_repo" "$@" ''; }; };