Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nix flakes #393

Merged
merged 1 commit into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ jobs:
run: pip3 install --constraint=.github/workflows/constraints.txt ansible 'molecule-plugins[podman]' podman

- name: Run Molecule tests
run: molecule test
run: molecule -v test
env:
PY_COLORS: "1"
ANSIBLE_FORCE_COLOR: "1"
MOLECULE_DISTRO: ${{ matrix.distro }}
XDG_CONFIG_HOME: ""
29 changes: 29 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,35 @@ vagrant up

The default password for root in the VM is `vagrant`.

#### Enabling contrib / non-free / non-free-firmware

Keep in mind one maybe need extra steps to enable extra apt packages eg. to install `torbrowser-launcher` (from contrib) or `firmware-amd-graphics` (from non-free-firmware):

1. comment out provision part of `Vagrant`:

```
# Run playbook
#config.vm.provision "ansible" do |ansible|
# ansible.playbook = "main.yml"
# ansible.verbose = "vv"
#end
```

1. run `vagrant up` and then `vagrant login`
1. edit `/etc/apt/sources.list` to add the desired streams eg.:

```
deb https://deb.debian.org/debian bookworm main contrib non-free-firmware
deb-src https://deb.debian.org/debian bookworm main contrib non-free-firmware
deb https://deb.debian.org/debian bookworm-updates main contrib non-free-firmware
deb-src https://deb.debian.org/debian bookworm-updates main contrib non-free-firmware
deb https://deb.debian.org/debian-security bookworm-security main contrib non-free-firmware
deb-src https://deb.debian.org/debian-security bookworm-security main contrib non-free-firmware
deb https://deb.debian.org/debian bookworm-backports main contrib non-free-firmware
deb-src https://deb.debian.org/debian bookworm-backports main contrib non-free-firmware
```
1. run `vagrant provision`

## How to submit changes

Open a [pull request] to submit changes to this project.
Expand Down
2 changes: 1 addition & 1 deletion tasks/keypass-xc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- name: Install Keepass XC
when: keepass_xc_cmd is failed
ansible.builtin.command:
cmd: nix-env -iA nixpkgs.keepassxc
cmd: nix profile install nixpkgs#keepassxc
environment:
PATH: "{{ ansible_env.HOME + '/.nix-profile/bin:$PATH' }}"
changed_when: true
2 changes: 1 addition & 1 deletion tasks/office.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
- name: Install OnlyOffice
when: onlyoffice_version_cmd is failed
ansible.builtin.command:
cmd: nix-env -iA nixpkgs.onlyoffice-bin
cmd: nix profile install nixpkgs#onlyoffice-bin
environment:
PATH: "{{ ansible_env.HOME + '/.nix-profile/bin:$PATH' }}"
changed_when: true
Expand Down
8 changes: 5 additions & 3 deletions tasks/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
- name: Install Nix package manager
ansible.builtin.import_role:
name: ableton.nix
vars:
nix_flakes: true

- name: Add Nix to bash PATH
ansible.builtin.lineinfile:
Expand All @@ -30,7 +32,7 @@
insertafter: EOF
state: present

- name: "Check installation of Nix package {{ item.name }}"
- name: "Check installation of Nix packages"
ansible.builtin.command: "{{ item.check_cmd }}"
environment:
PATH: "{{ ansible_env.HOME + '/.nix-profile/bin:$PATH' }}"
Expand All @@ -41,8 +43,8 @@
loop_control:
index_var: package_index

- name: "Install Nix package {{ item.name }}"
ansible.builtin.command: "nix-env -iA nixpkgs.{{ item.name }}"
- name: "Install Nix packages"
ansible.builtin.command: "nix profile install nixpkgs#{{ item.name }}"
environment:
PATH: "{{ ansible_env.HOME + '/.nix-profile/bin:$PATH' }}"
when: package_check_cmd.results[package_index].failed
Expand Down
4 changes: 2 additions & 2 deletions tasks/pycharm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
- name: Install Pycharm professional
when: pycharm_version_cmd is failed
ansible.builtin.command:
cmd: nix-env -iA nixpkgs.jetbrains.pycharm-professional --impure
cmd: nix profile install nixpkgs#jetbrains.pycharm-professional --impure
environment:
NIXPKGS_ALLOW_UNFREE: "1"
PATH: "{{ ansible_env.HOME + '/.nix-profile/bin:$PATH' }}"
Expand All @@ -31,7 +31,7 @@
- name: Install Pycharm community
when: pycharm_version_cmd is failed
ansible.builtin.command:
cmd: nix-env -iA nixpkgs.jetbrains.pycharm-community
cmd: nix profile install nixpkgs#jetbrains.pycharm-community
environment:
PATH: "{{ ansible_env.HOME + '/.nix-profile/bin:$PATH' }}"
changed_when: true