This repository contains the configuration files and dotfiles for setting up a NixOS environment across multiple devices. The structure is organized to support different machines and environments such as desktop, laptop, and WSL. Below is an overview of the directory structure and the purpose of each file and folder.
This directory holds all the configuration files and modules needed to set up your NixOS environment.
-
dotfiles/
: Contains configuration files for tools and utilities used in NixOS.fastfetch/
: Configuration for Fastfetch, a command-line utility for displaying system information.config.conf
: The main configuration file for Fastfetch.
fish/
: Configuration files for the Fish shell.config.fish
: The configuration script for Fish shell.
helix/
: Configuration for the Helix text editor.config.toml
: Main configuration file for Helix.languages.toml
: Language-specific configurations for Helix.
starship.toml
: Configuration for the Starship prompt, a cross-shell prompt.wezterm/
: Configuration for WezTerm, a terminal emulator.wezterm.lua
: The configuration script for WezTerm.
-
home/
: Contains home configurations for different devices.desktop/
: Configuration for the desktop setup.default.nix
: Nix configuration for the specific desktop environment.hardware-configuration.nix
: Hardware-specific configuration for the desktop.
laptop/
: Configuration for the laptop setup.default.nix
: Nix configuration for the specific laptop environment.hardware-configuration.nix
: Hardware-specific configuration for the laptop.
wsl/
: Configuration for WSL (Windows Subsystem for Linux).default.nix
: Nix configuration for the WSL environment.hardware-configuration.nix
: Hardware-specific configuration for WSL.
-
modules/
: Contains custom NixOS modules.nix-ld-config.nix
: Configuration for loading dynamic libraries on NixOS.
-
shared-desktop.nix
: Shared configuration for desktop environments, used across different linux desktop environment in this case the laptop and the desktop. -
shared.nix
: General shared configurations that apply to all environments.
flake.lock
: A lock file generated by the Nix flake system, ensuring reproducibility of the Nix environment.flake.nix
: The entry point for the Nix flake, defining the configurations and dependencies for the entire setup.README.md
: This file, providing an overview of the repository structure and purpose.
- Clone the repository:
Clone the repo to /etc/nixos or to where you keep your NixOS config
git clone https://github.com/Roya1jr/nixos.git
cd nixos
-
Apply Configuration:
- Navigate to the appropriate directory for your device.
- Change the username, email & other directory to the appropriate ones for your user in the relevant files.
- Change the values in the
default.nix
&hardware-configuration.nix
home files to the appropriate ones for your system(s) - Run
sudo nixos-rebuild switch --flake .#<name of system defined in flake.nix>
e.g.sudo nixos-rebuild switch --flake .#laptop
to apply the laptop config. - For WSL run
sudo nixos-rebuild switch --flake .#wsl --impure
-
Customize Dotfiles:
- Edit the files within
dotfiles/
to customize your environment according to your preferences.
- Edit the files within
-
Shared Configurations:
- Use
shared.nix
andshared-desktop.nix
to maintain common settings across multiple environments.
- Use
-
Change the ownership of the
.git
directory to your non-root user so you can push your changes make sure to make the appropriate changes in the git section of the appropriatedefault.nix
home file -
Run
git fetch
to pull latest changes then runsudo git merge
to merge changes to your local repo
- Thilo Hohlt who's nix config I used as the basis for mine.
- NixOS-WSL a cool project for running NixOS on WLS
- SoonHo Seo's fix to get NixOS-WSL working with Visual Studio Code.
This project is licensed under the MIT License. See the LICENSE file for details.