Skip to content

Initial installation

A DNF network is set up step by step, and you can stop at any stage: a single workstation is enough to get started.

  1. A workstation: the administrator’s machine (this page).
  2. A gateway: create a zone and connect other workstations to it.
  3. Coordination: link the zones together with a VPN (tailnet).

The first workstation installs itself, from the generic ISO, with no other machine: this is the simplest path.

  1. Get the image

    The generic ISO attached to each framework release 🡕 (dnf-installer-vX.Y.Z-x86_64-linux.iso), written to a USB stick.

  2. Boot the machine from the stick, wired, Secure Boot disabled.

  3. Answer the wizard

    It launches on its own on the console, once the network is up. Ctrl-C gives the command prompt, from where it restarts:

    Fenêtre de terminal
    darkone new

    It asks for the language and keyboard, the administrator’s identity and password, the network domain, the machine name, the disk if there are several (not below 20 GB: the backup key is never offered), then disk encryption and its passphrase. The rest is detected: laptop or desktop, UEFI or BIOS, the country’s time zone. Unencrypted disk: a passphrase for the key backup.

  4. Confirm

    The summary shows the final choices (domain, login). The disk is then erased and the system installed, project included, in /etc/nixos.

  5. Back up the keys, on a second USB stick

    Plug in a USB stick (FAT, exFAT, ext4…), select it: nothing on it is erased. The wizard writes dnf-backup-<domain>.tar.age to it, then asks you to unplug and replug it to read it back. No reread backup, no end of installation.

  6. Reboot, USB sticks removed. Encrypted disk: the passphrase is requested at every boot, with the chosen keyboard. The first session opens a home page in the browser: step 1 of 4 done, the gateway next.

An answers file stands in for the questions; a missing answer is requested, or refused with --non-interactive.

reponses.yaml
version: 1
admin:
login: "alice"
name: "Alice Martin"
passwordHash: '$y$j9T$...' # mkpasswd -m yescrypt
network:
domain: "example.org"
host:
hostname: "poste"
disk:
encrypt: true
locale:
language: "fr_FR.UTF-8"
backup:
device: "/dev/disk/by-label/SECOURS" # clé USB de la sauvegarde
Fenêtre de terminal
darkone new --answers reponses.yaml --non-interactive --yes \
--luks-passphrase-file /run/user/1000/luks

The disk passphrase never goes into the answers file, which circulates: --luks-passphrase-file reads it from a file, otherwise it is requested. It also encrypts the backup; unencrypted disk, that is --backup-passphrase-file. In scripted mode, the USB stick is reread without being unplugged.

dnf-backup-<domain>.tar.age, encrypted with age, contains:

  • nix/: the (SSH) deployment key and the admin age key derived from it;
  • infra.key: the infra age key;
  • project.bundle: the project, /etc/nixos, as a git bundle.

To open it, on any Linux with age:

Fenêtre de terminal
age -d dnf-backup-example.org.tar.age | tar -x
git clone dnf-backup/project.bundle mon-reseau

On a new administration workstation, the keys go back in place, under the nix account, in mode 600: /home/nix/.ssh/id_ed25519, /home/nix/.config/sops/age/keys.txt and /etc/sops/age/infra.key. As the project evolves: just backup-admin <device> redoes the backup (recipes).

--dry-run prints the plan without touching anything, on any machine.

Manual path, from an administration machine that is already a DNF host. The project starts from the template provided by the framework: a ready-made structure and a commented etc/config.yaml to fill in.

  1. Create the repository

    Fenêtre de terminal
    nix flake new -t github:darkone-linux/darkone-nixos-framework mon-reseau
    cd mon-reseau && git init && git add -A

    The project pins the latest framework release. Another path: the GitHub template dnf-boilerplate 🡕 (the “Use this template” button), a published copy of the same template.

  2. Bootstrap the framework

    Fenêtre de terminal
    nix run github:darkone-linux/darkone-nixos-framework#init
    nix develop github:darkone-linux/darkone-nixos-framework
  3. Initialize the secrets

    Fenêtre de terminal
    just configure-admin-host

Everything is declared in etc/config.yaml (network, zones, users, hosts). For a first workstation, one zone, one user and one host suffice: every host belongs to a zone (or carries a public ipv4 address).

An editor with yaml-language-server (Zed, VS Code with the YAML extension…) completes and validates every key, thanks to this first line of the file (already present in a project created from the template):

# yaml-language-server: $schema=../dnf/config/config.schema.json
etc/config.yaml
zones:
main:
description: "Réseau principal"
ipPrefix: "10.0" # cette zone utilise 10.0.0.0/16
users:
alice:
uid: 1000
name: "Alice"
profile: "nix-admin"
groups: ["global"]
hosts:
- hostname: "poste"
name: "Poste de l'administrateur"
zone: "main:1.10" # IP fixe 10.0.1.10 ("main" seul = DHCP)
profile: "desktop"
users: ["alice"]
disko:
profile: "btrfs-1-disk"
devices:
main: "/dev/nvme0n1"

Then regenerate, check and commit:

Fenêtre de terminal
just generate # produit var/generated/*.nix depuis etc/config.yaml
just check-flake # nix flake check
git add . && git commit -m "Premier hôte"

The installation writes an image, boots the machine from it, then applies the full system.

  1. Get the image

    Fenêtre de terminal
    just build-iso

    This image carries your deployment key. Another path, without building: the generic ISO attached to each framework release 🡕 (dnf-installer-vX.Y.Z-x86_64-linux.iso); the key then authorizes itself at boot.

  2. Boot the machine

    Write the image to a USB stick, plug the computer into the network wired, then boot from the stick. Before the command prompt, the screen shows a DNF welcome message, then the IP address and MAC address of the interface connected to the Internet (served by the local gateway or your router): note them down.

    - IP: 10.0.0.50
    - MAC: aa:bb:cc:dd:ee:ff

    The dnf-netinfo command displays them again.

    With the generic ISO, the screen reminds you: set a password (passwd), then authorize the key from the admin workstation.

    Fenêtre de terminal
    sudo -i -u nix ssh-copy-id nixos@10.0.0.50
  3. Set the addresses (as soon as a zone exists)

    The installation ends with a reboot, and the next steps must find the machine again. Two cases:

    • MAC address already declared: nothing to do, the gateway serves the same static address to the USB stick and the installed system;
    • MAC address unknown: read it, then declare it.
    Fenêtre de terminal
    # just host-info <hôte> <ip-actuelle>
    just host-info poste 10.0.0.50

    Enter the value in etc/config.yaml, with a static address, then redeploy the gateway of each affected zone:

    etc/config.yaml
    - hostname: "poste"
    zone: "maison:2.1"
    mac: "aa:bb:cc:dd:ee:ff"
    Fenêtre de terminal
    # Redéployer la passerelle locale
    just clean
    git add . && git commit -m "host(poste): installation"
    just apply gw
  4. Install the system

    Fenêtre de terminal
    # just full-install <hôte> <utilisateur> <ip>
    just full-install poste nixos 10.0.0.50
  5. The system is installed and up to date.