This repository contains all my configurations for all my nix-based systems. It includes NixOS systems configurations, Nix configurations and nix-darwin configurations with per-user configurations, and per-host configurations. This repository is built on top of Nix Flakes and nixos-unified.
This config allow me to have per-machine configuration (e.g. modules, hardware specific) AND per-user per-machine configuration (e.g. profiles, workspaces, ...).
I use this repository to manage my personal computers, servers, and workstations including :
- Laptops with NixOS and MacOS + Nix-Darwin
- Desktop with NixOS
- WSL2 with NixOS and Ubuntu
- Servers with NixOS and Debian + Nix
- Raspberry Pi with NixOS
Some of the noticeable things I use :
- Nix with Flakes built on top of latest stable channel + easy unstable access
- Nixos-unified (flake-parts module) to provide a consistent interface for all my configurations
- Home-manager for per-user configuration
- Wayland (Hyprland, Hyprpaper, ...)
- DoAs (alternative to sudo)
- Kitty terminal, Fish as shell
Start from flake.nix
(see Flakes). flake-parts
is used as
the module system.
Tip
This repo use autowiring of flake outputs based on this directory structure.
Path | Corresponding flake output |
---|---|
./configurations/{nixos,darwin,home}/foo/ |
{nixos,darwin,home}Configurations.foo |
./mdules/{nixos,darwin,home,flake-parts}/foo/ |
{nixos,darwin,home,flake}Modules.foo |
./overlays/foo.nix |
overlays.foo |
./packages/bar |
`` |
-
To add a new host, install it with NixOS Installer or Nix-Darwin, then
- Create a new directory in
configurations/{nixos/darwin/home}/hostname
depending on underlying OS. - Create or move home-manager configurations to
configuration/home/my-user.nix
- Copy the generated
configuration.nix
andhardware-configuration.nix
to the new directory and create thedefault.nix
. - Apply the configuration with
nix run
- Create a new directory in
-
To apply the configuration, run
nix run
- You are no required to run it as root, it will ask for sudo password when needed
nix run # Will update the configuration based on the hostname # Or, `nix run .#<computer>`
- You are no required to run it as root, it will ask for sudo password when needed
-
To update NixOS (and other inputs) run
nix flake update
- You may also update a subset of inputs, e.g.
nix flake lock --update-input nixpkgs --update-input darwin --update-input home-manager # Or, `nix run .#update`
- You may also update a subset of inputs, e.g.
-
To free up disk space,
sudo nix-env -p /nix/var/nix/profiles/system --delete-generations +2 sudo nixos-rebuild boot
-
To autoformat the project tree using nixpkgs-fmt, run
nix fmt
. -
To build all flake outputs (locally or in CI), run
nix --accept-flake-config run github:juspay/omnix ci build