dotfiles/roles/nix/tasks/configuration.yml

59 lines
1.5 KiB
YAML

---
# 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
- name: Assure configuration folder exists
ansible.builtin.file:
path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config"
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:
name: "{{ ansible_user_id }}"
groups: nix-users
append: true
become: true
- name: Assure configuration folder exists
ansible.builtin.file:
path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config"
state: directory
- name: Adding configuration to local user
ansible.builtin.file:
src: "{{ dotfdir }}/nix"
dest: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config/nix"
state: link