Skip to content

suderman/nixos

Repository files navigation

NixOS system configurations & dotfiles

nixos

Welcome to the NixOS configuration for all my personal infrastucture!

Feel free to look around but realize this is an on-going work-in-progress. Although I'm a Nix enthusiast, I am not a Nix expert, so there's probably always a better way to do what I'm trying to do. I have found Nix to be very challenging, but almost always in a good way. 🤓

Usage

This configuration comes with a helper CLI nixos for common commands. On a bare system, this can tool can be used by setting the following alias:

alias nixos="bash <(curl -sL https://github.com/suderman/nixos/raw/main/overlays/bin/nixos-cli/nixos)"

Keep in mind this is meant to be run on NixOS and there a number of dependencies like jq and smenu (which should automatically be installed when needed).

Deploy Commands

# Deploy flake to local/remote system with nixos-rebuild
nixos deploy
nixos deploy --boot
nixos deploy --test

# Rollback to the previous generation 
nixos rollback
nixos rollback --boot

# Update flake.lock to latest
nix flake update

# Install a NixOS configuration on fresh hardware or VPS
nixos bootstrap

See bootstrap configuration for more details.

Secrets Commands

# Edit or add secrets to secrets/files/* (wrapper for agenix --edit)
nixos secrets

# Rekey existing secrets with secrets/keys/* (wrapper for agenix --rekey)
nixos rekey

# Scan a host for public keys and add to secrets/keys/* (wrapper for ssh-keyscan)
nixos keyscan IP [HOSTNAME]

See secrets for more details.

Utility Commands

# Start a repl to browse this flake
nixos repl

The above is a wrapper for nix repl using repl.nix to load everything.

Resources

When trying to figure out how to do something, examples are almost always best. Make use of GitHub's search with the code language filter to find examples from other Nix users' personal configurations.

For example, here is config.services.nginx:

https://github.com/search?type=code&q=lang%3Anix+config.services.nginx