Skip to content

tviti/nix-cfg

Repository files navigation

Declarative system configuration via Nix

Abstract

The files contained in this folder define a system configuration using the nix language, that can be implemented using a combination of nix (the package manager), home_manager, and nix-darwin.

How

I try to implement as many things as possible using home_manager (as opposed to nix-darwin), so as to make this environment as operating system agnostic as possible. Because nix-darwin is a nixos emulation layer for macOS, things implemented using nix-darwin are at best portable to nixOS systems.

Folders

  • config: Misc. dotfiles that should be symlinked by home_manager. Also an appropriate place to place .nix files that manage user level configs.
  • machines: Machine specific files (e.g. configuration.nix and home.nix).
  • overlays: Nix overlays (includes a clone of emacs-overlay).
  • pkgs: Custom package definitions.
  • services: System level service definitions.
  • nix-src: Source repos for nix tooling (e.g. home-manager).

$NIX_PATH

I am currently experimenting with keeping local copies of the nixpkgs, home_manager, and nix-darwin repos (located in ./nix-src), with all nix-channels removed. I haven’t tried to boostrap this config on a system that didn’t already have nix and home_manager installed (yet), but keep in mind that on the first invocation of darwin-rebuild switch or home-manager switch, nix will have no idea where to locate these things. The simplest way to deal with this (assuming the tools are already installed) seems to be passing them explicitly:

darwin-rebuild switch -I darwin=<path/to/nix-darwin> -I home-manager=<path/to/home-manager> -I nixpkgs=<path/to/nixpkgs>

after which $NIX_PATH should have been properly set for all future invocations of darwin-rebuild and home-manager. On a non-NixOS linux system, where we can’t system level configuration, we’d probably want to set these using home_manager, for example as

home.sessionVariables = {
  NIX_PATH = "$NIX_PATH:nixpkgs=<path/to/nixpkgs>:home-manager=<path/to/home-manager>";
};

but I’m filing this under “cross that bridge when we get there”, since I’m reluctant to muck with $NIX_PATH in multiple places.

Submodules

emacs-overlay

home-manager

nixpkgs

nix-darwin

next-cfg

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published