diff --git a/README.md b/README.md index ca6bc87..2747575 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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/ diff --git a/default.config.yml b/default.config.yml index 15ef961..f22b052 100644 --- a/default.config.yml +++ b/default.config.yml @@ -14,6 +14,7 @@ installed_packages: - podman # see https://github.com/NixOS/nixpkgs/issues/138423 - poedit +install_home_manager: true nix_packages: - name: kubectl check_cmd: kubectl version --client @@ -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 diff --git a/main.yml b/main.yml index 3201f95..b7ab6ef 100644 --- a/main.yml +++ b/main.yml @@ -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 diff --git a/tasks/home-manager.yml b/tasks/home-manager.yml new file mode 100644 index 0000000..ca83001 --- /dev/null +++ b/tasks/home-manager.yml @@ -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 '' -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