From feecf401e927df7e48a06e8c03ba67d0217577e5 Mon Sep 17 00:00:00 2001 From: staticdev Date: Fri, 29 Dec 2023 17:59:11 +0100 Subject: [PATCH] Add Home Manager --- README.md | 3 ++- default.config.yml | 1 + main.yml | 4 ++++ tasks/home-manager.yml | 18 ++++++++++++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 tasks/home-manager.yml 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 b903be0..6e8ca52 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 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..39ebccd --- /dev/null +++ b/tasks/home-manager.yml @@ -0,0 +1,18 @@ +--- +- name: "Add home-manager channel" + 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" + ansible.builtin.command: "nix-channel --update" + environment: + PATH: "{{ ansible_env.HOME + '/.nix-profile/bin:$PATH' }}" + changed_when: false + +- name: "Add Home Manager" + ansible.builtin.command: "nix-shell '' -A install" + environment: + PATH: "{{ ansible_env.HOME + '/.nix-profile/bin:$PATH' }}" + changed_when: true