dotfiles/roles/nix/tasks/configuration.yml

54 lines
1.4 KiB
YAML
Raw Normal View History

---
# Configuring the nix installation.
- name: Manipulation over {{ additional_user }}
when: ansible_user_id == 'root'
tags:
- nix
- nix-config
block:
- name: Adding user to nix-users
ansible.builtin.user:
name: "{{ additional_user }}"
groups: nix-users
append: true
become_user: root
become: true
2024-12-15 00:02:45 +01:00
- name: Assure configuration folder exists
ansible.builtin.file:
2024-12-15 00:05:04 +01:00
path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config"
2024-12-15 00:02:45 +01:00
state: directory
owner: "{{ additional_user }}"
become: true
become_user: "{{ additional_user }}"
- name: Adding configuration to local user
ansible.builtin.file:
src: "{{ dotfdir }}/nix"
dest: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config/nix"
state: link
become_user: "{{ additional_user }}"
become: true
- name: Manipulation over {{ ansible_user_id }}
when: ansible_user_id != 'root'
tags:
- nix
- nix-config
block:
- name: Adding user to nix-users
ansible.builtin.user:
2024-10-15 20:30:18 +02:00
name: "{{ ansible_user_id }}"
groups: nix-users
append: true
become: true
- name: Adding configuration to local user
ansible.builtin.file:
src: "{{ dotfdir }}/nix"
dest: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config/nix"
state: link