{"id":13682161,"url":"https://github.com/martinbaillie/dotfiles","last_synced_at":"2025-04-06T22:12:19.006Z","repository":{"id":51397311,"uuid":"48737281","full_name":"martinbaillie/dotfiles","owner":"martinbaillie","description":"🏠","archived":false,"fork":false,"pushed_at":"2024-12-12T22:19:58.000Z","size":12411,"stargazers_count":87,"open_issues_count":0,"forks_count":6,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-30T21:10:56.085Z","etag":null,"topics":["dotfiles","emacs","exwm","macos","nix","nix-flake","nixos","openbsd"],"latest_commit_sha":null,"homepage":"","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/martinbaillie.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"martinbaillie"}},"created_at":"2015-12-29T08:35:09.000Z","updated_at":"2025-03-20T23:33:21.000Z","dependencies_parsed_at":"2023-01-31T07:46:07.943Z","dependency_job_id":"5344c290-530e-4bd0-9940-08ee21aba698","html_url":"https://github.com/martinbaillie/dotfiles","commit_stats":{"total_commits":361,"total_committers":5,"mean_commits":72.2,"dds":"0.28531855955678675","last_synced_commit":"7da368f5b45fa64dd3de77ecca3dcf38f647c00a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinbaillie%2Fdotfiles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinbaillie%2Fdotfiles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinbaillie%2Fdotfiles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinbaillie%2Fdotfiles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/martinbaillie","download_url":"https://codeload.github.com/martinbaillie/dotfiles/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247557770,"owners_count":20958047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dotfiles","emacs","exwm","macos","nix","nix-flake","nixos","openbsd"],"created_at":"2024-08-02T13:01:41.621Z","updated_at":"2025-04-06T22:12:18.985Z","avatar_url":"https://github.com/martinbaillie.png","language":"Nix","funding_links":["https://github.com/sponsors/martinbaillie"],"categories":["Nix"],"sub_categories":[],"readme":"#+BEGIN_html\n\u003cimg align=\"right\" src=\"xkcd.png\"/\u003e\n#+END_html\n* :house_with_garden: [[https://builtwithnix.org][https://img.shields.io/badge/built_with-Nix-5277C3.svg?logo=nixos\u0026labelColor=24292E]]  [[https://travis-ci.org/martinbaillie/dotfiles][https://img.shields.io/travis/martinbaillie/dotfiles/master.svg?label=NixOS\u0026logo=travis\u0026labelColor=24292E]]  [[https://github.com/martinbaillie/dotfiles/actions?query=workflow%3AmacOS][https://github.com/martinbaillie/dotfiles/workflows/macOS/badge.svg]] :TOC_2:noexport:\n- [[#about][About]]\n- [[#installation-notes][Installation Notes]]\n  - [[#macos][macOS]]\n  - [[#nixos][NixOS]]\n- [[#references][References]]\n\n* About\n---\nUPDATE: This is sorely out of date. I have maintained all my Nix and Emacs\nconfig using a literate Org file for the last couple of years. I plan to tidy up\nthe private parts and publish... at some point.\n---\n\nWelcome to the [[https://en.wiktionary.org/wiki/bikeshedding][bikeshed]]!\n\nThis repository houses all my [[machines][machine configurations]] expressed declaratively using a [[https://nixos.org/nix][Nix]] [[https://nixos.wiki/wiki/Flakes][flake]]. It covers both my personal and work devices that are running either NixOS or macOS.\n\nThe expressions are organised into platform-agnostic [[modules][modules]] that leverage the likes of the [[https://github.com/NixOS/nixpkgs][nixpkgs]], [[https://github.com/rycee/home-manager][home-manager]] and [[https://github.com/LnL7/nix-darwin][nix-darwin]] to fully configure the OS and userspace from scratch.\n\nThese days I am spending the majority of time in either Firefox or Emacs (+[[https://github.com/akermu/emacs-libvterm][vterm]]). On NixOS I am using [[https://github.com/ch11ng/exwm][EXWM]] and on macOS I am usually just running native fullscreen, ⌘↹ing between the two previously mentioned apps. Additionally, a simple [[modules/themes][theming]] system is used to switch various things between light and dark versions, and a [[options.nix#L22][secrets]] attribute set (kept encrypted in a private repository) is referenced throughout.\n\n#+BEGIN_QUOTE\nNOTE: Some twisted souls found value in all the ricing of the previous incarnation of this repository. I'll keep archived on this [[../../tree/archive][branch]] for reference.\n#+END_QUOTE\n\nCI (Travis for NixOS, GitHub Actions for macOS) runs on push. The jobs generate a special [[machines/ci/default.nix][CI machine]] that imports every module, and derives either a NixOS VM (via QEMU) or simply builds on a fresh Darwin agent VM (in the case of macOS). The resultant binaries are pushed to [[https://cachix.org/][Cachix]] and subsequently become available for any of my other machines, saving a lot of wasted battery!\n\nThe [[Makefile][Makefile]] (in conjunction with some helpful [[default.nix#L58][aliases]]) is used to drive most actions, abstracting away NixOS/macOS differences where necessary.\n\n* Installation Notes\nBelow are some rough platform specific installation notes I use to go from fresh installs to fully configured machine.\n** macOS\nFrom a fresh macOS install.\n**** Enable SSHd\n#+BEGIN_SRC shell\nsudo systemsetup -setremotelogin on\n#+END_SRC\n**** Install XCode\n#+BEGIN_SRC shell\nsudo xcodebuild -license\n#+END_SRC\n**** Change hostname to match target Nix machine\n#+begin_src shell\nsudo scutil --set HostName nixmachine\nsudo scutil --set LocalHostName nixmachine\nsudo scutil --set ComputerName nixmachine\ndscacheutil -flushcache\n#+end_src\n**** Add a new =keys= group\nFor sops-nix.\n1. System settings --\u003e Users and Groups --\u003e Add Account --\u003e Group\n2. Press (i) on =keys= and attach it to =mbaillie=\n**** Install Homebrew for those macOS GUI apps unmanageable through Nix\n#+BEGIN_SRC shell\n/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)\"\n#+END_SRC\n**** [APPLE SILICON] Install Rosetta2\n#+begin_src shell\nsoftwareupdate --install-rosetta\n#+end_src\n**** Install Nix (multi-user)\n#+BEGIN_SRC shell\ncurl --proto '=https' --tlsv1.2 -sSf -L \\\n    https://install.determinate.systems/nix | \\\n    sh -s -- install\n#+END_SRC\n**** [OPTIONAL] Seed Nix store contents from an existing Darwin machine\n#+BEGIN_SRC shell\nnix copy --no-check-sigs --keep-going --to ssh-ng://$REMOTE ~/.nix-profile\n#+END_SRC\n**** Grab dotfiles using forwarded agent\n#+BEGIN_SRC shell\nsudo git clone --recursive git@github.com:martinbaillie/dotfiles.git /etc/dotfiles\nsudo chown -R $USER: /etc/dotfiles\n#+END_SRC\n**** Set up Cachix one-off\n#+BEGIN_SRC shell\nnix-shell -p cachix\ncachix use martinbaillie\n#+END_SRC\n**** Switch to Nix configuration based on hostname\n#+BEGIN_SRC shell\nmake switch\n#+END_SRC\n**** Switch login shell to zsh\n#+BEGIN_SRC shell\nchsh -s /run/current-system/sw/bin/zsh $USER\n#+END_SRC\n**** Configure Emacs\n#+BEGIN_SRC shell\nmake config-emacs\n#+END_SRC\n**** Configure Casks\nSet Flux, Karabiner, Spectacle, Cursorcerer to start at boot, install kernel\nextensions and so on.\n**** Bump Kernel / User Limits\n** NixOS\n**** Media\n[[https://nixos.org/nixos/download.html][Download]] and verify latest NixOS minimal ISO:\n\n#+NAME: nixos-ver\n#+BEGIN_SRC emacs-lisp :cache yes\n\"21.05\"\n#+END_SRC\n\n#+RESULTS[8f7a4f3511d5d6152ec17fdf52addc1eecd1a880]: nixos-ver\n: 21.05\n\n#+NAME: nixos-rel\n#+BEGIN_SRC emacs-lisp :cache yes :var nixos-ver=nixos-ver\n(format \"%s.2796.110a2c9ebbf\" nixos-ver)\n#+END_SRC\n\n#+RESULTS[d02522c67a569b479981b108c6d2236d90a80aec]: nixos-rel\n: 21.05.2796.110a2c9ebbf\n\n#+NAME: nixos-url\n#+BEGIN_SRC emacs-lisp :cache yes :var nixos-ver=nixos-ver\n(format \"https://releases.nixos.org/nixos/%s\" nixos-ver)\n#+END_SRC\n\n#+RESULTS[6ea8b95b40577283983b31f1862093ba872ded97]: nixos-url\n: https://releases.nixos.org/nixos/21.05\n\n#+BEGIN_SRC shell :exports code :var NIXOS_REL=nixos-rel NIXOS_URL=nixos-url\ncurl -O ${NIXOS_URL}/nixos-${NIXOS_REL}/nixos-minimal-${NIXOS_REL}-x86_64-linux.iso\ncurl -O ${NIXOS_URL}/nixos-${NIXOS_REL}/nixos-minimal-${NIXOS_REL}-x86_64-linux.iso.sha256\nsha256sum -c nixos-minimal-${NIXOS_REL}-x86_64-linux.iso.sha256\n#+END_SRC\n\nCreate a bootable NixOS USB (macOS example):\n#+BEGIN_SRC shell :exports code :var NIXOS_REL=nixos-rel NIXOS_URL=nixos-url\ndiskutil list # Find USB\ndiskutil unmountDisk /dev/disk2\ndd if=nixos-minimal-${NIXOS_REL}-x86_64-linux.iso of=/dev/rdisk2 bs=4m\ndiskutil unmountDisk /dev/disk2\n#+END_SRC\n\nCreate a bootable NixOS USB (NixOS example):\n#+BEGIN_SRC shell :exports code :var NIXOS_REL=nixos-rel NIXOS_URL=nixos-url\nlsblk -i # Locate the device.\ncp nixos-minimal-${NIXOS_REL}-x86_64-linux.iso /dev/sdX # Target whole disk.\n#+END_SRC\n**** BIOS Tweaks (ThinkPad)\n- [X] Disable Secure Boot\n- [X] Enable CSM Support\n**** Boot\nSetup networking:\n#+BEGIN_SRC shell\nsudo su\nwpa_supplicant -B -i interface -c \u003c(wpa_passphrase 'SSID' 'key')\nip addr\n#+END_SRC\n\nConduct rest of install from other laptop for convenience (+SSH agent forwarding):\n#+BEGIN_SRC shell\nssh -A root@\u003caddr\u003e\n#+END_SRC\n**** Partition\nCreate a =500M= boot partition:\n#+BEGIN_SRC shell\ngdisk /dev/nvme0n1\n#  o (create new empty partition table)\n#  n (add partition, 500M, type ef00 EFI)\n#  n (add partition, remaining space, type 8301 Linux Reserved - in the absence of a LUKS code)\n#  w (write partition table and exit)\n#+END_SRC\n\nSetup the encrypted LUKS partition and open it:\n#+BEGIN_SRC shell\ncryptsetup luksFormat /dev/nvme0n1p2\ncryptsetup luksOpen /dev/nvme0n1p2 enc-pv\n#+END_SRC\n\nCreate two logical volumes (swap and root):\n#+BEGIN_SRC shell\npvcreate /dev/mapper/enc-pv\nvgcreate vg /dev/mapper/enc-pv\nlvcreate -L 8G -n swap vg\nlvcreate -l '100%FREE' -n root vg\n#+END_SRC\n\nFormat the partitions:\n#+BEGIN_SRC shell\nmkfs.fat -F 32 /dev/nvme0n1p1\nmkfs.ext4 -L root /dev/vg/root\nmkswap -L swap /dev/vg/swap\n#+END_SRC\n**** Install\nMount the partitions just created under /mnt:\n#+BEGIN_SRC shell\nmount /dev/vg/root /mnt\nmkdir /mnt/boot\nmount /dev/nvme0n1p1 /mnt/boot\nswapon /dev/vg/swap\n#+END_SRC\n\nInstall:\n#+BEGIN_SRC shell\nuseradd -m -G wheel martin\nsudo su - martin\nnix-shell -p git --run \\\n    git clone --recursive git@github.com:martinbaillie/dotfiles.git \\\n    /mnt/etc/dotfiles\n\nnix-shell -p nixUnstable -p git\nsudo -E nixos-install --option pure-eval no --flake .\\#$HOSTNAME\n\n# make -C /mnt/etc/dotfiles install\n#+END_SRC\n**** Iterative Troubleshooting\nIf system doesn't boot:\n#+BEGIN_SRC shell\ncryptsetup luksOpen /dev/nvme0n1p2 enc-pv\nlvchange -a y /dev/vg/swap\nlvchange -a y /dev/vg/root\nmount /dev/vg/root /mnt\nmount /dev/nvme0n1p1 /mnt/boot\nswapon /dev/vg/swap\nwpa_supplicant -B -i interface -c \u003c(wpa_passphrase 'SSID' 'key')\nnixos-enter\n#+END_SRC\n\nTry again.\n**** Import GPG key\n#+BEGIN_SRC shell\ngpg --import ~/.gnupg/gpg.asc\n#+END_SRC\n**** Configure Emacs\n#+BEGIN_SRC shell\nmake config-emacs\n#+END_SRC\n* References\n- [[https://github.com/hlissner][@hlissner]]\n- [[https://github.com/jwiegley][@jwiegley]]\n- [[https://github.com/cmacrae][@cmacrae]]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinbaillie%2Fdotfiles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartinbaillie%2Fdotfiles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinbaillie%2Fdotfiles/lists"}