1
0
Fork 0

Add a role to configure cargo

This commit is contained in:
Daniele Tricoli 2023-02-27 19:54:05 +01:00
parent bc61b9eb7e
commit e99f9281cc
3 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
cargo_become_admin: true
cargo_become_admin_user: root
cargo_become: true
cargo_become_user: "{{ lookup('env', 'USER') }}"

View File

@ -0,0 +1,32 @@
---
- name: install dependencies
ansible.builtin.apt:
name:
- clang
- lld
update_cache: true
cache_valid_time: 3600
tags: apt
become: "{{ cargo_become_admin }}"
become_user: "{{ cargo_become_admin_user }}"
- block:
- name: ensure ~/.cargo/config.toml exist
ansible.builtin.file:
path: ~/.cargo/config.toml
owner: "{{ cargo_become_user }}"
mode: '0640'
state: touch
- name: Use ldd linker
ansible.builtin.blockinfile:
path: ~/.cargo/config.toml
block: |
[target.x86_64-unknown-linux-gnu]
rustflags = ["-C", "linker=clang", "-C", "link-arg=-fuse-ld=lld"]
become: "{{ cargo_become }}"
become_user: "{{ cargo_become_user }}"

View File

@ -20,6 +20,7 @@
- ../roles/direnv
- ../roles/starship
- ../roles/xinitrc
- ../roles/cargo
- ../roles/cargo_install
- ../roles/go_install
- ../roles/msmtp