Giter VIP home page Giter VIP logo

nixos-nanopc-t4's Introduction

Description

This document on how I configure NixOS on NanoPC-T4 and contains my original collection of notes and links when researching how to do this.

NanoPC-T4 Photo

Solution

Booting

To install NixOS on you can follow the official instructions by downloading the pre-built images. You can also build the U-Boot image yourself from nixpkgs based on changes added in #111034.

NixOS Config

The basic configuration should look something like this:

{
  # Disable Grub in favor of ExtLinux
  boot.loader.grub.enable = false;
  # Enables the generation of /boot/extlinux/extlinux.conf
  boot.loader.generic-extlinux-compatible.enable = true;
  # Enable additional firmware (such as Wi-Fi drivers).
  hardware.enableRedistributableFirmware = true;
}

To make the NVMe SSD be detected at boot compile Rockchip modules directly into the kernel:

{
  boot.kernelPatches = [{
    name = "pcie-rockchip-config.patch";
    patch = null;
    extraConfig = ''
      PHY_ROCKCHIP_PCIE y
      PCIE_ROCKCHIP_HOST y
    '';
  }];
}

For more details see the PCI NVMe document.

NixOS on ZFS

My solution was to migrate the OS from the eMMC storage to the NVMe.

I create the ZFS pool and three filesystems on the SSD:

zpool create -O xattr=sa -O acltype=posixacl -O mountpoint=none rpool /dev/nvme0n1
for vol in nix root home; do
    zfs create -o mountpoint=legacy rpool/$VOL
    mkdir /mnt/$VOL
    mount.zfs rpool/$VOL /mnt/$VOL
done
rsync -rax /. /mnt/root
rsync -rax /nix/. /mnt/nix
rsync -rax /home/. /mnt/home
rsync -rax /boot/. /

And I create a configuration that looks something like this:

{
  fileSystems."/boot" = { device = "/dev/disk/by-uuid/1234-5678"; fsType = "ext4"; };
  fileSystems."/" = { device = "rpool/root"; fsType = "zfs"; };
  fileSystems."/nix" = { device = "rpool/nix"; fsType = "zfs"; };
  fileSystems."/home" = { device = "rpool/home"; fsType = "zfs"; };
}

And rebuild he system:

sudo nixos-rebuild boot

After that it's necessary to run all the four rsync commands again to sync filesystems.

Once everything is synced you can finally reboot.

Notes

nixos-nanopc-t4's People

Contributors

jakubgs avatar mic92 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

tmountain mic92

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.