dotfiles, but for systems where I have a better tool in the arsenal than Ansible
Go to file
Hoang Nguyen 8716fa17d3
Update configuration for the Darwin host
chromium package is not available on Darwin platforms, so use HomeBrew
there instead.
Also tweak puppeteer's configuration variables.
2024-04-06 00:00:00 +07:00
darwin
flake
home-manager Update configuration for the Darwin host 2024-04-06 00:00:00 +07:00
hosts Update configuration for the Darwin host 2024-04-06 00:00:00 +07:00
lib
nixos Add basic librewolf and chromium configuration 2024-03-31 00:00:00 +07:00
tests
.editorconfig
.envrc
.gitattributes
.gitignore
.sops.yaml
LICENSE
NOTES.md
README.md
TODO.md
flake.lock Update configuration for the Darwin host 2024-04-06 00:00:00 +07:00
flake.nix

README.md

folliehiyuki's Nix configuration

This Nix flake is used to manage:

  • my work laptop (an Apple M2 Macbook Air)
  • my NixOS desktop

For the configuration of my other desktop hosts running either AlpineLinux or ChimeraLinux, see dotfiles-ansible repository.

Table of Content

Setup

Darwin

nix and homebrew need to be installed separately:

  • nix: sh <(curl -L https://nixos.org/nix/install)
  • homebrew: bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Currently, there is only 1 Darwin host, to configure it:

nix build .#darwinConfigurations.hoangnguyenhuy.system
./result/sw/bin/darwin-rebuild switch --flake .#hoangnguyenhuy

NixOS

The NixOS host is set up with tmpfs root, so a few prerequisite steps are needed before nixos-install can be executed:

# Destroy, partition, format the targeted disk and mount them to /mnt
# Method 1: via a custom-built disko script
nix build .#nixosConfigurations.aragorn.config.system.build.diskoScript && ./result
# Method 2: use the original `disko` toplevel script via nix run
nix run .#disko -- --mode disko --flake .#aragorn

# Generate SSH key pairs
mkdir -m 0755 -p /mnt/persist/etc/ssh
ssh-keygen -t rsa -b 4096 -C root@aragorn -f /mnt/persist/etc/ssh/ssh_host_rsa_key
ssh-keygen -t ed25519 -C root@aragorn -f /mnt/persist/etc/ssh/ssh_host_ed25519_key

# Update .sops.yaml file with this new key, and run `sops updatekeys` for the host secrets

# Generate a random machine-id file (should be confidential :v)
systemd-machine-id-setup --root /mnt/persist/

# Install the NixOS system
nixos-install --no-root-passwd --root /mnt --flake .#aragorn

# Unmount and reboot
umount -R /mnt
reboot

# Reconfigure the installed system in the future
nixos-rebuild switch --flake .#aragorn

Credits

Guides for NixOS root on tmpfs: