- Nix 98.5%
- Shell 1.5%
| config | silly mesa/kosmickrisp | |
| vendor | silly mesa/kosmickrisp | |
| .gitignore | ||
| bootstrap-darwin.sh | ||
| flake.lock | applications | |
| flake.nix | more whatchamacallits and doohickeys | |
| 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 flakehosts/<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 specificplatform, for module tiertier. 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 generaltiersfolder. for example, the macos-exclusive Stats.app should be configured inplatform-specific/darwin/, but not librewolf.tiers/<tier>/- options that apply to a cross-platform program present intier. 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 constantsvendored.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
openzfsonosxon 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
- @emily-lavender for the initial config and lots of help
- @irisfalke reference for nixcord, vscodium, etc
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=sais set because it prevented a fs hang i got with the default xattr backend during nix store operations. - note
ashift=12is 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.
- note
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).