This repository contains NixOS and nix-darwin configurations for my machines, managed through Nix Flakes.
It is structured to easily accommodate multiple machines and user configurations, leveraging nixpkgs, home-manager, nix-darwin, and various other community contributions for a seamless experience across NixOS and macOS.
flake.nix
: The flake itself, defining inputs and outputs for NixOS, nix-darwin, and Home Manager configurations.hosts/
: NixOS and nix-darwin configurations for each machine, including system-specific settings.home/
: Home Manager configurations for user-specific settings and applications.files/
: Miscellaneous configuration files and scripts used across various applications and services.flake.lock
: Lock file ensuring reproducible builds by pinning input versions.overlays/
: Custom Nix overlays for package modifications or additions.
- nixpkgs: Points to the
nixos-unstable
channel for access to the latest packages. - nixpkgs-stable: Points to the
nixos-24.05
channel, providing stable NixOS packages. - home-manager: Manages user-specific configurations, following the
nixpkgs
input (release-24.05). - hardware: Optimizes settings for different hardware configurations.
- catppuccin: Provides global Catppuccin theme integration.
- spicetify-nix: Enhances Spotify client customization.
- darwin: Enables nix-darwin for macOS system configuration.
- nix-homebrew: Integrates Homebrew package management with nix-darwin.
To add a new machine with a new user to your NixOS or nix-darwin configuration, follow these steps:
-
Update
flake.nix
:a. Add the new user to the
users
attribute set:users = { # Existing users... newuser = { email = "newuser@example.com"; fullName = "New User"; gitKey = "YOUR_GIT_KEY"; name = "newuser"; }; };
b. Add the new machine to the appropriate configuration set:
For NixOS:
nixosConfigurations = { # Existing configurations... newmachine = mkNixosConfiguration "newmachine" "newuser"; };
For nix-darwin:
darwinConfigurations = { # Existing configurations... newmachine = mkDarwinConfiguration "newmachine" "newuser"; };
c. Add the new home configuration:
homeConfigurations = { # Existing configurations... "newuser@newmachine" = mkHomeConfiguration "x86_64-linux" "newuser" "newmachine"; };
-
Create System Configuration:
a. Create a new directory under
hosts/
for your machine:mkdir -p hosts/newmachine
b. Create
configuration.nix
in this directory:touch hosts/newmachine/configuration.nix
c. Add the basic configuration to
configuration.nix
:For NixOS:
{ config, pkgs, ... }: { imports = [ ./hardware-configuration.nix ../modules/common.nix # Add other relevant modules ]; # Add machine-specific configurations here }
For nix-darwin:
{ config, pkgs, ... }: { imports = [ ../modules/common.nix # Add other relevant modules ]; # Add machine-specific configurations here }
d. For NixOS, generate
hardware-configuration.nix
:sudo nixos-generate-config --show-hardware-config > hosts/newmachine/hardware-configuration.nix
-
Create Home Manager Configuration:
a. Create a new file for the user's home configuration:
mkdir -p home/newuser touch home/newuser/newmachine.nix
b. Add basic home configuration:
{ config, pkgs, ... }: { imports = [ ../modules/common.nix # Add other relevant modules ]; # Add user-specific configurations here }
-
Building and Applying Configurations:
a. Do not forget to check-in new files in git by running
git add .
b. Build and switch to the new system configuration:
For NixOS:
sudo nixos-rebuild switch --flake .#newmachine
For nix-darwin:
darwin-rebuild switch --flake .#newmachine
c. Build and switch to the new Home Manager configuration:
home-manager switch --flake .#newuser@newmachine
To update all flake inputs to their latest versions:
nix flake update
This setup includes a wide range of custom modules and configurations to enhance your NixOS and macOS experience. Here's a comprehensive list of available modules:
common.nix
: Common system configurationscorectrl.nix
: CoreCtrl for AMD GPU managementgnome.nix
: GNOME desktop environmenthyprland.nix
: Hyprland window managerlaptop.nix
: Laptop-specific configurationslutris.nix
: Lutris gaming platformollama.nix
: Ollama for running large language models locallysteam.nix
: Steam gaming platform
-
Terminal and Shell:
alacritty.nix
: Alacritty terminal emulatoratuin.nix
: Shell history synczsh.nix
: Zsh shell configurationtmux.nix
: Terminal multiplexer
-
Development Tools:
git.nix
: Git version controlgo.nix
: Go programming languageneovim.nix
: Neovim text editorlazygit.nix
: Terminal UI for Git
-
System Utilities:
bat.nix
: A cat clone with syntax highlightingbottom.nix
: System monitorcliphist.nix
: Cliphist clipboard manager (for Hyprland/wl-roots)fastfetch.nix
: System information toolfzf.nix
: Fuzzy findergpg.nix
: GPG key managementkrew.nix
: kubectl plugin manager
-
Desktop Environment and UI:
gnome.nix
: GNOME desktop customizationsgtk.nix
: GTK theme settingshyprland.nix
: Hyprland window manager configurationkanshi.nix
: Automatic display configurationpop-shell.nix
: Pop Shell for tiling windowsswaync.nix
: Notification center for Waylandwaybar.nix
: Highly customizable Wayland barwofi.nix
: Application launcher for Wayland
-
Applications:
corectrl.nix
: GPU controls and monitoringeasyeffects.nix
: Audio effects for PipeWireflameshot.nix
: Screenshot toolnormcap.nix
: OCR toolspicetify.nix
: Spotify client customizationswappy.nix
: Wayland screenshot editing toolulauncher.nix
: Application launcherzoom.nix
: Zoom video conferencing
-
Cloud and DevOps:
saml2aws.nix
: CLI tool for SAML SSO
-
macOS-specific:
darwin-aerospace.nix
: macOS-specific configurations
-
Miscellaneous:
home.nix
: Main home configurationscripts.nix
: Custom scriptsxdg.nix
: XDG base directory specification
Each of these modules can be imported into your NixOS, nix-darwin, or Home Manager configurations to enable specific features or applications. To use a module, simply add it to the imports
list in your configuration file.
For example, to enable Alacritty and Neovim in your home configuration:
{ config, pkgs, ... }:
{
imports = [
./modules/alacritty.nix
./modules/neovim.nix
# Other modules...
];
# Additional configurations...
}
Feel free to explore these modules and customize your NixOS or macOS setup according to your needs. If you need more information about a specific module, you can check its corresponding file in the hosts/modules/
or home/modules/
directory.
Contributions are welcome! If you have improvements or suggestions, please open an issue or submit a pull request.
This repository is licensed under MIT License. Feel free to use, modify, and distribute according to the license terms.