This repository contains my Nix-based dotfiles for setting up a reproducible development environment on macOS (Darwin), NixOS (including WSL), and Linux. It uses Nix Flakes, home-manager, and (on macOS) nix-darwin for system and user configuration.
flake.nix/flake.lock: Flake entrypoint and dependency lock file.devenv.nix/devenv.yaml: Optional development shell configuration.darwin/: macOS-specific system configuration (e.g.,darwin.nix).nixos/: NixOS system configuration (e.g.,configuration.nix).home-manager/: User-level configuration, imported by both Darwin and NixOS setups. Main file:home-manager/default.nix.
- Declarative package management for user and system.
- Home-manager for user environment (shell, aliases, packages, etc).
- macOS support via nix-darwin.
- Secure secrets and plugin management with 1Password shell plugins.
- Python 3 with pip included by default (see below).
- macOS: Determinate Systems Installer
- WSL2: WSL2 Nix
Warning
Bootstrapping is not fully tested on all hosts. Review and adapt as needed.
sudo nixos-install --flake github:samuelcotterall/dotfiles#nixosnix run nix-darwin -- switch --flake github:samuelcotterall/dotfilessudo nixos-rebuild switch --flake ~/src/github.com/samuelcotterall/dotfilesdarwin-rebuild switch --flake .#mbpYou can import the home-manager configuration standalone like this:
{ config, pkgs, ... }: {
home-manager.users.samuelcotterall = import ./home-manager/default.nix;
}- System-level config (NixOS or Darwin) imports the user-level config from
home-manager/default.nix. - User-level config sets up your shell, environment variables, aliases, and packages.
- Secrets/plugins: 1Password shell plugins are enabled for secure secrets and CLI integration.
- Python: Python 3 with pip is included by default. You can add more Python packages in
home-manager/default.nix:
home.packages = with pkgs; [
# ...other packages...
(python3.withPackages (ps: [ps.pip ps.numpy ps.requests]))
];- Edit
home-manager/default.nixto add or remove packages, shell aliases, or environment variables. - For system-level changes, edit
darwin/darwin.nixornixos/configuration.nixas appropriate.
For more details, see the NixOS Wiki: Python and Home Manager manual.