fearoffish / nixos-config

KISS NixOS configuration based on Flakes & flake-parts (supports macOS too)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This repository contains the Nix / NixOS configuration for all of my systems. See nixos-flake if you want to create your own configuration from scratch.

Setup

To use this repository as base configuration for your new machine running:

NixOS Linux

Tip

For a general tutorial, see https://nixos.asia/en/tutorial/nixos-install

macOS

  • Install Nix
  • Install nix-darwin
    • This will create a ~/.nixpkgs/darwin-configuration.nix, but we do not need that.
  • Clone this repo anywhere
  • Edit flake.nix to use your system hostname as a key of the darwinConfigurations set
  • Edit users/config.nix to contain your users
  • Run nix run.1 That's it. Re-open your terminal.

Architecture

Start from flake.nix (see Flakes). flake-parts is used as the module system.

Directory layout

  • home: home-manager config (shared between Linux and macOS)
  • nixos: nixos modules for Linux
  • nix-darwin: nix-darwin modules for macOS
  • users: user information
  • secrets.yaml (and .sops.yaml): sops-nix secrets
  • systems: top-level configuration.nix('ish) for various systems

Tips

  • 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`
  • 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 run nixpkgs#nixci

Discussion

If you wish to discuss about this config, join the Zulip.

Footnotes

  1. You might have to rm -rf /etc/nix/nix.conf, so our flake.nix can do its thing.

About

KISS NixOS configuration based on Flakes & flake-parts (supports macOS too)


Languages

Language:Nix 69.5%Language:Emacs Lisp 20.2%Language:Haskell 9.0%Language:Lua 0.8%Language:Nu 0.3%Language:Shell 0.1%