Skip to content

Latest commit

 

History

History
145 lines (110 loc) · 5.92 KB

installers.md

File metadata and controls

145 lines (110 loc) · 5.92 KB

Installer Guide

This repository provides separate scripts for installing packages, linking portable dotfiles, bootstrapping Paru, applying Git settings, and rebuilding Nix configurations. Run the scripts from the repository root unless noted otherwise.

Before you start

The portable installers read the untracked dotconf.sh. Create it from the example and adjust the options for the machine:

cp dotconf.example.sh dotconf.sh
Option Values Default Effect
i3 yes, no, auto auto Enables i3, X11 packages, and i3/X11 dotlist entries
sway yes, no, auto auto Enables Sway, Wayland packages, and Sway/Wayland dotlist entries
hyprland yes, no, auto auto Enables Hyprland and its dotlist/package entries
niri yes, no, auto auto in the example; no if omitted Enables niri and its dotlist/package entries
vm yes, no no Selects the VM-specific Sway config and installs WayVNC with Sway

For window managers, auto enables a scope when its executable is on PATH. The scripts apply the defaults shown in the table when an option is absent. gui is derived internally from the four window-manager options and cannot be set in dotconf.sh. x11 follows i3; wayland is enabled by Sway, Hyprland, or niri.

Invalid values or a missing dotconf.sh stop the relevant script before it changes the system.

./install.sh

This installs the selected portable dotfiles. It does not install packages.

./install.sh
./install.sh --dry-run
./install.sh --uninstall

The dry run previews the operation without changing $HOME or /etc. --uninstall removes symlinks recorded by a previous installation. It does not depend on the current dotlists or dotconf.sh, so it can remove links after their configuration has changed. --help displays usage; any other option is rejected.

The installer reads dotlist.home.txt for paths under $HOME and dotlist.etc.txt for paths under /etc. A path can contain * to select matching paths from the corresponding home/ or etc/ source tree, for example .config/i3/config.d/*.conf. Each match is linked separately. A selected pattern with no matches is an error. The installer preflights the expanded source paths and overlapping targets before changing anything. For each selected path it:

  1. Leaves a symlink alone when it already points to this repository.
  2. Moves a conflicting file, directory, or symlink to a unique directory under ~/.dotfiles-backup/install.XXXXXXXX or /etc/.dotfiles-backup/install.XXXXXXXX.
  3. Creates a symlink to the matching path in home/ or etc/.

After a successful installation, it records the managed paths and their source links in ${XDG_STATE_HOME:-$HOME/.local/state}/dotfiles/installed. On the next run, paths present in the previous record but absent from the current dotlists are removed only when they are still symlinks to this repository. Regular files and links to other locations are left untouched.

--uninstall uses the same record and removes only links that still point to the recorded source in this repository. Regular files and links changed to other locations are left untouched. After a successful non-dry-run uninstallation, the installed-path record is removed.

If a selected source path is a directory containing an executable dotmeta, the installer runs it from that directory and uses the file name printed to stdout as the symlink source. The selected name must be a single file name in that directory. This also applies to generated i3 and Sway configurations: home/.config/i3/config-gen/dotmeta and home/.config/sway/config-gen/dotmeta select config-rm or config-vm based on the installer settings. A directory without dotmeta keeps the normal directory-link behavior.

Paths under /etc use sudo when the script is not run as root. If installation fails after changes, it removes links created during that run, restores moved paths, and restores links removed from a previous installation record.

On NixOS, install.sh only runs when $HOME is under /tmp; this prevents accidental use against a regular NixOS home directory.

./scripts/install-packages.sh

This script detects the operating system with scripts/platform.sh and, on Linux, reads the distribution from /etc/os-release.

Platform Result
Arch Linux Installs missing packages with pacman -S --noconfirm --needed
Void Linux Installs packages with xbps-install -S -y
FreeBSD, OpenBSD, NetBSD, DragonFly BSD Stops with a not-implemented error
Other platforms or Linux distributions Stops with an unsupported-platform error

The selected package groups follow dotconf.sh. Both package managers run with the current user's permissions, so use an account authorized to install packages. See dependencies for the package groups.

./scripts/install-paru.sh

This Arch Linux helper installs base-devel with sudo pacman, clones the Paru AUR repository into /tmp/paru-aur, and runs makepkg -si there:

./scripts/install-paru.sh

It does not perform platform detection, validate prerequisites, or remove an existing /tmp/paru-aur. Use it only on an Arch-based system and inspect the target directory before rerunning it.

./scripts/setup-git.sh

This helper requires Git and writes these global settings for the current user:

  • user.name=Yuta
  • user.email=yuta256dev@gmail.com
  • init.defaultBranch=main
./scripts/setup-git.sh

Review or adapt the script before using it for another user.

Nix helpers

The root flake defines the laptop2 NixOS and Home Manager configurations:

./scripts/os-rebuild    # sudo nixos-rebuild switch --flake .
./scripts/home-rebuild  # home-manager switch --flake .#$HOSTNAME
./scripts/clean-gc      # remove old generations and collect the store

Inspect the scripts and the flake before applying them on a different host.