Skip to content

Commit

Permalink
Merge pull request #434 from staticdev/feature/home-manager
Browse files Browse the repository at this point in the history
Add Home Manager
  • Loading branch information
staticdev authored Jan 11, 2024
2 parents d5ed18d + e621ed2 commit d26380e
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 7 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
- Development: [Golang], [NodeJs] and [Python tools].
- IDEs: [VSCodium] and [Pycharm] installation.
- Browsers: [Firefox] ESR replacement with official PPA and configuration; and [Brave] installation.
- Package manager installation: [Nix].
- Package manager installation: [Nix] and [Home Manager].
- Packages intallation: apt, nix, snap, pip, npm, ruby gems.
- Replaces [LibreOffice] with [OnlyOffice].
- Assorted FOSS programs: [Cryptomator], [KeyPass], [OBS], [OpenRGB], [RClone], and [Signal] messenger installation.
Expand Down Expand Up @@ -194,6 +194,7 @@ This project was inspired by [@geerlingguy]'s [Mac Development Ansible Playbook]
[git]: https://git-scm.com/
[gnome]: https://www.gnome.org/
[golang]: https://go.dev/
[home manager]: https://github.com/nix-community/home-manager
[libreoffice]: https://www.libreoffice.org/
[nodejs]: https://nodejs.org/
[keypass]: https://keepass.info/
Expand Down
11 changes: 5 additions & 6 deletions default.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ installed_packages:
- podman # see https://github.com/NixOS/nixpkgs/issues/138423

Check failure on line 14 in default.config.yml

View workflow job for this annotation

GitHub Actions / pre-commit-auto-update

yaml[comments]

Too few spaces before comment

Check failure on line 14 in default.config.yml

View workflow job for this annotation

GitHub Actions / pre-commit-auto-update

yaml[comments]

Too few spaces before comment

Check failure on line 14 in default.config.yml

View workflow job for this annotation

GitHub Actions / pre-commit-auto-update

yaml[comments]

Too few spaces before comment
- poedit

install_home_manager: true
nix_packages:
- name: kubectl
check_cmd: kubectl version --client
Expand Down Expand Up @@ -82,13 +83,11 @@ nodejs_version: "20.x"
## Python settings
python_developer: true
pyenv_python_versions:
- 3.12.0
- 3.11.4
- 3.10.12
- 3.12.1
- 3.11.7
pyenv_global:
- 3.12.0
- 3.11.4
- 3.10.12
- 3.12.1
- 3.11.7
pyenv_virtualenvs: []

# IDEs
Expand Down
4 changes: 4 additions & 0 deletions main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
ansible.builtin.include_tasks: tasks/packages.yml
when: install_packages

- name: Install Home Manager
ansible.builtin.include_tasks: tasks/home-manager.yml
when: install_home_manager

- name: Install zsh
ansible.builtin.include_tasks: tasks/zsh.yml
when: install_zsh
Expand Down
31 changes: 31 additions & 0 deletions tasks/home-manager.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
- name: Check installation of Home Manager
ansible.builtin.command: home-manager --version
environment:
PATH: "{{ ansible_env.HOME + '/.nix-profile/bin:$PATH' }}"
register: home_manager_cmd
changed_when: false
ignore_errors: true

- name: Add Home Manager channel
when: home_manager_cmd is failed
ansible.builtin.command: "nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager"
environment:
PATH: "{{ ansible_env.HOME + '/.nix-profile/bin:$PATH' }}"
changed_when: false

- name: Get channel updates
when: home_manager_cmd is failed
ansible.builtin.command: "nix-channel --update"
environment:
PATH: "{{ ansible_env.HOME + '/.nix-profile/bin:$PATH' }}"
changed_when: false

- name: Add Home Manager
when: home_manager_cmd is failed
ansible.builtin.command: "nix-shell '<home-manager>' -A install"
environment:
PATH: "{{ ansible_env.HOME + '/.nix-profile/bin:$PATH' }}"
# workaround of https://github.com/nix-community/home-manager/issues/3944
USER: $(id -un)
changed_when: true

0 comments on commit d26380e

Please sign in to comment.