A declarative setup for managing packages and configurations using Nix and Home Manager. This setup supports both Linux (Fedora) and macOS.
-
Install Nix:
sh <(curl -L https://nixos.org/nix/install) --daemon -
Enable Flakes: Edit
~/.config/nix/nix.confor/etc/nix/nix.confand add:experimental-features = nix-command flakes
The configuration is split into modules for reuse:
flake.nix: Entry point defining configurations (fedoraandmacos).modules/common.nix: Packages and settings shared by all OSs.modules/linux.nix: Linux-specific settings (e.g., Desktop Environment configs).modules/darwin.nix: macOS-specific settings.
1. Apply Configuration
Run the following command from the repository root to build and activate your environment:
-
Fedora (Linux):
nix run home-manager/master -- switch --flake .#fedora -
macOS:
nix run home-manager/master -- switch --flake .#macos
2. Update Packages
To update all packages to their latest versions defined in nixpkgs:
nix flake update
nix run home-manager/master -- switch --flake .#<profile>Adding Packages:
- Add cross-platform tools (e.g.,
ripgrep) tomodules/common.nix. - Add OS-specific tools to
modules/linux.nixormodules/darwin.nix.
Managing Dotfiles:
- Symlinking: You can map existing dotfiles (like
awesome/) usinghome.filein the relevant module:home.file.".config/awesome" = { source = ../awesome/.config/awesome; recursive = true; };
- Native Config: Prefer using Home Manager modules (e.g.,
programs.git) for better integration where possible.
Note: Changes to config files managed by Home Manager require running the
switchcommand to take effect.