{"id":16334788,"url":"https://github.com/cole-h/nixos-config","last_synced_at":"2025-07-05T06:07:09.277Z","repository":{"id":45183992,"uuid":"243199820","full_name":"cole-h/nixos-config","owner":"cole-h","description":"My flakes-powered NixOS configuration","archived":false,"fork":false,"pushed_at":"2025-06-24T18:35:00.000Z","size":6402,"stargazers_count":79,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"darwin","last_synced_at":"2025-06-24T19:49:57.918Z","etag":null,"topics":["flakes","nixos","nixos-configuration"],"latest_commit_sha":null,"homepage":"","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cole-h.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2020-02-26T07:44:44.000Z","updated_at":"2025-06-24T18:35:04.000Z","dependencies_parsed_at":"2023-12-15T00:22:08.084Z","dependency_job_id":"e8b8a839-6e9e-463d-a3e5-e4ef9ff89c25","html_url":"https://github.com/cole-h/nixos-config","commit_stats":{"total_commits":809,"total_committers":2,"mean_commits":404.5,"dds":"0.0012360939431397266","last_synced_commit":"19debe3d3822ca7c29437a079ad89a4a1eac5220"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/cole-h/nixos-config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cole-h%2Fnixos-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cole-h%2Fnixos-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cole-h%2Fnixos-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cole-h%2Fnixos-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cole-h","download_url":"https://codeload.github.com/cole-h/nixos-config/tar.gz/refs/heads/darwin","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cole-h%2Fnixos-config/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263692914,"owners_count":23496944,"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":["flakes","nixos","nixos-configuration"],"created_at":"2024-10-10T23:39:17.324Z","updated_at":"2025-07-05T06:07:09.261Z","avatar_url":"https://github.com/cole-h.png","language":"Nix","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dotfiles\n\n### Hostnames\n\nI'm a big fan of [Brandon Sanderson], so that's where all of my hostnames come\nfrom (see [`names`](./names)). They were manually copy-pasted from throughout the\n[Coppermind] wiki and are [planets, shards], general terms, worldhoppers, and\n[locations] throughout his works. Any of these that had a space or apostrophe\nwere discarded.\n\n[Brandon Sanderson]: https://www.brandonsanderson.com/\n[hostnames]: ./hostnames\n[Coppermind]: https://coppermind.net/wiki/Coppermind:Welcome\n[planets, shards]: https://coppermind.net/wiki/Cosmere#Planets\n[locations]: https://coppermind.net/wiki/Category:Locations\n\n---\n\n# Setup stuff\n\nhttps://grahamc.com/blog/nixos-on-zfs\n\nhttps://elis.nu/blog/2020/05/nixos-tmpfs-as-root/\n\n## 0. preparation\n  - make iso with `nix build .#iso`\n  - backup stateful stuff if reinstalling to same disk\n    - FF profile\n    - sonarr settings (watched shows, etc)\n    - fish shell history\n\n## 1. partition\n  - 2GiB /boot at the beginning\n  - 32GiB swap partition at the beginning\n  - rest \"linux partition\" (for ZFS) -- don't forget native encryption\n    (\"encryption=aes-256-gcm\") and \"compression=zstd\"\n    - apool/r (none)\n    - apool/r/local (none) -- shouldn't be backed up\n    - apool/r/local/root (legacy)\n    - apool/r/local/nix (legacy)\n    - apool/r/local/tmp (legacy)\n    - apool/r/local/var (legacy)\n    - apool/r/safe (none) -- \"safe\" to back up\n    - apool/r/safe/state/home (legacy)\n    - apool/r/safe/state/home/vin (legacy)\n    - apool/r/safe/state/home/vin/Downloads (legacy) -- don't backup\n    - apool/alloc (none) -- 1G file to make sure we don't run out of space (can be freed to make fs stuff work again)\n\n``` sh\n# This section should be run as root.\n\nexport DISK=/dev/disk/by-id/.....\ngdisk $DISK\n  # o (delete all partitions + protective mbr)\n  # n, 1, +1M,   +2G, ef00  (EFI boot)\n  # n, 2, ...,  +32G, 8200  (swap)\n  # n, 3, ...,  ....,  ...  (Linux)\n  # c, 3, \"[a-z][0-9]?pool\" -- set part label\n  # w\n\nmkfs.fat -F 32 -n boot $DISK-part1\nmkswap -L swap $DISK-part2\n\nzpool create \\\n    -O mountpoint=none \\\n    # SSDs may or may not lie that it uses a 512B physical block size;\n    # ashift of 12 (4k) shouldn't really hurt, according to various\n    # people\n    -o ashift=12 \\\n    -R /mnt \\\n    apool $DISK-part3\n\nzfs create \\\n    -o canmount=off \\\n    -o atime=off \\\n    # requires ZoL 2.0\n    -o compression=zstd \\\n    # apparently gcm is faster than ccm\n    -o encryption=aes-256-gcm -o keyformat=passphrase \\\n    -o xattr=sa \\\n    -o acltype=posixacl \\\n    apool/r\n\n# https://gist.github.com/LnL7/5701d70f46ea23276840a6b1c404597f\n# maybe don't need mountpoint=legacy except for /nix?\nalias nomount='zfs create -o canmount=off'\nalias legacy='zfs create -o mountpoint=legacy'\nnomount apool/r\nnomount apool/r/local\nlegacy apool/r/local/root # /\nlegacy apool/r/local/tmp # /tmp\nlegacy apool/r/local/nix # /nix\nlegacy apool/r/local/var # /var\nnomount apool/r/safe\nlegacy apool/r/safe/state\nlegacy -p apool/r/safe/state/home/vin/Downloads # create /home, /home/vin, and /home/vin/Downloads datasets\n# zfs create -s -V 400G apool/r/win10\n\n# keep space available in case it's ever needed\n# to free up the space, `zfs set refreservation=none apool/alloc`\nnomount -o refreservation=1G apool/alloc\n\n# create snapshot of everything `@blank` -- easy to switch to tmpfs if I want\nzfs snapshot -r apool/r@blank\n# roll back with `zfs rollback -r apool/r@blank`\n\nalias zmnt='mount -t zfs'\nzmnt apool/r/local/root /mnt\nmkdir -p /mnt/{boot,var,nix,state/home/vin/Downloads,mnt,shares/media}\nzmnt apool/r/local/var /mnt/var\nzmnt apool/r/local/nix /mnt/nix\nzmnt apool/r/safe/state /mnt/state\nzmnt apool/r/safe/state/home /mnt/state/home\nzmnt apool/r/safe/state/home/vin /mnt/state/home/vin\nzmnt apool/r/safe/state/home/vin/Downloads /mnt/state/home/vin/Downloads\nmount $DISK-part1 /mnt/boot\n```\n\n\n## 2. install\n\n``` sh\n# This section should be run as the ISO user\n\ngit clone https://github.com/cole-h/nixos-config /mnt/tmp/nixos-config\n\ndoas swapon $DISK-part2 # otherwise, nixos-install won't generate hardware config for this\nnixos-generate-config --root /mnt --dir /tmp/nixos-config/hosts/scadrial\n\nsed \"s@networking.hostId = \\\".*\\\"@networking.hostId = \\\"$(head -c 8 /etc/machine-id)\\\"@\" -i hosts/scadrial/modules/networking.nix\n# copy old host key to /mnt/tmp/host/ed25519? or maybe it's /tmp/host/ed25519. why not both.\nnix build /mnt/tmp/nixos-config#bootstrap --out-link /tmp/outsystem\nnixos-install --system /tmp/outsystem --no-root-passwd --no-channel-copy\n\nnixos-enter\n  echo \"nameserver 192.168.1.212\" \u003e\u003e /etc/resolv.conf\n  nix-daemon \u0026\u003e/dev/null \u0026\n  doas -u vin bash\n    doas chown -R vin:users /tmp/nixos-config\n    mv /tmp/nixos-config ~/flake\n    doas nixos-rebuild switch --flake .\n    # add new host key to .agenix.toml (assuming it exists yet... might\n    #   need to be once new system is booted)\n\nsystemctl reboot\n```\n\n\n## 3. setup\n\n``` sh\n# This section should be run as the default user (vin, in this case)\n\ndoas mount -t zfs rpool/user/home /mnt\nrsync -aP /mnt/vin/.password-store/ ~/.password-store/\nrsync -aP /mnt/vin/.mozilla/ ~/.mozilla/\nrsync -aP /mnt/vin/workspace/ ~/workspace/\nln -s ~/.local/share/hydrus/db ~/workspace/vcs/hydrus/db\nrsync -a /mnt/vin/.cache/.j4_history ~/.cache/\nrsync -aP --ignore-existing /mnt/vin/.local/share/chatterino/ ~/.local/share/chatterino/\nrsync -a /mnt/vin/.local/share/zoxide/ ~/.local/share/zoxide/\nrsync -a /mnt/vin/.local/share/fish/fish_history ~/.local/share/fish/\n# verify PCI addresses in windows10.xml and start.sh / revert.sh, then:\ndoas virsh define ..../windows10.xml\n\n# update snapshot settings to use new dataset(s)\n# copy sonarr settings (watched shows, etc) from backup\n# syncthing setup\n# copy authorized_keys\n# copy chatterino stuff\n# copy todo stuff\n```\n\n\n# Notes\n\n## Backup win10 disk to fresh zvol\n\n```sh\n# /dev/sda is the Windows disk\n# /dev/zd0 is the zvol's block device\n\n# Need to copy the GPT in order to make zd0pX devices available\nnix shell nixpkgs#gptfdisk\n  sgdisk /dev/sda -R /dev/zd0\ndoas bash\n  nix shell nixpkgs#pv\n    pv /dev/sdaX \u003e/dev/zd0pX\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcole-h%2Fnixos-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcole-h%2Fnixos-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcole-h%2Fnixos-config/lists"}