This repository contains my personal NixOS, nix-darwin and Home-Manager configurations, managed as a Nix flake.
It provides a declarative and reproducible way to manage my system configurations across different machines.
Easy to add hosts that run NixOS, nix-darwin or a standalone Home-Homemanager instance on (non-)NixOS.
Uses flake-parts to seperate the flake outputs to different host modules.
The repository is structured as follows:
flake.nix: The entry point for the flake, defining inputs and outputs.hosts/: Contains machine-specific configurations. Each host has adefault.nixthat defines the NixOS configuration for that machine, and ausersdirectory for user-specific configurations.ideapad/: Configuration for my Ideapad laptop.nixberry/: Configuration for my Raspberry Pi.surface/: Configuration for my Surface device, which uses home-manager standalone.
modules/: Contains reusable modules for configuring different aspects of the system.core/: Core modules shared between NixOS and nix-darwin.darwin/: Modules specific to nix-darwin.hm-standalone/: Modules for home-manager standalone.home/: Home Manager modules for user-specific configurations.nixos/: NixOS specific modules, now further modularized into files likeboot.nix,sound.nix, etc.
profiles/: Defines different profiles that can be applied to hosts or users.system/: System-level profiles.user/: User-level profiles.
lib/: Contains helper functions, likemkUser.nixfor creating users.secrets/: Contains secrets managed bysops-nix.
To use these dotfiles, you will need Nix installed with flake support enabled.
Warning: These are my personal dotfiles and are highly customized. Use them at your own risk and adapt them to your needs.
-
Clone the repository:
git clone https://github.com/pieterpel/dotfiles.git ~/dotfiles cd ~/dotfiles
-
Customize the configuration: You will likely need to edit the files in
hosts/to match your hardware and user setup. For a new NixOS host, you would typically add a new directory underhosts/and include your machine'shardware-configuration.nix. -
Apply the configuration:
To build a NixOS configuration, run:
sudo nixos-rebuild switch --flake .#<hostname>Where
<hostname>is one of the hosts defined inhosts/(e.g.,ideapad,nixberry).To build a home-manager standalone configuration, run:
home-manager switch --flake .#<username>Where
<username>is a user with a home-manager standalone configuration (e.g.,pieterpel).This configuration also supports
nix-darwin. To build anix-darwinconfiguration, you would add a new host in thehostsdirectory and useinputs.nix-darwin.lib.darwinSystemto create the configuration. Then, you can apply it by running:darwin-rebuild switch --flake .#<darwin-hostname>
This repository uses sops-nix to manage secrets. The secrets are encrypted and stored in the secrets/ directory. See the sops-nix documentation for more information on how to use it.
Feel free to open issues or pull requests if you have suggestions or improvements.
