This repository contains the Nix / NixOS configuration for all of my systems.
To use this repository as base configuration for your new machine running:
- Install NixOS
- Hetzner dedicated from Linux Rescue system: serokell/nixos-install-scripts#1 (review)
- Digital Ocean: https://github.com/elitak/nixos-infect
- X1 Carbon: https://srid.ca/x1c7-install
- Windows (via WSL): https://github.com/nix-community/NixOS-WSL
- Clone this repo at
/etc/nixos - Edit
flake.nixto use your system hostname in thenixosConfigurationsset - Edit
users/config.nixto contain your users - Run
nix develop -c , activate. That's it. Re-open your terminal.
- Install Nix (must be multi-user)
- Install nix-darwin
- This will create a
~/.nixpkgs/darwin-configuration.nix, but we do not need that.
- This will create a
- Clone this repo anywhere
- Edit
users/config.nixto contain your users - Run
nix develop -c , activate.1 That's it. Re-open your terminal.
Start from flake.nix (see Flakes). flake-parts is used as the module system.
home: home-manager config (shared between Linux and macOS)nixos: nixos modules for Linuxnix-darwin: nix-darwin modules for macOSusers: user informationsecrets: agenix secrets (encrypted using ssh keys)systems: top-level configuration.nix('ish) for various systems
- Run
,innix developshell (tip: direnv is better) to see available scripts.- (
,is provided by the mission-control module)
- (
- 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 # Also, in the dev shell: , update-primary
- 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.
Footnotes
-
You might have to
rm -rf /etc/nix/nix.conf, so our flake.nix can do its thing. ↩