Skip to content
spencerpogoPublic

About

NixOS dotfiles

Topics

Resources

Stars

7 stars

Watchers

1 watching

Forks

Latest commit

 

History

1,029 Commits

Folders and files

Repository files navigation

Scoder12 NixOS Dotfiles

My setup

  • Usecase: Full-stack development, browsing, light gaming
  • OS: NixOS Unstable
  • Install everything using home-manager, never nix-env.
    • Ensures that everything I install is saved in my dotfiles
    • Don't use two tools for the same purpose
  • Try to keep tools in home-manager to essentials and use nix-shell -p for everything else
    • can try out new software instantly with no need to remember to remove
    • saves disk space
    • avoids bloating base dotfiles install
  • Use home-manager standalone rather than as a module
    • can update system and user independently
  • Shell: zsh
    • no framework, plugins are managed by nix
    • nerdfont complete powerlevel10k theme
    • lots of custom aliases and functions
  • Terminal: alacritty
  • Editors:
    • VS Codium (open source, telemetry free VS Code) with vscode-vim extension
    • vanilla vim with no config

Repo organization

  • home-manager/
    • modules/ holds configuration for individual tools.
    • configs/cli.nix and configs/desktop.nix group the modules shared by multiple machines. Desktop includes CLI, which includes the base config.
    • Machine files in home-manager/*.nix import a profile and add their own programs and hardware-specific settings. A new machine can start with a profile instead of copying another machine's full import list.
    • Modules can use enabled programs when useful; for example, i3 selects Alacritty as its terminal when Alacritty is enabled.

Installation

NixOS (flake)

sudo ln -s /path/to/dotfiles/flake.nix /etc/nixos/flake.nix
nixos-rebuild switch --use-remote-sudo

The NixOS config sets up NIX_PATH to use the nixpkgs version pinned in this flake, so you should sudo nix-channel --remove all your system channels now (list them with sudo nix-channel --list)

Other linux

Install the nix package manager.

home-manager (flake)

  1. Choose or add a homeConfiguration flake output with the correct username
  2. Refer to the home-manager manual. The flake URI is simply the path to this git repo.

home-manager (non-flakes)

Note: I use flakes rather than this method on all my systems now.

  1. Install home-manager using the standalone installation: instructions in the home-manager manual.
  2. At the top of ~/.config/nixpkgs/home.nix, import your desired machine config from this repo using an absolute path. For example, to use the redbox profile after cloning the repository to /home/scoder12/github/dotfiles, write:
{ config, pkgs, ... }:

{
  imports = [
    /home/scoder12/github/dotfiles/home-manager/redbox.nix
  ];

  # --snip--
  1. Rebuild home-manager config: home-manager switch. Repeat this step after any change to this repository.

Note: On non-NixOS, nix's libGL doesn't play nicely with system graphics drivers, so install alacritty's dependencies using the system package manager then cargo install alacritty, rather than installing it with nix.

Important tips

  • Don't forget to sudo nix-collect-garbage -d often.
  • Keep your system up to date: nix flake update --commit-lock-file
  • Make sure to set max-jobs and cores when building (manual). I use --max-jobs 1 --cores 2 with home-manager switch and nixos-rebuild switch to avoid overselling my 6-core 12-thread machine
  • The Firefox User-Agent in home-manager/modules/firefox.nix is spoofed to look like Win10. Be sure to check the list from time to time to makek sure it isn't being generated incorrectly and standing out

About

NixOS dotfiles

Topics

Resources

Stars

7 stars

Watchers

1 watching

Forks

Releases

Contributors

Languages