Skip to content

labasubagia/dotfiles

Repository files navigation

DOTFILES

Overview

This project aims to manage and configure a Linux environment using a combination of Ansible (mainly use for Debian) and Nix. By leveraging Ansible for general system configuration tasks and Nix for package management and reproducible builds, we ensure a robust, declarative setup for linux systems.

Table of Contents

Getting Started

In this project, you have the flexibility to use Ansible, Nix, or a combination of both to configure your system. Each tool offers unique strengths, and using them together can provide a comprehensive, powerful approach to managing your environment.

Ansible

Prerequisite

Configure system

  • Copy inventory file
    cp ansible/inventory.example.yml ansible/inventory.yml
  • Configure inventory.yml (just example)
    debian: # can use other name
      hosts:
        your_host:
          ansible_host: 192.168.1.100 # better set static IP address
          ansible_user: user
          ansible_become_pass: password
          connection: ssh
          ansible_ssh_pass: password
  • Option 1, Run specific task
    ansible-playbook ansible/playbooks/_handler.yml \
      -i ansible/inventory.yml \
      -e task_file="ansible/tasks/tools/neovim/setup-common.yml" \
      -e '{"is_remove": false}'
  • Option 2, Run specific playbook for specific system
    # run by default using ssh
    ansible-playbook ansible/playbooks/debian.yml \
      -i ansible/inventory.yml \
      -e '{"is_remove": false}'
    
    # or run ansible against localhost
    ansible-playbook ansible/playbooks/nixos.yml \
      -i ansible/inventory.yml \
      -e _hosts="localhost" \
      -e _connection="local" \
      -e '{"is_remove": false}'

Known Limitations

  • Ansible task currently not support for reading current path from task file, only accessible from playbook_dir. Workaround for this is using root of this project as workdir variable that passed to all task-file.
  • It's not as robust as nix, installation and deletion sometime break
  • Linter sometime giving false positive message (some cases with path/directory related problem).
  • PATH in shell often not updated while using ssh, so better develop using ssh for testing.

Nix

Prerequisite

Note: Example can be seen in Nix Readme

Configure system

  • Move into nix
    cd nix
  • Example to configure NixOS (hostname=vbox)
    sudo nixos-rebuild switch --flake .#vbox
  • Example configure Home-Manager (username=demo,hostname=vbox)
    home-manager switch --flake .#demo@vbox

Known Limitations

  • Challenging to setup programming language development environment (sometime need to take a look to project like npm2nix, poetry2nix, etc)
  • Nix mostly use symlink, which is difficult for binding into containerized apps (docker, dev-container)

License

MIT

About

dotfile ansible (debian) and nix

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages