Enforce Ansible availability via Nix and validate requirements.yml
- Add ansiblePkg as propagated dependency in flake.nix so ansible-galaxy is available on host - Introduce strict requirements.yml validator for AnsibleRequirementsInstaller - Accept roles entries with either 'name' or 'src' - Ensure run() always validates requirements before installing dependencies - Extend unit tests to cover valid, invalid and warning-only requirements.yml cases See: https://chatgpt.com/share/69332bc4-a128-800f-a69c-fdc24c4cc7fe
This commit is contained in:
44
flake.nix
44
flake.nix
@@ -43,27 +43,33 @@
|
||||
);
|
||||
|
||||
# Packages: nix build .#pkgmgr / .#default
|
||||
packages = forAllSystems (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
python = pkgs.python311;
|
||||
pypkgs = pkgs.python311Packages;
|
||||
packages = forAllSystems (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
python = pkgs.python311;
|
||||
pypkgs = pkgs.python311Packages;
|
||||
|
||||
pkgmgrPkg = pypkgs.buildPythonApplication {
|
||||
pname = "package-manager";
|
||||
version = "0.1.0";
|
||||
src = ./.;
|
||||
# Be robust: ansible-core if available, otherwise ansible.
|
||||
ansiblePkg =
|
||||
if pkgs ? ansible-core then pkgs.ansible-core
|
||||
else pkgs.ansible;
|
||||
in
|
||||
rec {
|
||||
pkgmgr = pypkgs.buildPythonApplication {
|
||||
pname = "package-manager";
|
||||
version = "0.1.0";
|
||||
src = ./.;
|
||||
|
||||
propagatedBuildInputs = [
|
||||
pypkgs.pyyaml
|
||||
# add further dependencies here
|
||||
];
|
||||
};
|
||||
in {
|
||||
pkgmgr = pkgmgrPkg;
|
||||
default = pkgmgrPkg;
|
||||
}
|
||||
);
|
||||
propagatedBuildInputs = [
|
||||
pypkgs.pyyaml
|
||||
ansiblePkg
|
||||
];
|
||||
};
|
||||
|
||||
# default package just points to pkgmgr
|
||||
default = pkgmgr;
|
||||
}
|
||||
);
|
||||
|
||||
# Apps: nix run .#pkgmgr / .#default
|
||||
apps = forAllSystems (system:
|
||||
|
||||
Reference in New Issue
Block a user