dotfiles, but for systems where I have a better tool in the arsenal than Ansible
Go to file
Hoang Nguyen 59199874a3
Add extract.sh script
2024-03-14 00:00:00 +07:00
darwin Fix Grub config 2024-02-25 00:00:00 +07:00
flake Fix some home-manager modules, and add more user packages 2024-03-03 00:00:00 +07:00
home-manager Add extract.sh script 2024-03-14 00:00:00 +07:00
hosts Enable apparmor 2024-03-10 00:00:00 +07:00
lib Extract custom functions out of lib 2024-01-07 00:00:00 +07:00
nixos Enable apparmor 2024-03-10 00:00:00 +07:00
tests Extract custom functions out of lib 2024-01-07 00:00:00 +07:00
.editorconfig Code snapshot 2024-02-09 00:00:00 +07:00
.envrc Initial commit 2023-09-17 00:00:00 +07:00
.gitattributes It works now 2023-09-24 00:00:00 +07:00
.gitignore sed doesn't work on store symlink 2023-09-24 00:00:00 +07:00
.sops.yaml Initial config for aragorn host 2024-02-18 00:00:00 +07:00
LICENSE Code snapshot 2024-02-09 00:00:00 +07:00
NOTES.md fix: regression in obtaining the flake registry list 2024-02-16 00:00:00 +07:00
README.md Add user config for aragorn 2024-03-03 00:00:00 +07:00
TODO.md Enable apparmor 2024-03-10 00:00:00 +07:00
flake.lock Add extract.sh script 2024-03-14 00:00:00 +07:00
flake.nix Initial disko config for aragorn 2024-02-22 00:00:00 +07:00

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: