This is my personal Nix configuration for my machines, using Blueprint.
First of all, I wanted to shout out all the people from which I learnt how to use Nix.
- suderman for their incredibly well done nix config
- zhicaoh for the catppuccin wallpapers
- nixps (XPS 13)
- mac14 (Macbook Pro 14 M2 Pro)
- bee (Beelink SER8)
- Theming with Stylix
- Multiple wms planned: Niri, Hyprland, Cosmic
- Secrets management with sops-nix
- Enter the Development Environment automatically with direnv
The project uses direnv. If you have it installed, when you enter the project directory, the shell will automatically activate the development environment.
# Available devshell commands:
switch # Rebuild and switch configuration
browse # Inspect flake structure with nix-inspectThis repository uses Blueprint, which automatically maps folder structures to flake outputs.
.
├── devshell.nix # Development shell configuration
│
├── hosts/ # Host configurations → nixosConfigurations
├── modules/ # Reusable modules → nixosModules/homeModules
├── packages/ # Custom packages → packages.*
├── lib/ # Helper functions
├── dotfiles/ # Application dotfiles
└── secrets/ # Encrypted secrets (sops-nix)
Blueprint mapping: hosts/ → nixosConfigurations.* / darwinConfigurations.*
Each subdirectory represents a system configuration:
hosts/
├── nixps/ # Dell XPS 13 9340 (NixOS)
│ ├── configuration.nix # System configuration
│ ├── hardware-configuration.nix
│ └── users/
│ └── lorenzo.nix # User-specific home-manager config
│
└── mac14/ # macOS system
└── darwin-configuration.nix
In the host configuration file you can import modules defined in modules/:
# hosts/nixps/configuration.nix
imports = [
flake.nixosModules.common # Base system configuration
flake.nixosModules.niri # Niri window manager
];Blueprint mapping: Automatically organized into nixosModules.*, homeModules.*, darwinModules.*
Modules that aren't in nixos, home, or darwin will map to modules.*.
Structured by scope and functionality:
modules/
├── common/ # Shared modules between NixOS and MacOS
├── nixos/ # NixOS system modules
│ ├── common/ # Base system configuration (Shared between servers and desktops)
│ ├── desktop/ # Base desktop environment configuration
│ ├── niri/ # Niri window manager system config
│ └── lorenzo/ # User-specific system settings
│
├── darwin/ # MacOS modules
│
└── home/ # Home Manager modules
├── common/ # Base user configuration (Shared between servers and desktops)
├── desktop/ # Desktop application configurations
├── desktop-tiling/ # Configurations shared between tiling window managers
├── niri/ # Niri-specific user configuration
└── lorenzo/ # User-specific settings
Blueprint mapping: packages/ → packages.*
Custom derivations and utilities:
packages/
├── mkScript.nix # Helper for creating shell scripts
├── focus-or-open.nix # Window management utility
├── ralt2hyper.nix # Keyboard remapping tool
├── screenrecord.nix # Screen recording script
└── screenshot.nix # Screenshot utility
Shared helper functions:
lib/
├── default.nix # Library exports
├── link.nix # Dotfile linking helper
└── mimetypes.nix # MIME type utilities
Blueprint eliminates boilerplate by automatically generating flake outputs from the directory structure:
| Directory | Flake Output |
|---|---|
hosts/ |
nixosConfigurations.*, darwinConfigurations.* |
modules/nixos/ |
nixosModules.* |
modules/home/ |
homeModules.* |
modules/darwin/ |
darwinModules.* |
packages/ |
packages.* |
devshell.nix |
devShells.* |
Modules are imported using flake references:
# In host configuration
imports = [
flake.nixosModules.common
flake.nixosModules.desktop
flake.nixosModules.niri
];
# In user configuration
imports = [
flake.homeModules.common
flake.homeModules.desktop
flake.homeModules.niri
];This provides clean, composable configurations without manual output definitions.
- Blueprint: Convention-over-configuration for Nix flakes
- Niri: Scrolling window manager for Wayland
- Stylix: System-wide color schemes and typography
- sops-nix: Secret management with age encryption
- Home Manager: User environment management
- nix-darwin: macOS system management
Secrets are encrypted using sops-nix with age:
- System age key auto-generated at
/var/lib/sops-nix/age.agekey - Public key referenced in
.sops.yaml - Secrets stored in
secrets/secrets.yaml(encrypted)
To edit secrets:
export SOPS_AGE_KEY_FILE=/var/lib/sops-nix/age.agekey
sops secrets/secrets.yamlMulti-monitor setups are defined declaratively in host configurations:
monitors = [
{
name = "DP-3";
width = 3840;
height = 2160;
refresh = 120.0;
position = { x = 0; y = 0; };
scale = 1.25;
}
{
name = "eDP-1";
width = 2560;
height = 1600;
refresh = 120.0;
position = { x = 3072; y = 0; };
scale = 1.3;
}
];# Update all flake inputs
nix flake update
# Update specific input
nix flake lock --update-input nixpkgs
# Rebuild after update
sudo nixos-rebuild switch --flake .MIT License - See LICENSE for details.