My Nix{OS} configuration files
- nix configuration for my laptops, desktops and more
- nix flake-powered
- guaranteed to be reproducible
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/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.
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.
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:100 /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
After installing it succesfully and rebooting, you can uncomment everything and trigger a rebuild.
You can also do remote installations by using --target-host
flag in
nixos-rebuild
(from any machine that already has NixOS installed):
$ nixos-rebuild switch --flake '.#hostname' --target-host root@hostname --use-substitutes
Or if you don't have root
access via SSH (keep in kind that the user needs to
have sudo
permissions instead):
$ nixos-rebuild switch --flake '.#hostname' --target-host user@hostname --use-substitutes --use-remote-sudo
Another option for a few hosts is to use nixos-anywhere. This need to be a host with disko configured. In this case, you can just run:
$ nix run github:numtide/nixos-anywhere -- --flake '.#hostname' root@hostname
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 '.#darwinActivations/<hostname>'
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>'
You can build a VM to test NixOS configurations with safety running the command below:
$ nix run '.#nixosVMs/<hostname>'
You can explore all outputs from this configuration by using:
$ nix flake show