aboutsummaryrefslogtreecommitdiffstats
path: root/shell.nix
diff options
context:
space:
mode:
authorColin Wilk <colin@wilk.cx>2026-06-26 22:14:34 +0200
committerColin Wilk <colin@wilk.cx>2026-06-26 22:14:34 +0200
commit6b5877bb547303f7c8c75721ad09d44093a9154e (patch)
tree595b7fc75ca6a5d982537ce4435e325d4d5f9f95 /shell.nix
parentbd022f046651d287309b26164cd60a3d6d38471c (diff)
downloadansible-role-borgbackup-6b5877bb547303f7c8c75721ad09d44093a9154e.tar.gz
ansible-role-borgbackup-6b5877bb547303f7c8c75721ad09d44093a9154e.zip
shell.nix: add fix for molecule docker driver
Currently molecule is incompatible with Ansible 14 / ansible-core 2.21 so we need to inject invocation variables via env var to make it work. Should be fixed when this gets closed: https://github.com/ansible-community/molecule-plugins/issues/363
Diffstat (limited to 'shell.nix')
-rw-r--r--shell.nix34
1 files changed, 19 insertions, 15 deletions
diff --git a/shell.nix b/shell.nix
index b07495a..b15061e 100644
--- a/shell.nix
+++ b/shell.nix
@@ -3,38 +3,42 @@
}:
let
- python = pkgs.python3.withPackages (ps: [
- ps.ansible
+ pythonPackages = ps: [
+ ps.ansible-core
ps.docker
ps.molecule
ps.molecule-plugins
ps.pytest
ps.pytest-testinfra
- ps.requests
- ]);
+ ];
+ python = pkgs.python3.withPackages pythonPackages;
+
in
+
pkgs.mkShell {
- packages = [
+ packages = with pkgs; [
python
- pkgs.docker
- pkgs.rsync
- pkgs.python311Packages.requests
+ python311Packages.requests
+ docker
+ rsync
+ zsh
];
shellHook = ''
+ export PYTHONDONTWRITEBYTECODE=1
export ANSIBLE_ALLOW_BROKEN_CONDITIONALS=True
- export PYTHONDONTWRITEBYTECODE=1 # Keep Python from writing .pyc files
-
+ # TODO: remove ANSIBLE_INJECT_INVOCATION workaround when
+ # https://github.com/ansible-community/molecule-plugins/issues/363 is resolved
+ export ANSIBLE_INJECT_INVOCATION=true
- echo "=========================================================="
- echo "🚀 Ansible Molecule Development Environment is ready"
- echo "=========================================================="
+ echo "============================================"
+ echo "*** Ansible Molecule Development Environment"
+ echo "============================================"
echo "Installed Versions:"
python --version
ansible --version | head -n 1
molecule --version | head -n 1
- echo "=========================================================="
- echo "Using ANSIBLE_ALLOW_BROKEN_CONDITIONALS=True for molecule-plugins/docker"
+ echo "============================================"
echo "Run: molecule test -s default"
'';
}