From fe8ad912eb2efe72bbefc82d9a4e66099413961e Mon Sep 17 00:00:00 2001 From: Fabio Scotto di Santolo Date: Wed, 22 Apr 2026 11:51:24 +0200 Subject: [PATCH] Add rustup bootstrap task before source tool builds --- .../profile_desktop_common/tasks/main.yml | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/ansible/roles/profile_desktop_common/tasks/main.yml b/ansible/roles/profile_desktop_common/tasks/main.yml index c283e5e..e429eba 100644 --- a/ansible/roles/profile_desktop_common/tasks/main.yml +++ b/ansible/roles/profile_desktop_common/tasks/main.yml @@ -452,6 +452,35 @@ - (desktop_flatpak_extensions | default([])) | length > 0 - item | length > 0 +- name: Bootstrap rustup toolchain installer + tags: [packages] + block: + - name: Check whether rustup is initialized + ansible.builtin.stat: + path: "{{ user_home }}/.cargo/bin/rustc" + register: rustup_initialized + + - name: Run rustup-init with cargo env sourced + ansible.builtin.shell: + cmd: . ~/.cargo/env && rustup-init -y --no-modify-path + creates: "{{ user_home }}/.cargo/bin/rustc" + become_user: "{{ username }}" + environment: + HOME: "{{ user_home }}" + when: not rustup_initialized.stat.exists + + - name: Ensure cargo env is sourced in shell profile + ansible.builtin.lineinfile: + path: "{{ user_home }}/.bashrc" + regexp: '\. cargo/env' + line: . "$HOME/.cargo/env" + state: present + create: true + mode: "0644" + become_user: "{{ username }}" + when: not rustup_initialized.stat.exists + when: desktop_source_tools | length > 0 + - name: Build and install desktop source tools tags: [packages] ansible.builtin.include_tasks: