Skip to content

❄️ Personal Nix Configuration [ NixOS, macOS ] (no home-manager)

Notifications You must be signed in to change notification settings

jeffwindsor/nix-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Configuration Paths

Notes

  • Default.nix files are built to import nix files in the directory
  • Top level nix files or bundles will set enable options for imported modules
  • Bundles are just groups of packages for a purpose
  • This approach sacrifices terseness for flexibilty
  • Relies on config options to enable software
  • Importing a directory imports the directory/default.nix
  • macOS is the darwin kernel with the aqua desktop

NixOS

a work in progress

Optional Aliases

  • NIX_FLAKE_PATH is optional but helpful.
  • Tip: NIX_CONFIG is used by NIX for other purposes, so don't use it
  • search input is regex. Example search for Firefox or Chromium: "firefox|chromium"
export NIX_FLAKE_PATH="/path/to/flake"

alias clean="echo 'garbage collecting: this might take a while' && nix store gc"
alias generations="sudo nix-env --list-generations --profile /nix/var/nix/profiles/system"
alias optimise="echo 'optimising: this might take a while' && nix store optimise"
alias rebuild="nixos-rebuild build --impure --flake \$NIX_FLAKE_PATH"
alias search="nix search nixpkgs"
alias switch="nixos-rebuild switch --impure --flake \$NIX_FLAKE_PATH"
alias upgrade="nixos-rebuild switch --upgrade --impure --flake \$NIX_FLAKE_PATH"

macOS

Install

  1. Nix
  2. Nix-Darwin

Optional Nix Config Files

These files set reasonable defaults for using nix, such as allowing "un-free" software and enableingthe use of flakes

~/.config/nix/nix.conf

# nix-command: enables the new nix subcommands
# flakes: enables the use of flakes
# pipe-operators: Add |> and <| operators to the Nix language.
experimental-features = nix-command flakes pipe-operators

~/.config/nixpkgs/config.nix

{
  allowUnfree = true;  # all unfree packages allowed
  # == allowUnfree alternative ==
  # allowUnfreePredicate = pkg: {
  #    some logic to filter which packages can be unfree or not  
  #    returns a bool
  # };
}

Optional Aliases

I use these aliases to support my use of nix on a mac, for example using NIX_FLAKE_PATH to point to you config repo instead of base config

  • NIX_FLAKE_PATH is optional but helpful.
  • Tip: NIX_CONFIG is used by NIX for other purposes, so don't use it
  • search input is regex. Example search for Firefox or Chromium: "firefox|chromium"
export NIX_FLAKE_PATH="/path/to/flake"

alias clean="echo 'garbage collecting: this might take a while' && nix store gc"
alias generations="darwin-rebuild --list-generations"
alias optimise="echo 'optimising: this might take a while' && nix store optimise"
alias rebuild="darwin-rebuild build --impure --flake \$NIX_FLAKE_PATH"
alias search="nix search nixpkgs"
alias switch="darwin-rebuild switch --impure --flake \$NIX_FLAKE_PATH"
alias update="nix flake update --flake \$NIX_FLAKE_PATH"

About

❄️ Personal Nix Configuration [ NixOS, macOS ] (no home-manager)

Resources

Stars

Watchers

Forks

Packages

No packages published