Skip to content

Eason0210/nix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Personal Nix Configuration

This is my personal Nix configuration used on MacOS.

Prerequisites

  1. install nix version 2.4 or later
  2. install nix-darwin

note: you don’t need to install home-manger, nix-darwin will install it instead.

Setup (Darwin)

  • Clone this to $HOME/src/nix
cd $HOME/src && git clone https://github.com/Eason0210/nix.git 
  • Change all the username(aqua0210 is my username) in darwin.nix and home.nix
  • Remove apps you don’t need in packages.nix
  • Check all the config is good for you and run this command in terminal.
nix build ~/src/nix\#darwinConfigurations.MacBook.system
# when build succeed, run:
darwin-rebuild switch --flake ~/src/nix

hint: MacBook is my hostname

Other useful commands

darwin-rebuild --list-generations # list all generations
darwin-rebuild --rollback # rollback to previous generation
nix-collect-garbage -d    # remove all other generations except current one

Install Emacs

Please refer to nix-community/emacs-verlay

  • EmacsGit install the master branch of Emacs, recently is Emacs 28.0.50
  • Emacs install Emacs latest realease, Emacs 27.2
  • EmacsGcc Install master branch with options --with-native-compilation enabled

Pin the version of EmacsGit and EmacsGcc

You need to specify a specific Git revision, along with its hash, in order to avoid re-downloading new versions of the overlay constantly.

Concretely, that means:

  1. Change the master string in the url field of builtins.fetchTarball to a specific commit hash.
  2. Add a sha256 field to builtins.fetchTarball set to 0000000000000000000000000000000000000000000000000000
  3. Try to build (darwin-rebuild switch)
  4. It will complain about the hash being incorrect (expected zeros, actually the real hash)
  5. Replace the zeros with the real hash

… Profit

refer to this issue.

Uninstall Nix on Mac

Reference

  1. LnL7/nix-darwin
  2. srid/nixos-config
  3. kclejeune/system
  4. jwiegley/nix-config

About

My personal nix config for Mac Big Sur

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages