diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..dea8aca --- /dev/null +++ b/Makefile @@ -0,0 +1,60 @@ +# Ansible options +ansible_user ?= ephase +ansible_roles := deps +ansible_options ?= --diff +ansible_playbook ?= playbook.yml +ansible_req ?= requirements.yml +# venv options +venv_source ?= .venv +venv_cmd := . $(venv_source)/bin/activate + +#Python +python_bin ?= python +pip_req ?= requirements.txt + +.PHONY: inventory +inventory: + ansible-inventory --graph -i inventory.ini + +deps: $(ansible_req) $(venv_source)/dep + $(shell mkdir -p $(ansible_roles)) +ifeq ($(wildcard $(ansible_req)),) + $(error there is not requirements.yml file in $(ansible_data)!) +endif + $(venv_cmd) && ansible-galaxy install \ + --ignore-errors \ + --roles-path="$(ansible_roles)" \ + --role-file="$(ansible_req)" + +.PHONY: check-syntax +check-syntax: deps + $(venv_cmd) && ansible-playbook -i inventory.ini \ + --syntax-check $(ansible_playbook) + +.PHONY: dry-run +dry-run: deps + $(venv_cmd) && ansible-playbook -i inventory.ini \ + --check $(ansible_options) $(ansible_playbook) \ + -u $(ansible_user) + +.PHONY: run +run: deps + $(venv_cmd) && ansible-playbook -i inventory.ini \ + $(ansible_options) $(ansible_playbook) \ + -u $(ansible_user) + +.PHONY: clean +clean: clean-venv + [ -d $(ansible_roles) ] && rm -rf $(ansible_roles) + +# venv management +$(venv_source): + $(python_bin) -m venv $(venv_source) + +$(venv_source)/dep: $(venv_source) $(pip_req) + touch $(venv_source)/dep + $(venv_cmd) && pip install -r $(pip_req) + +.PHONY: clean-venv +clean-venv: + [ -d $(venv_source) ] && rm -rf $(venv_source) diff --git a/Taskfile.dist.yaml b/Taskfile.dist.yaml deleted file mode 100644 index d85921e..0000000 --- a/Taskfile.dist.yaml +++ /dev/null @@ -1,41 +0,0 @@ ---- -version: "3" -set: [errexit, pipefail, nounset] -shopt: [globstar] -env: - ANSIBLE_OPTIONS: --diff --become-method=doas -K - ANSIBLE_PLAYBOOK: playbook.yml - ANSIBLE_USER: ephase - -tasks: - inventory: - cmds: - - ansible-inventory --graph -i inventory.ini - - dryrun: - deps: - - install:deps - cmds: - - | - ansible-playbook -i inventory.ini \ - --check {{.ANSIBLE_OPTIONS}} {{.ANSIBLE_PLAYBOOK}} \ - -u {{ .ANSIBLE_USER }} - run: - deps: - - install:deps - cmds: - - | - ansible-playbook -i inventory.ini \ - {{.ANSIBLE_OPTIONS}} {{.ANSIBLE_PLAYBOOK}} \ - -u {{.ANSIBLE_USER}} - - install:deps: - internal: true - cmds: - - | - ansible-galaxy install \ - --ignore-errors \ - --roles-path="deps/" \ - --role-file="requirements.yml" - sources: - - requirements.yaml diff --git a/flake.lock b/flake.lock deleted file mode 100644 index 69a8112..0000000 --- a/flake.lock +++ /dev/null @@ -1,60 +0,0 @@ -{ - "nodes": { - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1725103162, - "narHash": "sha256-Ym04C5+qovuQDYL/rKWSR+WESseQBbNAe5DsXNx5trY=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "12228ff1752d7b7624a54e9c1af4b222b3c1073b", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixos-unstable", - "type": "indirect" - } - }, - "root": { - "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/flake.nix b/flake.nix deleted file mode 100644 index 11b2e70..0000000 --- a/flake.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ - description = "Devshel for Ansible"; - - - inputs = { - nixpkgs.url = "nixpkgs/nixos-unstable"; - flake-utils = { - url = "github:numtide/flake-utils"; - }; - }; - - outputs = { nixpkgs , flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system: - let - pkgs = import nixpkgs { - inherit system; - }; - in { - devShells = { - default = pkgs.mkShell { - nativeBuildInputs = with pkgs; [ - lefthook - go-task - convco - typos - ansible - ]; - shellHook = '' - ''; - }; - }; - }); -} diff --git a/lefthook.yaml b/lefthook.yaml deleted file mode 100644 index 76a8dd0..0000000 --- a/lefthook.yaml +++ /dev/null @@ -1,21 +0,0 @@ ---- -skip_output: [meta, success] -no_tty: true - -commit-msg: - commands: - lint:convco: - run: cat {1} | convco check --from-stdin - lint:typos: - run: cat {1} | typos - -pre-commit: - parallel: false - commands: - lint:typos:staged_files: - run: typos {staged_files} -pre-push: - parallel: false - commands: - check:nix: - tags: check - run: nix flake check diff --git a/playbook.yml b/playbook.yml index ad8d925..5d721b4 100644 --- a/playbook.yml +++ b/playbook.yml @@ -36,6 +36,33 @@ mode: '0640' directory_mode: '0750' + - name: Install packages + ansible.builtin.package: + pkg: + - zsh + - pass + - vifm + - cmus + - unzip + state: present + become: true + + - name: Clone my zsh repository + ansible.builtin.git: + repo: ssh://git@git.epha.se:24422/ephase/zsh_config.git + dest: '{{ ansible_user_dir }}/.config/zsh' + + - name: Symlink .zshenv to ~ + ansible.builtin.file: + src: '{{ ansible_user_dir }}/.config/zsh/.zshenv' + dest: '{{ ansible_user_dir }}/.zshenv' + state: link + + - name: Clone my neovim repository + ansible.builtin.git: + repo: ssh://git@git.epha.se:24422/ephase/nvim_config.git + dest: '{{ ansible_user_dir }}/.config/nvim' + - name: Launch Sway related roles hosts: all roles: @@ -47,9 +74,28 @@ - ansible-swayidle - ansible-waybar -- name: Install some stuff +- name: Configure desktop hosts: all tasks: + - name: Install packages on Arch + ansible.builtin.package: + pkg: + - arc-solid-gtk-theme + - glib2 + - pinentry + - gcr + - libnotify + - opensc + - qt5-wayland + - ttf-dejavu + - ttf-fira-code + - ttf-joypixels + - ttf-liberation + - ttf-linux-libertine + - xorg-xwayland + when: ansible_distribution == "Archlinux" + become: true + - name: Install packages on Debian ansible.builtin.package: pkg: @@ -68,6 +114,7 @@ - pcscd - pcsc-tools - pulseaudio-utils + - qtwayland5 - scdaemon - texlive - webext-browserpass @@ -80,16 +127,27 @@ pkg: - papirus-icon-theme - brightnessctl + - chafa + - firefox - foot - foot-terminfo - fuzzel + - fzf + - highlight + - hugo - imv + - khal + - khard + - npm - mpv - ntfs-3g - pipewire - pipewire-pulse + - qutebrowser + - rsync - sshfs - udisks2 + - vdirsyncer - wireplumber - xdg-desktop-portal-wlr - xdg-user-dirs