KISS NixOS configuration based on Flakes & flake-parts (supports macOS too)
Find a file
Sridhar Ratnakumar fa81a0fafe git config
2024-02-15 07:44:35 -05:00
.github/workflows Switch to gh selfhosted runner (#44) 2024-02-13 12:46:50 -05:00
.vscode vscode: direnv 2024-02-13 04:13:51 -05:00
home git config 2024-02-15 07:44:35 -05:00
nix-darwin Resolve #31 2023-10-29 10:38:41 -04:00
nixos fully document the key 2024-02-14 06:09:37 -05:00
packages add nix-health 2024-02-13 05:50:27 -05:00
systems mdadm: set MAILADDR 2024-02-13 04:03:48 -05:00
users Rm redundant args 2023-07-15 11:49:19 -04:00
.envrc flake'ify shell.nix 2022-05-08 10:25:46 -04:00
.gitattributes Add jenkins (#34) 2023-03-20 14:32:03 -04:00
.gitignore add direnv 2022-04-28 14:47:41 -04:00
.sops.yaml sops: add immediacy 2024-02-13 04:10:30 -05:00
flake.lock Remove jenkins 2024-02-14 05:49:03 -05:00
flake.nix runner: add an org repo 2024-02-14 06:01:44 -05:00
README.md readme: hetzner instructions 2024-02-13 03:51:38 -05:00
secrets.json secrets: cleanup 2024-02-13 13:59:57 -05:00

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.


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