This repository contains the configuration files and modules for managing a Nix-based system using Home Manager. The configuration is organized into several key modules and concepts to provide a structured and maintainable setup.
The repository is designed to manage personal configurations for different tools and services using Nix and Home Manager. It includes settings for various applications, custom scripts, and system services tailored to specific machines.
- Configuration:
modules/shell - Description: Defines shell settings, including session variables and bookmarks.
- Configuration:
modules/editor - Description: Configures editor settings and session variables.
- Configuration:
modules/browser - Description: Manages browser settings, search engines, and key bindings.
- Configuration:
modules/mail - Description: Sets up mail accounts and related services.
- Configuration:
modules/security - Description: Configures security settings, including GPG and SSH.
- Configuration:
modules/terminal - Description: Defines terminal emulator settings.
- Configuration:
modules/gui - Description: Manages graphical user interface settings.
- Configuration:
modules/utils - Description: Configures various utility programs and scripts.
- Configuration:
machines/ - Description: Machine-specific configurations, such as network settings, services, and hardware options.
The repository is structured into different directories, each containing configurations for specific areas:
modules/: Contains module configurations.machines/: Contains machine-specific configurations.settings/: Contains general settings and options.
Each configuration file follows a specific naming convention and is responsible for a particular aspect of the system configuration. Examples include:
modules/shell: Shell configuration.modules/editor: Editor configuration.machines/alpha/configuration.nix: Configuration for the Alpha machine.
This configuration can be managed using a set of helper commands defined in the Makefile. Below is a description of each command and its usage:
To apply the Home Manager configuration and create a backup:
make applyThis command uses the home-manager flake to apply the configuration with the
--impure option, creating a backup of the existing setup.
To link the current machine's configuration to /etc/nixos/configuration.nix:
make /etc/nixos/configuration.nixThis command uses cp with the --backup, --interactive, and --link
options to create a hard link from machines/$$(hostname)/configuration.nix to
/etc/nixos/configuration.nix.
To switch to the new NixOS configuration:
make switchThis command links the configuration (as described above) and then runs
nixos-rebuild switch to apply it.
To upgrade the system configuration:
make upgradeThis command links the configuration and then runs nixos-rebuild switch --upgrade to apply the configuration and upgrade the system.
To expire old generations:
make expireThis command runs home-manager expire-generations with the expiration period
set to 30 days (or the period specified in the expiration variable).
To list current generations:
make gensThis command lists all the generations managed by home-manager.
To run garbage collection:
make gcThis command deletes store paths older than the specified expiration period (default is 30 days), optimizes the Nix store, and frees up space.
- Home Manager Flake: The Home Manager flake is defined as
home-manager/release-23.11in thehm-flakevariable. - Environment Variables: The commands are run with
NIXPKGS_ALLOW_UNFREE=1andNIXPKGS_ALLOW_INSECURE=1to allow unfree and insecure packages. - Custom Expiration: The expiration period for expiring generations and
garbage collection can be customized by setting the
expirationvariable in the Makefile.
Example of changing the expiration period to 60 days:
make expiration=60 days expireThese commands simplify the process of managing NixOS and Home Manager configurations, making it easier to apply, update, and maintain your system setup.