Code Monkey home page Code Monkey logo

nixos-config's Introduction

Dustin's Nix / NixOS config

GitHub last commit

Psst: I can help write Nix at your company. Get in touch.

Overview

Hey, you made it! Welcome. 🤓

You've stumbled upon my personal journey with Nix. For over a year, I've been hacking away at this configuration. This repository drives my office PC, M1 Macbook, and virtual machines in my home lab. Along with syncthing to manage data, this Nix configuration guarantees I have a working, seamless experience across each machine I use.

While developing, I've done my best to keep it simple - for both future me and readers like you. You'll see that in how I've organized code, as I keep filename conventions the same across modules. To get started, you can bootstrap from bare metal, run on your Mac, or try out a live ISO. See below.

Videos

NixOS

NixOS.mp4

MacOS

Updating dependencies with one command

Build.mov

Instant Emacs 29 thanks to daemon mode

GUI

Emacs.mov

Terminal

Emacs_Terminal.mov

Features

  • Multiple Nix and NixOS configurations across Mac and Linux, including desktop, laptop, server
  • A single nix-command to start from zero, both x86 and MacOS platforms
  • Fully declarative MacOS dock and MacOS App Store apps
  • 100% flake driven, no use of channels or configuration.nix during install or after
  • Fully managed, auto-updating homebrew environment (yes, Nix manages homebrew!)
  • Easily share config across Linux and Mac with both Nix and Home Manager
  • Bleeding edge Emacs that fixes itself, thanks to a community overlay
  • Extensively configured NixOS environment including clean aesthetic + window animations
  • Auto-loading of Nix overlays: drop a file in a dir and it runs (great for patches!)
  • Large Emacs literate configuration to explore (if that's your thing)
  • Optimized for simplicity and readability in all cases, not small files spread across collections of modules

Coming Soon

  • Persistence defined under XDG (#5)
  • Opt-in persistence using impermanence and zfs snapshot reset (#8)
  • Secrets managed with sops-nix (#6)

Layout

.
├── bin          # Optional scripts used to run build/update
├── common       # Shared configurations applicable to all machines
├── hardware     # Hardware-specific configuration
├── darwin       # MacOS and nix-darwin configuration
├── nixos        # My NixOS desktop-related configuration
├── overlays     # Drop an overlay file in this dir, and it runs. So far mainly patches.
└── vms          # VM-specific configs running in my home-lab

Bootstrap New Computer

For MacOS

Install dependencies

xcode-select --install
sh <(curl -L https://nixos.org/nix/install) --daemon
nix run nix-darwin -- switch --flake ~/.config/nix-darwin

Install config

nix --experimental-features 'nix-command flakes' build .#darwinConfigurations.Dustins-MBP.system --impure && \
./result/sw/bin/darwin-rebuild switch --flake .#Dustins-MBP --impure && \
unlink ./result

For NixOS, one command does the trick

Download and burn the minimal ISO image, then run:

Important

For Nvidia cards, select the second option nomodeset when booting the installer.

Note

Until I ship sops-nix, you'll need to set the user password on first boot. Ctrl-Alt-F2 gives you another shell where you can login as root and run passwd <user>. Ctrl-Alt-F7 gets back to the login screen.

Warning

Running these commands will reformat your entire drive to the ext4 filesystem.

nix run --extra-experimental-features 'nix-command flakes' github:dustinlyons/nixos-config#secrets
nix run --extra-experimental-features 'nix-command flakes' github:dustinlyons/nixos-config#install

Live ISO

Not yet available. Coming soon.

nix run --extra-experimental-features 'nix-command flakes' github:dustinlyons/nixos-config#live

Making changes

You can edit your configuration and save the changes.

Build and switch to new generation

On Mac

nix --experimental-features 'nix-command flakes' build .#darwinConfigurations.Dustins-MBP.system --impure && \
./result/sw/bin/darwin-rebuild switch --flake .#Dustins-MBP --impure && \
unlink ./result

On NixOS

sudo nixos-rebuild switch --flake .#felix

Update dependencies

nix flake update

Read my occasional musings on Nix

Follow @dustinhlyons

"All we have to decide is what to do with the time that is given us." - J.R.R. Tolkien

Star History

Star History Chart

nixos-config's People

Contributors

dustinlyons avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.