RandomScientist/machines
1
0
Fork
You've already forked machines
0
nix configurations
  • Nix 98.5%
  • Shell 1.5%
2026年06月22日 16:34:34 -07:00
config silly mesa/kosmickrisp 2026年06月22日 16:34:34 -07:00
vendor silly mesa/kosmickrisp 2026年06月22日 16:34:34 -07:00
.gitignore
bootstrap-darwin.sh
flake.lock applications 2026年06月22日 16:33:30 -07:00
flake.nix more whatchamacallits and doohickeys 2026年06月06日 01:06:49 -07:00
README.md
rebuild-darwin

nix configurations for all of my machines.

general overview

hosts

  • ebf - netgear readynas 524x (with 4x4TB internal drives) (WIP, basically nonexistent atm)
  • ofanix - m1 macbook pro (darwin + nixos (not started yet))

general module composition

design is loosely structured around the dendritic pattern, with the addition of single-inheritance from base and a relatively small set of aspects (which i chose to call "tiers" well before i learned what a 'dendritic pattern' was and i'm sticking with it).

  • base - options that should always apply, other tiers implicitly inherit all configuration in base.
  • workstation - options that should apply when configuring a headless server or user.
  • graphical - options that should apply when configuring a machine or user with a graphical (i.e. desktop environment) interface.

top-level config folder structure

  • foundation/ - options that provide a foundational structure for the rest of the flake
  • hosts/<host>/ - options that apply to a specific host, delinated by folder name.
  • meta/ - options that apply to the behavior of the outer flake.
  • platform-specific/<platform>/<tier>/ - options that apply only for programs or features found on a specific platform, for module tier tier. this should only be used for programs which are exclusively present on a specific platform. cross-platform programs should instead be configured by a file in the general tiers folder. for example, the macos-exclusive Stats.app should be configured in platform-specific/darwin/, but not librewolf.
  • tiers/<tier>/ - options that apply to a cross-platform program present in tier. this may include platform-specific integrations for an otherwise cross-platform program (i.e. darwin launchd agent or daemon definitions as well as nixos.services configurations).
  • globals.nix - contains definitions for a few miscellaneous helper functions and constants
  • vendored.nix - contains mechanisms for convenient access to the vendored nixpkgs package functions stored in /vendor/ to the rest of the configuration

options subfolders

tiers may include a subfolder called options. all nix files in these folders define extension option definitions which are consumed in other parts of the config.

notable features

  • declarative, pure-nix configuration of macOS menubar and dock items
  • darwin/launchd configurations for rqbit, tor and usersspace wireguard
  • port of disko-zfs' nixos module to nix-darwin
  • sharing disko-zfs configuration across a darwin/nixos dual boot (not yet)
  • (moderately cursed) integration with imperatively installed openzfsonosx on darwin
  • script to bootstrap a darwin nix installation on a custom store volume (as long as it mounts to /nix), using the lix installer with plan modifications
  • a bunch of vendored stuff that should probably be upstreamed

thanks

notes

eventually i plan to create a (partial) port of disko to Darwin backed by diskutil, but until then here are my notes on bootstrapping a suitable zpool and dataset for provisioning a nix store on darwin with openzfsonosx.

  • diskutil addPartition disk<whatever> %<zfs fs type guid>% %noformat% <numblocks> (warn that diskutil's cli will refuse to use free space "trapped" between adjacent existing partitions. i had to boot to my macOS 1TR and nuke the system recovery volume to avoid this.)
  • zpool create -O normalization=formD -O casesensistivity=insensitive -O ashift=12 -O xattr=sa disk0s<part> -O com.apple.devdisk=off -O com.apple.browse=off <partition> <poolname>
    • note xattr=sa is set because it prevented a fs hang i got with the default xattr backend during nix store operations.
    • note ashift=12 is chosen because the NVME controller advertises blocksize=4096 and trying to outwit whatever black magic internal datastructures its using with a larger ashift is an exercise in futility.
  • zfs create <poolname>/nix -O mountpoint=/nix -O compression=lz4 -O atime=off

note -O mountpoint=/nix is insufficient to mount to root on darwin, since the root filesystem is readonly. Fortunately, apple has a special system for summoning directory symlinks and mountpoint stubs on / called synthetic.conf. see hosts/ofanix/fs.nix for scripts that roughly explain how to do this, as well as man 5 synthetic.conf (hint: use a file in /etc/synthetic.d). you also probably want to disable spotlight indexing, for that see again fs.nix and man mdutil, although mdutil is a bit worryingly jank at times (i had to start over with a dataset because mdutil got confused and failed to remove a /.Spotlight-V100 directory).