This repo contains a custom wrapper to build NixOS/nix-darwin/home-manager:
nix run github:mirkolenz/nixos -- --help- Install NixOS with provided ISO
- Create config:
nixos-generate-config - Migrate generated
/etc/nixos/configuration.nixand/etc/nixos/hardware-configuration.nixto this flake manually - Eventually install git in a temporary shell:
nix shell nixpkgs#git
# Large changes (like first time)
sudo nix run github:mirkolenz/nixos -- -o boot
# Small changes
sudo nix run github:mirkolenz/nixos- https://www.adaltas.com/en/2022/02/08/nixos-installation/
- https://wiki.nixos.org/wiki/NixOS_Installation_Guide
- https://gist.github.com/Vincibean/baf1b76ca5147449a1a479b5fcc9a222
parted -l # find device name, most likely /dev/sda
wipefs -a /dev/sda
parted /dev/sda
mklabel gpt
mkpart boot fat32 0% 512MiB
set 1 esp on
unit GiB print free
# determine the swap size by substractting the amount of your ram from the free size
# for instance, free size here is 238GiB and the ram of the system is 8GiB
mkpart root ext4 512MiB 230GiB
mkpart swap linux-swap 230GiB 100%One can also use the ncurses-based program cfdisk.
# Find out the device name, most likely /dev/sda
fdisk -l # or lsblk
wipefs -a /dev/sda
fdisk /dev/sda
g # empty gpt partition table
n # new partition
1 # partition number
2048 # first sector, default
+512M # last sector
t # change partition type
1 # partition number (if not already selected)
1 # efi partition type
n # new partition
2 # partition number
# first sector, default
-16G # last sector, size of swap (about the size of your ram)
n # new partition
3 # partition number
# first sector, default
# last sector, default
t # change partition type
3 # partition number
19 # linux swap
v # verify
w # writemkfs.fat -F 32 -n boot /dev/sda1
mkfs.ext4 -L root /dev/sda2
mkswap -L swap /dev/sda3mount /dev/disk/by-label/root /mnt
swapon /dev/disk/by-label/swap
mkdir -p /mnt/boot
mount /dev/disk/by-label/boot /mnt/bootIf you get an error like too many open files during nixos-install, try one of the following options:
- Execute
ulimit -n 65535before installing to increase the number of open files for the current shell session - Use
--max-jobs 2to limit the number of parallel jobs (could also try with 1 max job)
nixos-generate-config --root /mnt
cd /mnt/etc/nixos/
# Now verify that the hardware configuration of this flake is in sync with the generated `hardware-configuration.nix`
# The machine name is required for the nixos-install command, even if hostname is updated
nixos-install --flake github:mirkolenz/nixos#MACHINE_NAME
# One could append --no-root-passwd to the command, but that may affect the ability to enter emergency modeA warning about /boot being world-readable is not an issue, the permissions are correctly set after a reboot.
If getting an error like Getting status of /nix/store/...: No such file or directory, try the following
nix-store --verify --check-contents --repair- Create auth key: https://login.tailscale.com/admin/settings/keys
- SSH into the machine
- Save the auth key to
./tsauth.txt - Run
sudo tailscale up --auth-key file:tsauth.txt - Run
tailscale statusto verify the connection - Remove the auth key file:
rm ./tsauth.txt - Approve exit-node/routes: https://login.tailscale.com/admin/machines
- Install Apple Developer Tools:
xcode-select --install - Install Homebrew
- Install Nix
- Sign into the App Store
- Enable Full Disk Access for terminal application
sudo nix run github:mirkolenz/nixos
sudo reboot
# Add ssh key to keychain
ssh-add --apple-use-keychain ~/.ssh/id_ed25519chsh -s /bin/zsh
# if nix is not in PATH, use this: /nix/var/nix/profiles/default/bin/nix
sudo nix --extra-experimental-features "nix-command flakes" run github:mirkolenz/nixos#darwin-uninstaller
sudo /nix/nix-installer uninstallShell
- Copy
$HOME/.local/share/fish/fish_history - Copy
$HOME/.ssh/id_ed25519
Zed
- Copy keymap/settings/tasks from
$HOME/.config/zed
System Preferences
General > About: Set nameWallpaper: Solid color (black)Appearance > Allow wallpaper tinting in windows: OffKeyboard > Keyboard Shortcuts > Modifier Keys: Caps Lock -> OptionKeyboard > Keyboard Shortcuts > App Shortcuts: Disable allKeyboard > Keyboard Shortcuts > Spotlight: Disable all
Raycast
Settings > Advanced > Import/Export(also set up new schedule)Settings > Account > LoginSettings > Extensions > Scripts > Plus: iCloud DriveLaunch > Manage Fallback Command: Add Kagi
Visual Studio Code
Settings > Backup and Sync Setting > GitHub
Zotero
- Install Better BibTeX
- Install Open PDF
Settings > General > Customize Filename Format > {{ creators max="1" case="hyphen" }}-{{ year }}-{{ title truncate="50" case="hyphen" }}Settings General > Reader > Tabs > Creator - Title - YearSettings > Export > Item Format > Better BibTeX Citation Key Quick CopySettings > Export > Note Format > Markdown + Rich TextSettings > Better BibTeX > Citation Key Format > auth.capitalize + year + shorttitle(3,3)Settings > Better BibTeX > Citation Key Format > Automatic Export > Delay > 10 secondsSettings > Better BibTeX > Fields > Omit > file, keywords
Default Folder X
Settings > Options > Sync settings via iCloud
iA Presenter
- Move theme to
$HOME/Library/Containers/net.ia.presenter/Data/Library/Application Support/iA Presenter/Themes
Arq Backup
Additional wildcard exclude rules:
.cache
.devenv
.direnv
.orbstack
.venv
node_modules
*/OrbStack
*/Library/CloudStorage
*/Library/Application Support/Note: Reconnect via SSH after installing nix.
ssh-copy-id -i "$HOME/.ssh/id_ed25519.pub" "USER@MACHINE_NAME"
sudo /nix/var/nix/profiles/default/bin/nix upgrade-nix
nix run github:mirkolenz/nixos
sudo usermod -s $(which fish) "$USER"To avoid rate limiting, add a GitHub access token.
Add the following to /etc/nix/nix.secrets.conf:
access-tokens = github.com=github_pat_XXXIf building for another architecture on NixOS: Enable cross compiling
# for iso installer disc
nix build --system x86_64-linux github:mirkolenz/nixos#installers.unstable.iso-installer
# for raspberry pi sd card
nix build --system aarch64-linux github:mirkolenz/nixos#installers.raspihttps://nix.dev/tutorials/installing-nixos-on-a-raspberry-pi#updating-firmware
sudo mount /dev/disk/by-label/FIRMWARE /mnt
sudo env BOOTFS=/mnt FIRMWARE_RELEASE_STATUS=default rpi-eeprom-update -d -a
sudo reboot# otherwise the optical drive is not found: https://discourse.nixos.org/t/makemkv-cant-find-my-usb-blu-ray-drive/23714
sudo modprobe sg
# if that does not work, try again with sudo
nix run github:mirkolenz/nixos#makemkvsudo podman run --rm --subuidname=$USER ubuntu cat /proc/self/uid_mapmkdir -p /etc/nixos/secrets
chmod 700 /etc/nixos/secrets
mkpasswd -m yescrypt > /etc/nixos/secrets/USER.passwd
chmod 600 /etc/nixos/secrets/USER.passwd