Nix configuration
README.md

Nix configuration #

Warning

🚧 WIP 🚧 Currently highly theoretic. Untested and prone to changes and modification.

Dendritic NixOS configuration using flake-parts + flake-file + import-tree.

Warning

flake.nix and flake.lock are generated. Do not edit by hand.

Layout #

modules/
  inputs/        # flake inputs, ci helpers, general utils
  programs/      # reusable programs
  devshell.nix   # devshell definition with git hooks and treefmt
  systems.nix    # evaluated systems

Reusable system fragments live under flake.modules.nixos.* as per flake-parts documentation.

Workflow #

nix develop          # enter devshell
nix fmt              # format all files (nixfmt, deadnix, statix, shellcheck)
nix flake check      # pre-commit + treefmt + check-flake-file

# After adding additional flake inputs or changing configuration of flake regenerate flake.nix by running:
nix run .#write-flake
# Then stage them for commit
git add flake.nix flake.lock

Note

nix flake check fails if flake.nix is out of sync — regenerate and then check.

Caution

Sometimes you have to run 'nix run .#write-flake' couple of times to regenerate flake.nix and flake.lock correctly.

Flakes used #

  • nix-flatpak a declarative flatpak manager for NixOS inspired by declarative-flatpak and nix-darwin's homebrew module.
  • git-hooks.nix a framework for managing and maintaining multi-language pre-commit hooks in Nix.
  • nix-index-database repository serves as a centrally maintained, weekly-updated database for the nix-index tool, which powers the nix-locate command.
  • treefmt combines file formatters for multiple programming languages so that you can format all your project files with a single command.
  • steam-config-nix declaratively manage Steam and your library on NixOS or Home Manager.

Notes #

  • You can enable automatic entering a devshell on opening directory be using direnv. Install direnv and run direnv allow after cloning (see .envrc).