1
1
Fork 0
NixOS Configuration
Find a file
Myned 53c8575116
git: migrate to forgejo
Squashes 1,331 commits

Signed-off-by: Myned <dev@bjork.tech>
2024-09-12 19:41:21 -05:00
machines git: migrate to forgejo 2024-09-12 19:41:21 -05:00
options git: migrate to forgejo 2024-09-12 19:41:21 -05:00
profiles git: migrate to forgejo 2024-09-12 19:41:21 -05:00
secrets git: migrate to forgejo 2024-09-12 19:41:21 -05:00
.gitignore git: migrate to forgejo 2024-09-12 19:41:21 -05:00
configuration.nix git: migrate to forgejo 2024-09-12 19:41:21 -05:00
flake.in.nix git: migrate to forgejo 2024-09-12 19:41:21 -05:00
flake.lock git: migrate to forgejo 2024-09-12 19:41:21 -05:00
flake.nix git: migrate to forgejo 2024-09-12 19:41:21 -05:00
install.fish git: migrate to forgejo 2024-09-12 19:41:21 -05:00
LICENSE git: migrate to forgejo 2024-09-12 19:41:21 -05:00
README.md git: migrate to forgejo 2024-09-12 19:41:21 -05:00

Install

Remote (with NixOS Anywhere)

  1. Clone this repository

    git clone https://github.com/Myned/nixos
    
  2. Enable Flakes

  3. Boot from NixOS minimal installer

  4. Create machine-specific modules in machines/MACHINE/

    a. If Home Manager, home configuration in home.nix

    b. System configuration and hostname in system.nix

    { networking.hostName = "MACHINE"; }
    

    c. Disko layout in disko.nix

    # Verify /dev identifier on machine
    lsblk
    
    # Verify EFI/BIOS firmware on machine
    [ -d /sys/firmware/efi/efivars ] && echo "UEFI" || echo "BIOS"
    

    d. Generated hardware configuration in hardware-configuration.nix

    nixos-generate-config --show-hardware-config --no-filesystems --root /mnt
    

    e. Import modules in default.nix

  5. Choose profile and add machine-specific modules to flake.in.nix

    MACHINE = linux [ ./profiles/PROFILE ./machines/MACHINE ];
    
  6. Generate flake.nix with flakegen

    git add .
    nix run .#genflake flake.nix
    nix flake lock
    
  7. Copy host public SSH key to root on machine

    # On machine
    sudo passwd root
    
    # On host
    ssh-copy-id root@MACHINE
    
  8. Test and execute NixOS Anywhere

    nixos-anywhere --vm-test -f .#MACHINE root@IP
    nixos-anywhere -f .#MACHINE root@IP
    
  9. Shutdown, detach ISO, and reboot

Local (with script)

  1. Clone repository using personal access token

    git clone https://TOKEN@github.com/Myned/nixos /tmp/nixos
    
  2. Go to repository directory

    cd /tmp/nixos
    
  3. Check disk layout

    lsblk
    
  4. Modify disko layout to match hardware

    nano machine/MACHINE/disko.nix
    
  5. Execute install script

    sudo nix --experimental-features 'nix-command flakes' run nixpkgs#fish -- install.fish
    
  6. Optionally shred personal access token

    shred -zu github.token