guix.yml 1.62 KB
Newer Older
Todor Kondic's avatar
Todor Kondic committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- name: Get the GPG key to authenticate GNU Guix.
  ansible.builtin.command:
    cmd: sh -c 'wget ''https://sv.gnu.org/people/viewgpg.php?user_id=15145'' -qO - | sudo -i gpg --import - && touch /etc/guix.key.fetched'
    creates: /etc/guix.key.fetched

- name: Copy the guix install script.
  ansible.builtin.copy:
    src: files/etc/installguix.sh
    dest: /etc/installguix.sh
    owner: root
    group: root
    mode: '0744'


- name: Run the guix install script.
Todor Kondic's avatar
Todor Kondic committed
16
17
18
  shell: yes | /etc/installguix.sh
  args:
    warn: no
Todor Kondic's avatar
Todor Kondic committed
19
20
21
22
23
24
25
    creates: /var/guix/profiles/per-user/root/current-guix/bin/guix

- name: Create .config/guix.
  file:
    path: "/home/{{ item['login'] }}/.config/guix"
    state: directory
    recurse: yes
Todor Kondic's avatar
Todor Kondic committed
26
    force: no
Todor Kondic's avatar
Todor Kondic committed
27
28
  become_user: "{{ item['login'] }}"
  loop: "{{ users }}"
Todor Kondic's avatar
Todor Kondic committed
29
  ignore_errors: yes
Todor Kondic's avatar
Todor Kondic committed
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
    

- name: Copy channels.
  copy:
    src: files/home/user/.config/guix/channels.scm
    dest: "/home/{{ item.login }}/.config/guix/channels.scm"
  become_user: "{{ item.login }}"
  loop: "{{ users }}"
    
- name: Guix pull everywhere.
  command:
    cmd: /usr/bin/bash -l -c 'guix pull'
  become_user: "{{ item.login }}"
  loop: "{{ users }}"
  tags: guix-pull



- name: Run guix pull as root.
  tags: guix-pull
  command:
    cmd: guix pull

- name: Copy package manifest.
  copy:
    src: files/etc/guix_manifest.scm
    dest: /etc/guix_manifest.scm
57
58
  tags: guix-inst-pkg

Todor Kondic's avatar
Todor Kondic committed
59
60
- name: Install packages.
  command:
Todor Kondic's avatar
...    
Todor Kondic committed
61
    cmd: /usr/bin/bash -l -c 'guix package -c4 -m /etc/guix_manifest.scm --fallback'
Todor Kondic's avatar
Todor Kondic committed
62
63
  tags: guix-inst-pkg
  become_user: "{{ item.login }}"
Todor Kondic's avatar
...    
Todor Kondic committed
64
  retries: 20
Todor Kondic's avatar
...    
Todor Kondic committed
65
66
67
  delay: 5
  register: result
  until: result.rc == 0
Todor Kondic's avatar
Todor Kondic committed
68
  loop: "{{ users }}"