Skip to content

francojc/dotfiles

Repository files navigation

DOTFILES

This repository contains my personal dotfiles for configuring my development environment on MacOS/ NixOS.

Note

Before applying the new configurations, it's a good idea to back up your existing dotfiles. You can do this by renaming them or moving them to a backup directory.

MacOS

Prerequisites

Before restoring the dotfiles, ensure you have the following installed:

  1. Install Xcode Command Line Tools: Open your terminal and run:

    xcode-select --install
  2. Install Homebrew: Run the following command in your terminal:

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  3. Install Nix: Use the following command to install Nix using the Determinate Systems installer for macOS (multi-user install):

    curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install

    Check that your installation was successful by running:

    nix --version
  4. Bootstrap nix-darwin: After installing Nix, you can bootstrap nix-darwin by running the following commands:

    mkdir -p ~/.config/nix/
    cd ~/.config/nix/
    nix  flake init -t nix-darwin
    sed -i '' "s/simple/$(scutil --get LocalHostName)/" flake.nix

    You will then need to add nix.enable = false; to the ~/.config/nix/flake.nix file to allow nix-darwin to manage the Nix configuration.

    After that, you can run the following command to install nix-darwin:

    sudo nix run nix-darwin --extra-experimental-features "nix-command flakes" -- switch --flake ~/.config/nix

    Check to see that the installation was successful by running:

    type darwin-rebuild

Restoring Dotfiles

  1. Clone the repository:

    git clone --depth 1 https://github.com/francojc/dotfiles.git ~/.dotfiles
  2. Navigate to the dotfiles directory:

    cd ~/.dotfiles
  3. Remove any existing files that may conflict with the configurations:

    rm -rf ~/.zshrc ~/.zshenv ~/.zsh ~/.config/nix
  4. Make sure the flake.nix hostname to match the system hostname:

    To find the hostname, run the following command:

    hostname

    [!NOTE] You can update the hostname in macOS running sudo scutil --set LocalHostName <new-hostname>. I've also found that running sudo hostname -s <new-hostname> can help in some cases.

  5. Apply the configurations using the full path to the flake's directory:

    NIXPKGS_ALLOW_UNFREE=1 darwin-rebuild switch --flake ~/.dotfiles/.config/nix/#<yourhostname> --impure

    Note: After a successful switch, you will be able to use the alias switch to apply the configurations in the future.

  6. Use stow to symlink the configurations:

    cd ~/.dotfiles
    stow .

NixOS

This repository supports NixOS systems with a modular configuration system and flexible desktop environment profiles that mirror the macOS setup approach.

Available Host Configurations

This dotfiles repository includes a NixOS host example with a modular desktop environment system:

Mini-Rover Host (Traditional X11 Setup)

  • Desktop Environment: i3 (X11 window manager)
  • Applications: Traditional Linux desktop applications
  • Features: XRDP remote desktop support, X11 compatibility
  • Best for: Servers, older hardware, remote access scenarios, Mac Mini 2011

Note

This configuration uses a modular profile system with separate desktop environment configurations in profiles/nixos/

Prerequisites

Before setting up the NixOS configuration, ensure you have the following:

  1. NixOS Installation: A working NixOS system (minimal installation is sufficient)

  2. Flakes Support: Enable experimental features by adding to /etc/nixos/configuration.nix:

    nix.settings.experimental-features = [ "nix-command" "flakes" ];

    Then rebuild: sudo nixos-rebuild switch

  3. Git: Install Git if not already available:

    nix-shell -p git

Installation Process

  1. Clone the repository:

    git clone --depth 1 https://github.com/francojc/dotfiles.git ~/.dotfiles
  2. Navigate to the dotfiles directory:

    cd ~/.dotfiles
  3. Choose your host configuration approach:

    You can either use one of the existing host configurations or create a new one.

Option A: Use Existing Host Configuration

4a. Review available configurations:

  • Current example: Mini-Rover host configuration (i3/X11 setup)
  • Desktop environment profiles available: sway.nix (Wayland) and i3.nix (X11)

