yutkat/dotfiles

repository·main·Indexed 21 days ago

https://github.com/yutkat/dotfiles

A collection of personal dotfiles managed via Nix (Flakes and Home Manager) and mise, supporting NixOS and other Linux distributions. Includes configurations for WezTerm, Hyprland, i3, and sway, as well as a sandboxed Neovim egress bridge (nvbr0.service) and a curated set of CLI development tools.

Tokens
2.1K
Snippets
9
Records
11
Agent score
76%

What's inside yutkat-dotfiles

  1. Install dotfiles on other Operating Systems

    main

    For non-NixOS systems (e.g., Arch Linux, Ubuntu, Fedora), use home-manager to manage the environment and mise to link dotfiles.

    1. Clone the repository and edit flake.nix as described in the NixOS guide.
    2. Run ./install.sh to install Nix, flake, and home-manager.
    3. Apply the home-manager configuration:
      • For the default user/hostname: home-manager switch --flake .#<hostname>
      • If overriding the username: NIX_USERNAME=your_username home-manager switch --impure --flake .#<hostname>
    4. Link dotfiles using mise.
      • First run only: Since ~/.config/mise is not yet linked, you must point mise to the repo's config:
        mise trust .config/mise/config.toml
        MISE_GLOBAL_CONFIG_FILE="$PWD/.config/mise/config.toml" mise dotfiles apply
      • Subsequent runs: mise dotfiles apply
    5. Complete post-install setup (zsh, mise upgrade, and Neovim plugin sync) as detailed in the NixOS guide.
    home-manager switch --flake .#<hostname>
    # If overriding username:
    NIX_USERNAME=your_username home-manager switch --impure --flake .#<hostname>
    
    # Link dotfiles (First run):
    MISE_GLOBAL_CONFIG_FILE="$PWD/.config/mise/config.toml" mise dotfiles apply
  2. Temporary installation using Docker

    main

    To test the dotfiles without modifying your host system, you can run them inside an Arch Linux container:

    1. Start a container:
      docker run -it --rm archlinux:latest /bin/bash
    2. Set up the environment (sudo, git, and a test user):
       ```bash
    pacman -Sy --noconfirm sudo git
    useradd -m -s /bin/bash test
    echo 'test ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
    su - test
    1. Clone the repo and run the installer with the --single flag:
      git clone https://github.com/yutkat/dotfiles.git
      cd dotfiles
      ./install.sh --single
      exec bash
    4. Apply the configuration for the test user:
       ```bash
    home-manager switch --flake .#test
    1. Run post-install commands (zsh, mise, and Neovim sync).
    docker run -it --rm archlinux:latest /bin/bash
    ./install.sh --single
    home-manager switch --flake .#test
  3. Enable udev hardware database changes

    main

    After copying new udev configuration files to the system, you must execute the following commands to update the hardware database, reload the rules, and trigger the changes across the system:

    1. Update the hardware database: sudo udevadm hwdb --update
    2. Reload the udev rules: sudo udevadm control --reload-rules
    3. Trigger the new rules: sudo udevadm trigger
    sudo udevadm hwdb --update
    
    sudo udevadm control --reload-rules
    
    sudo udevadm trigger
  4. Finalize nvbr0 bridge setup with home-manager and tinyproxy

    main

    After installing the service and configuring the firewall, apply your home-manager configuration and restart the Neovim proxy service to complete the setup.

    home-manager switch --flake ~/dotfiles#X1C10
    systemctl --user restart tinyproxy-nvim
  5. Install dotfiles on NixOS

    main

    To install these dotfiles on a NixOS system, follow these steps:

    1. Clone the repository:
      git clone https://github.com/yutkat/dotfiles.git
      cd dotfiles
    2. Edit flake.nix to configure your myHosts.
    3. Run the installation script to install Nix (with flake and home-manager support):
      ./install.sh
    4. Apply the configuration using nixos-rebuild:
      sudo nixos-rebuild switch --flake .#<hostname>
    5. Complete the post-install setup:
      • Reload zsh: exec zsh
      • Upgrade mise: mise upgrade
      • Sync Neovim plugins: vi --headless -c 'Lazy! sync' -c 'qall'
    git clone https://github.com/yutkat/dotfiles.git
    cd dotfiles
    ./install.sh
    sudo nixos-rebuild switch --flake .#<hostname>
  6. Install the nvbr0.service sandboxed Neovim egress bridge

    main

    The nvbr0.service creates an isolated, uplink-less bridge (nvbr0 with IP 10.123.45.1/24) designed to serve as the sole egress path for the Neovim wall using firejail --net=nvbr0. This service is intended for non-NixOS hosts.

    To install, copy the service file to the systemd directory, ensure NetworkManager does not manage the bridge, and enable the service.

    sudo cp ~/dotfiles/system-etc/systemd/system/nvbr0.service /etc/systemd/system/
    
    # If NetworkManager is in use, prevent it from managing the bridge:
    sudo cp ~/dotfiles/system-etc/NetworkManager/conf.d/nvbr0-unmanaged.conf /etc/NetworkManager/conf.d/
    sudo systemctl reload NetworkManager
    
    sudo systemctl daemon-reload
    sudo systemctl enable --now nvbr0.service
    
    # Verify the bridge is UP with the correct IP:
    ip -br addr show nvbr0          # expect 10.123.45.1/24, UP
  7. Configure host firewalls for nvbr0.service

    main

    If your host has an active firewall, you must allow inbound traffic on the nvbr0 interface to reach the proxy port. Use the following commands depending on your firewall manager.

    # nftables
    sudo nft add rule inet filter input iifname "nvbr0" accept
    
    # firewalld
    sudo firewall-cmd --permanent --zone=trusted --change-interface=nvbr0 && sudo firewall-cmd --reload
  8. Configure GPG and GPG Agent services

    main

    The configuration enables GPG support and configures the gpg-agent service with SSH support and specific cache settings.

    GPG Configuration:

    • programs.gpg.enable: Set to true to enable GPG.

    GPG Agent Configuration:

    • services.gpg-agent.enable: Enables the agent.
    • services.gpg-agent.enableSshSupport: Enables SSH support via the agent.
    • services.gpg-agent.pinentry.package: Uses pkgs.pinentry-curses for terminal-based pinentry.
    • services.gpg-agent.defaultCacheTtl: Sets the default cache TTL (604800 seconds).
    • services.gpg-agent.maxCacheTtl: Sets the maximum cache TTL (604800 seconds).
    programs = {
      gpg = {
        enable = true;
      };
    };
    services.gpg-agent = {
      enable = true;
      enableSshSupport = true;
      pinentry.package = pkgs.pinentry-curses;
      defaultCacheTtl = 604800;
      maxCacheTtl = 604800;
    };
  9. Available CLI packages in home-manager configuration

    main

    The home-manager configuration defines a set of installed CLI tools and packages. These are added to home.packages and are available in the user's environment upon application of the configuration.

    Key tools included:

    • Development: gcc, gnumake, nodejs, rustc, cargo, bun, node-gyp-build
    • File & Search: file, zip, unzip, eza, ripgrep, delta, bat, fd, procs, mmv-go, fzf, jq, yq-go
    • CLI Utilities: wakatime-cli, mise, direnv, nix-direnv, translate-shell, gh, ghq, zoxide, tldr, trashy, sqlite, wget, zsh
    home.packages = with pkgs; [
      gcc
      gnumake
      nodejs
      file
      zip
      unzip
      eza
      wakatime-cli
      mise
      direnv
      nix-direnv
      translate-shell
      gh
      ghq
      zoxide
      ripgrep
      delta
      tldr
      trashy
      bat
      fd
      procs
      mmv-go
      fzf
      sqlite
      jq
      yq-go
      zsh
      wget
      rustc
      cargo
      bun
      node-gyp-build
    ];