Skip to content

Latest commit

 

History

History
120 lines (84 loc) · 2.78 KB

File metadata and controls

120 lines (84 loc) · 2.78 KB

NixOS Config

Hosts

  • NixOS
    • lab (custom build)
    • pi (Raspberry Pi Model 4B (2GB RAM))
  • Darwin
    • mbp3 (MacBook Pro M3 Max)
  • Generic Linux

Setup

NixOS

The initial setup is pretty simple now thanks to disko.

  1. Boot the minimal disk ISO onto a computer

  2. Connect to the Internet

    # Enter sudo mode
    sudo -i
    
    # Start the service
    systemctl start wpa_supplicant.service
    
    # Use the CLI to connect
    wpa_cli
    
    > add_network 0
    > set_network 0 ssid "<network name>"
    > set_network 0 psk "<password>"
    > enable_network 0
    
    nix-shell -p disko
  3. Run the disko utility

    # Add the program to the path
    nix-shell -p disko
    
    CONFIG_PATH="github:suasuasuasuasua/nixos-config" # or you could clone locally first
    NAME="penguin" # for example
    disko --mode disko --flake "${CONFIG_PATH}"#"${NAME}"
    nixos-install --no-channel-copy --no-root-password --flake "${CONFIG_PATH}"#"${NAME}"
  4. Prepare the passwords and ZFS pools

    # Set your password
    nixos-enter --root /mnt -c "passwd ${USERNAME}"
    
    # Export the zpools so that they can be used by the actual computer (not the
    # installer!)
    zpool export -a
    
    # Reboot to your new system!
    reboot
  5. Initialize Samba (smb) (as root)

    # Add a user and a password
    smbpasswd -a ${USERNAME}
    smbpasswd -e ${USERNAME}
    
    # Make the zshare owned by samba and writable
    chgrp -R samba /zshare
    chmod -R 775 /zshare
  6. Make changes and rebuild the system

    # Rebuild the system after any changes!
    just switch

Darwin

The setup for darwin machines is much simpler. Make sure to connect to the internet before beginning.

  1. Install nix on the machine from the page. You may be prompted to install developer tools (like git, xcode, etc.), so make sure to accept and be patient.

  2. Install nix-darwin

    # To use Nixpkgs 25.05:
    sudo nix run nix-darwin/nix-darwin-25.05#darwin-rebuild -- switch --flake .
  3. Install the configuration from GitHub

    # switch to the mbp3 device for example
    darwin-rebuild switch --flake github:suasuasuasuasua/nixos-config#mbp3

Generic Linux

The setup for other Linux machines is much simpler. Make sure to connect to the internet before beginning.

  1. Install nix on the machine from the main page

  2. Install home-manager and switch configurations

    nix run home-manager -- switch --flake .#penguin