nix-configs
My Nix{OS} configuration files
Overview
- nix configuration for my laptops, desktops and more
- nix flake-powered
- guaranteed to be reproducible
Disclaimer
This config is not based on any previous available Flake-based Nix{OS} config, instead I choose to develop my own from the available examples and documentation. Some of the repositories that helped me to build this config:
- https://github.com/bqv/nixrc
- https://github.com/colemickens/nixcfg
- https://github.com/hlissner/dotfiles
- https://github.com/lucasew/nixcfg
- https://github.com/Mic92/dotfiles
- https://github.com/nrdxp/nixflk
Also, some extra resources and documentation about Flakes:
Remember: Flakes is experimental, so you shouldn't try this approach until you have some experience in Nix.
Dotfiles
This repository also includes my
home-manager
configuration.
It is used to configure home in NixOS systems (using home-manager
as a NixOS
module) but it should also work in standalone mode.
Installation
NixOS
After following the instructions in manual to prepare the system and partition the disk, run the following process to install:
$ sudo git clone https://github.com/thiagokokada/nix-configs/ /mnt/etc/nixos
$ sudo chown -R 1000:1000 /mnt/etc/nixos # optional if you want to edit your config without root
$ nix flake new --template '.#new-host' # if this is a new hardware
$ sudo nixos-install --flake /mnt/etc/nixos#hostname
To speed-up the initial setup, you can comment parts of the configuration.
A good start would be to import only hardware-configuration.nix
,
nixos/minimal.nix
and home-manager/minimal.nix
.
After installing it succesfully and rebooting, you can uncomment everything and trigger a rebuild.
nix-darwin
Start by installing Nix:
$ sh <(curl -L https://nixos.org/nix/install) --daemon
See more details here.
You first need to run nix-darwin installer:
$ nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
$ ./result/bin/darwin-installer
Afterwards run:
$ nix build '.#darwinConfigurations.<hostname>.system'
$ ./result/sw/bin/darwin-rebuild switch --flake .
# or
$ nix run '.#darwinActivations/<hostname>'
Home Manager (standalone)
Start by installing Nix:
$ sh <(curl -L https://nixos.org/nix/install) --daemon
To build the Home Manager standalone and activate its configuration, run:
$ nix run '.#homeActivations/<hostname>'
Testing
You can build a VM to test NixOS configurations with safety running the command below:
$ nix run '.#nixosVMs/<hostname>'
Explore
You can explore all outputs from this configuration by using:
$ nix flake show