10 # the latest python version that waagent test against according to https://github.com/Azure/WALinuxAgent/blob/28345a55f9b21dae89472111635fd6e41809d958/.github/workflows/ci_pr.yml#L75
14 python.pkgs.buildPythonApplication rec {
16 version = "2.11.1.12";
17 src = fetchFromGitHub {
19 repo = "WALinuxAgent";
20 rev = "refs/tags/v${version}";
21 hash = "sha256-1MaPjz9hWb/kJxuyJAUWPk065vpSyx2jq1ZSlDB4yFo=";
24 # Suppress the following error when waagent tries to configure sshd:
25 # Read-only file system: '/etc/ssh/sshd_config'
26 ./dont-configure-sshd.patch
30 # Replace tools used in udev rules with their full path and ensure they are present.
32 substituteInPlace config/66-azure-storage.rules \
33 --replace-fail readlink ${coreutils}/bin/readlink \
34 --replace-fail cut ${coreutils}/bin/cut \
35 --replace-fail /bin/sh ${bash}/bin/sh
36 substituteInPlace config/99-azure-product-uuid.rules \
37 --replace-fail "/bin/chmod" "${coreutils}/bin/chmod"
40 propagatedBuildInputs = [ python.pkgs.distro ];
42 # The udev rules are placed to the wrong place.
43 # Move them to their default location.
44 # Keep $out/${python.sitePackages}/usr/sbin/waagent where it is.
45 # waagent re-executes itself in UpdateHandler.run_latest, even if autoupdate
46 # is disabled, manually spawning a python interprever with argv0.
47 # We can't use the default python program wrapping mechanism, as it uses
48 # wrapProgram which doesn't support --argv0.
49 # So instead we make our own wrapper in $out/bin/waagent, setting PATH and
51 # PATH contains our PYTHON, and PYTHONPATH stays set, so this should somewhat
54 mv $out/${python.sitePackages}/etc $out/
59 makeWrapper $out/${python.sitePackages}/usr/sbin/waagent $out/bin/waagent \
60 --set PYTHONPATH $PYTHONPATH \
61 --prefix PATH : $program_PATH \
62 --argv0 $out/${python.sitePackages}/usr/sbin/waagent
65 dontWrapPythonPrograms = false;
68 description = "Microsoft Azure Linux Agent (waagent)";
69 mainProgram = "waagent";
71 The Microsoft Azure Linux Agent (waagent)
72 manages Linux provisioning and VM interaction with the Azure
74 homepage = "https://github.com/Azure/WALinuxAgent";
75 license = with lib.licenses; [ asl20 ];