5a. Update host configuration (optional):

Edit .config/nix/hosts/Mini-Rover/default.nix to customize:

nano .config/nix/hosts/Mini-Rover/default.nix

Update the username and email:

username = "yourusername";
useremail = "your.email@example.com";

Option B: Create New Host Configuration

4b. Generate hardware configuration:

sudo nixos-generate-config --show-hardware-config > .config/nix/hosts/$(hostname)/hardware-configuration.nix

5b. Create host directory and configuration:

mkdir -p .config/nix/hosts/$(hostname)

Create .config/nix/hosts/$(hostname)/default.nix based on one of the existing examples.

6b. Update the flake.nix:

Add your hostname to the hosts configuration in .config/nix/flake.nix:

hosts = {
  "Macbook-Airborne" = import ./hosts/Macbook-Airborne/default.nix;
  "Mac-Minicore" = import ./hosts/Mac-Minicore/default.nix;
  "Mini-Rover" = import ./hosts/Mini-Rover/default.nix;
  "yourhostname" = import ./hosts/yourhostname/default.nix;  # Add this line
};

Apply Configuration

  1. Build and apply the NixOS configuration:

    sudo nixos-rebuild switch --flake ~/.dotfiles/.config/nix/#yourhostname

    Replace yourhostname with:

    • Mini-Rover for the existing i3/X11 setup
    • Your custom hostname if you created a new configuration

    [!NOTE] The first build may take longer as it downloads and builds all required packages.

  2. Apply dotfiles symlinks:

    cd ~/.dotfiles
    stow .

Post-Installation

Desktop Environment Setup

For i3 (Mini-Rover host):

  • i3 will be available in your display manager
  • XRDP is configured for remote desktop access (port 3389)
  • Traditional X11 applications are prioritized
  • LightDM display manager included

For Sway (if using sway.nix profile):

  • Sway will be available in your display manager
  • Waybar and Wofi are pre-configured
  • Wayland-compatible applications and XDG portals included

Application Management

NixOS uses Flatpak instead of Homebrew for GUI applications:

  • Flatpak is automatically configured and enabled
  • Pre-configured remotes include Flathub and Flathub Beta
  • Applications are managed through the nix configuration in modules/nixos/apps.nix

Note

The configuration now uses a modular profile system. Desktop environments are defined in profiles/nixos/ with sway.nix for Wayland and i3.nix for X11 setups.

Customization

Theme Configuration:

The system uses the theme specified in your host configuration. Available themes:

  • gruvbox (default)
  • nightfox
  • arthur
  • onedark

Adding Packages:

  • System packages: Edit modules/nixos/apps.nix
  • User packages: Edit appropriate files in home/
  • Flatpak packages: Add to the packages list in modules/nixos/apps.nix

Future Updates

To update your system configuration:

cd ~/.dotfiles
git pull
sudo nixos-rebuild switch --flake .config/nix/#yourhostname

To update packages:

cd ~/.dotfiles/.config/nix
nix flake update
sudo nixos-rebuild switch --flake ./#yourhostname

Troubleshooting

Configuration fails to build:

  • Check that your hostname matches the configuration name exactly
  • Verify that hardware-configuration.nix exists and is properly formatted
  • Ensure experimental features are enabled

Missing hardware-configuration.nix:

sudo nixos-generate-config --show-hardware-config > .config/nix/hosts/yourhostname/hardware-configuration.nix

Permission issues:

Ensure you're using sudo for nixos-rebuild commands and your user is in the wheel group.

Key Differences from macOS Setup

  • Package Management: Flatpak replaces Homebrew for GUI applications
  • Window Managers: Sway (Wayland) or i3 (X11) instead of macOS window management
  • Home Directory: /home/username instead of /Users/username
  • Build Command: nixos-rebuild switch instead of darwin-rebuild switch
  • Modules: Uses nixosModules instead of darwinModules

About

This repository contains my personal dotfiles for configuring my development environment on macOS.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors