KISS NixOS configuration based on Flakes & flake-parts (supports macOS too)
Find a file
Sridhar Ratnakumar 481b667293 add sshuttle-via
2024-03-15 18:41:06 -04:00
.github/workflows ci-macos (#46) 2024-02-23 11:47:06 -05:00
.vscode vscode: direnv 2024-02-13 04:13:51 -05:00
home add sshuttle-via 2024-03-15 18:41:06 -04:00
nix-darwin ci: add gtar 2024-03-10 09:17:14 -04:00
nixos refactor: mv modules out of systems/ 2024-02-24 18:55:14 -05:00
packages add sshuttle-via 2024-03-15 18:41:06 -04:00
systems docker: fix group 2024-03-05 15:56:22 -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 here: new key 2024-02-21 11:58:34 -05:00
flake.lock Update nixpkgs 2024-03-09 07:25:30 -05:00
flake.nix linux-builder: my full user profile 2024-03-05 15:19:48 -05:00
justfile just: sops commands 2024-03-01 12:41:45 -05:00
README.md readme: fix link 2024-02-24 17:50:19 -05:00
secrets.json here: new key 2024-02-21 11:58:34 -05:00

AGPL project chat Harmeless Code of Conduct

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/nixos-install-flake

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. ↩︎